diff options
author | Raphael Herouart <rherouart@google.com> | 2024-02-16 04:33:42 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2024-02-16 04:33:42 +0000 |
commit | 67d224983212a7cca8abda0419e8b05afc3953bf (patch) | |
tree | f265dfd6483a65ae6578154c1b078c9fcdc7162e | |
parent | d534122b91c59ebe11f348d2be2744bf471e7f44 (diff) | |
parent | 66acb9b9c6f787207ed8584a15b3c8139d51754d (diff) | |
download | aosp-67d224983212a7cca8abda0419e8b05afc3953bf.tar.gz |
scripts: [Bench] Compile Time Config am: 66acb9b9c6
Original change: https://android-review.googlesource.com/c/trusty/vendor/google/aosp/+/2884906
Change-Id: I636077430e7fe2e2f082cfe0498b83ad0450b786
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rwxr-xr-x | scripts/build.py | 21 | ||||
-rwxr-xr-x | scripts/trusty_build_config.py | 5 |
2 files changed, 24 insertions, 2 deletions
diff --git a/scripts/build.py b/scripts/build.py index 25c0c10..8c6736d 100755 --- a/scripts/build.py +++ b/scripts/build.py @@ -24,6 +24,7 @@ Invoke trusty build system and run tests. import argparse import getpass +import json import multiprocessing import os import pathlib @@ -473,6 +474,25 @@ 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"] = [] + project = build_config.get_project(project_name) + if project and project.tests: + tests = filter(lambda t: (t.name.startswith("android-port-test:")), project.tests) + for test in tests: + test_obj = { "port_name": test.name.replace("android-port-test:android-test:",""), + "needs": []} + if hasattr(test, 'need') and hasattr(test.need, 'flags'): + test_obj["needs"] = list(test.need.flags) + + test_map["ports"].append(test_obj) + + project_buildroot = os.path.join(args.build_root, "build-" + project_name) + zip_path = os.path.join(project_buildroot, "trusty_test_package.zip") + with ZipFile(zip_path, 'a', compression=ZIP_DEFLATED) as zipf: + zipf.writestr(project_name + "-test-map.json", json.dumps(test_map, indent=4)) def main(default_config=None): top = os.path.abspath(os.path.join(script_dir, "../../../../..")) @@ -566,6 +586,7 @@ def main(default_config=None): else: build(args) archive(build_config, args) + create_test_map(args, build_config, projects) # Run tests if not args.skip_tests: diff --git a/scripts/trusty_build_config.py b/scripts/trusty_build_config.py index a0efa8b..55205ed 100755 --- a/scripts/trusty_build_config.py +++ b/scripts/trusty_build_config.py @@ -105,7 +105,7 @@ class TrustyHostTest(TrustyTest): class TrustyAndroidTest(TrustyTest): """Stores a test name and command to run inside Android""" - def __init__(self, name, command, enabled=True, nameprefix="", runargs=(), + def __init__(self, name, command, need = None, enabled=True, nameprefix="", runargs=(), timeout=None): nameprefix = nameprefix + "android-test:" cmd = ["run", "--headless", "--shell-command", command] @@ -115,6 +115,7 @@ class TrustyAndroidTest(TrustyTest): cmd += list(runargs) super().__init__(nameprefix + name, cmd, enabled) self.shell_command = command + self.need = need class TrustyPortTest(TrustyTest): @@ -133,7 +134,7 @@ 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.enabled, + return TrustyAndroidTest(self.name, cmd, self.need, self.enabled, timeout=self.timeout, **kwargs) def into_bootporttest(self) -> TrustyTest: |