diff options
author | Ivan Chen <yulunchen@google.com> | 2023-05-17 03:32:45 +0000 |
---|---|---|
committer | Ivan Chen <yulunchen@google.com> | 2023-05-17 03:32:45 +0000 |
commit | d7c9c6beb03ee5725232b9ac3bfe4825e1e227cb (patch) | |
tree | 3a0d6776c0e76e325d1b087cd51a850cb871358e /util | |
parent | 8641442366bd7c2c133e302a57f904dfac3c896b (diff) | |
parent | b34dc2ae9022e2fbb57ae6477891ff32954c62fd (diff) | |
download | chrome-ec-d7c9c6beb03ee5725232b9ac3bfe4825e1e227cb.tar.gz |
Merge remote-tracking branch cros/main into firmware-brya-14505.B-mainfirmware-brya-14505.B-main
Generated by: util/update_release_branch.py --board brya firmware-brya-14505.B-main
Relevant changes:
git log --oneline 8641442366..b34dc2ae90 -- board/brya board/brya
util/getversion.sh
BRANCH=None
TEST=`make -j buildall`
Force-Relevant-Builds: all
Change-Id: I63149b4c1782b3ed57f2556755901c21f5f1e3e9
Signed-off-by: Ivan Chen <yulunchen@google.com>
Diffstat (limited to 'util')
-rwxr-xr-x | util/check_low_coverage_reason.py | 58 | ||||
-rwxr-xr-x | util/ec_openocd.py | 13 |
2 files changed, 64 insertions, 7 deletions
diff --git a/util/check_low_coverage_reason.py b/util/check_low_coverage_reason.py new file mode 100755 index 0000000000..c6119f6a6a --- /dev/null +++ b/util/check_low_coverage_reason.py @@ -0,0 +1,58 @@ +#!/usr/bin/env python3 +# Copyright 2023 The ChromiumOS Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Ensure commit messages using LOW_COVERAGE_REASON include a bug.""" + +import logging +import pathlib +import re +import sys + +from chromite.lib import commandline +from chromite.lib import cros_build_lib +from chromite.lib import git + + +# Look for LOW_COVERAGE_REASON and then an optional b{:|/}number bug reference. +LOW_COV_REGEX = re.compile( + r"\s*(LOW_COVERAGE_REASON=)(?:(?!b[/|:][\d]+).)*(b[/|:]([\d]+))?" +) +EC_BASE = pathlib.Path(__file__).resolve().parent.parent + + +def main(argv=None): + """Check for bug in LOW_COVERAGE_REASON.""" + parser = commandline.ArgumentParser() + parser.add_argument( + "commit_id", + help="Commit whose message will be checked.", + ) + opts = parser.parse_args(argv) + + if opts.commit_id == "pre-submit": + # Only run check if verifying an actual commit. + return 0 + + try: + commit_log = git.Log(EC_BASE, rev=opts.commit_id, max_count=1) + except cros_build_lib.RunCommandError as err: + logging.error("Unable to query git log: %s", str(err)) + return 1 + + # Search commit message for LOW_COVERAGE_REASON and bug + matches = LOW_COV_REGEX.findall(commit_log) + if matches and not any({m[2] for m in matches}): + # We have LOW_COVERAGE_REASON line(s) but none include a bug + logging.error( + "LOW_COVERAGE_REASON line must include one or more bugs " + "tracking the reason for missing coverage" + ) + return 1 + + return 0 + + +if __name__ == "__main__": + sys.exit(main(sys.argv[1:])) diff --git a/util/ec_openocd.py b/util/ec_openocd.py index 5da0479ed9..b8c9364bd8 100755 --- a/util/ec_openocd.py +++ b/util/ec_openocd.py @@ -1,8 +1,8 @@ #!/usr/bin/env python3 - # Copyright 2022 The ChromiumOS Authors # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. + """ Flashes and debugs the EC through openocd """ @@ -123,7 +123,6 @@ def debug(interface, board, port, executable, attach): stderr=subprocess.STDOUT, preexec_fn=os.setsid, ) as openocd: - # Wait for OpenOCD to start, it'll open a port for GDB connections sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) connected = False @@ -237,10 +236,10 @@ def main(): ) flash_parser.set_defaults(command="flash") flash_parser.add_argument( - "--verify", - "-v", - default=True, - help="Verify flash after writing image, defaults to true", + "--no-verify", + "-n", + action="store_true", + help="Do not verify flash after writing image", ) debug_parser = sub_parsers.add_parser( @@ -279,7 +278,7 @@ def main(): image_file = ( get_flash_file(args.board) if target_file is None else target_file ) - flash(args.interface, args.board, image_file, args.verify) + flash(args.interface, args.board, image_file, not args.no_verify) elif args.command == "debug": executable_file = ( get_executable_file(args.board) |