diff options
author | Per Larsen <perlarsen@google.com> | 2024-02-16 05:12:07 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2024-02-16 05:12:07 +0000 |
commit | da589aa2ca75feb9f5a04d72388685f30c441c86 (patch) | |
tree | bb54de2abb9ca9acb4b395f58bceb34350bb9c77 | |
parent | d04c5db440c7a3047d76300fc30eee47e4e99bba (diff) | |
parent | 1a00e1e8acea4e501fad615f5d07a1b7aac59f37 (diff) | |
download | aosp-da589aa2ca75feb9f5a04d72388685f30c441c86.tar.gz |
scripts: address lints am: 1a00e1e8ac
Original change: https://android-review.googlesource.com/c/trusty/vendor/google/aosp/+/2942336
Change-Id: I39f2b1ad1e6285a6940abd6fbc5af4012b5112f5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rwxr-xr-x | scripts/build.py | 19 | ||||
-rwxr-xr-x | scripts/log_processor.py | 4 | ||||
-rwxr-xr-x | scripts/trusty_build_config.py | 14 |
3 files changed, 18 insertions, 19 deletions
diff --git a/scripts/build.py b/scripts/build.py index 0c1063a..1f3bef4 100755 --- a/scripts/build.py +++ b/scripts/build.py @@ -415,6 +415,7 @@ def create_uuid_map(args, project): zip_file(zip_archive, uuidmapfile) os.remove(uuidmapfile) + def create_scripts_archive(args, project): """Create an archive for the scripts""" coverage_script = os.path.join(script_dir, "genReport.py") @@ -427,6 +428,7 @@ def create_scripts_archive(args, project): with ZipFile(scripts_zip, 'a', compression=ZIP_DEFLATED) as zip_archive: zip_file(zip_archive, coverage_script) + def archive(build_config, args): if args.archive is None: return @@ -494,10 +496,11 @@ def get_build_deps(project_name, project, project_names, already_built): already_built) project_names.append(project_name) + def create_test_map(args, build_config, projects): for project_name in projects: test_map = {} - test_map["ports"] = [] # TODO: should probably be called port_tests + test_map["ports"] = [] port_names = set() duplicates = set() project = build_config.get_project(project_name) @@ -509,7 +512,7 @@ def create_test_map(args, build_config, projects): for test in project.tests: if not test.name.startswith(project_type_prefix): continue - port_name = test.name.replace(project_type_prefix, "") + port_name = re.sub(project_type_prefix, "", test.name) if port_name in port_names: duplicates.add(port_name) continue @@ -523,18 +526,11 @@ def create_test_map(args, build_config, projects): if hasattr(test, 'port_type'): test_obj["type"] = str(test.port_type) - # BUG: this branch is never taken because composite tests don't - # start with `project_type_prefix` so the loop continues - # without ever processing composite tests. This means that - # tests in the sequence are not present in the output JSON. if isinstance(test, trusty_build_config.TrustyCompositeTest): test_obj["sequence"] = [] for subtest in test.sequence: - # TODO: verify that project_type_prefix is defined correctly - # TODO: shouldn't this be called test_type_prefix? - # (android, boot, host are the test types...) - subtest_name = subtest.name.replace(project_type_prefix, "") + subtest_name = re.sub(project_type_prefix, "", subtest.name) test_obj["sequence"].append(subtest_name) if hasattr(subtest, 'need') and hasattr(subtest.need, 'flags'): @@ -554,7 +550,7 @@ def create_test_map(args, build_config, projects): for test in project.tests: if not test.name.startswith("android-test:"): continue - command_name = test.name.replace("android-test:", "") + command_name = re.sub("android-test:", "", test.name) command_obj = { "command_name": command_name, "needs": [] } if hasattr(test, 'need') and hasattr(test.need, 'flags'): @@ -572,6 +568,7 @@ def create_test_map(args, build_config, projects): zipf.writestr(project_name + "-test-map.json", json.dumps(test_map, indent=4)) + def main(default_config=None, emulator=True): top = os.path.abspath(os.path.join(script_dir, "../../../../..")) os.chdir(top) diff --git a/scripts/log_processor.py b/scripts/log_processor.py index 970260d..b30d930 100755 --- a/scripts/log_processor.py +++ b/scripts/log_processor.py @@ -77,8 +77,8 @@ class ModuleQueue: self.active = {} def len(self): - assert (len(self.queued) == len(self.active), - "lengths of queued and active should be always equal") + diagnostic = "lengths of queued and active should be always equal" + assert len(self.queued) == len(self.active), diagnostic return len(self.queued) def insert(self, key, val: tuple[str, bool]): diff --git a/scripts/trusty_build_config.py b/scripts/trusty_build_config.py index a1a6ccd..142bea8 100755 --- a/scripts/trusty_build_config.py +++ b/scripts/trusty_build_config.py @@ -30,8 +30,8 @@ from typing import List, Dict, Optional script_dir = os.path.dirname(os.path.abspath(__file__)) class PortType(StrEnum): - TEST = auto(), - BENCHMARK = auto(), + TEST = auto() + BENCHMARK = auto() class TrustyBuildConfigProject(object): @@ -135,7 +135,8 @@ class TrustyAndroidTest(TrustyTest): class TrustyPortTest(TrustyTest): """Stores a trusty port name for a test to run.""" - def __init__(self, port, port_type=PortType.TEST, enabled=True, timeout=None): + def __init__(self, port, port_type=PortType.TEST, enabled=True, + timeout=None): super().__init__(port, None, enabled, port_type) self.port = port self.need = TrustyPortTestFlags() @@ -148,13 +149,14 @@ class TrustyPortTest(TrustyTest): def into_androidporttest(self, cmdargs, **kwargs): cmdargs = list(cmdargs) cmd = " ".join(["/vendor/bin/trusty-ut-ctrl", self.port] + cmdargs) - return TrustyAndroidTest(self.name, cmd, self.need, self.port_type, self.enabled, - timeout=self.timeout, **kwargs) + return TrustyAndroidTest(self.name, cmd, self.need, self.port_type, + self.enabled, timeout=self.timeout, **kwargs) def into_bootporttest(self) -> TrustyTest: cmd = ["run", "--headless", "--boot-test", self.port] cmd += ['--timeout', str(self.timeout)] if self.timeout else [] - return TrustyTest("boot-test:" + self.port, cmd, self.enabled, self.port_type) + return TrustyTest("boot-test:" + self.port, cmd, self.enabled, + self.port_type) class TrustyCommand: |