From b4b96ca8a303a852188d2d5d992b52ef9fcc9022 Mon Sep 17 00:00:00 2001 From: Raphael Herouart Date: Fri, 12 Jan 2024 12:07:10 +0000 Subject: scripts: Skip Non-Host Tests on device build Only trusty Host tests can run on device build Bug: 314128085 Change-Id: I0a27d25590ba1163226aa07f2876a471c30fba07 --- scripts/build.py | 5 +++-- scripts/run_tests.py | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/build.py b/scripts/build.py index bf7a6c4..bb2b63f 100755 --- a/scripts/build.py +++ b/scripts/build.py @@ -509,7 +509,7 @@ def create_test_map(args, build_config, projects): 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): +def main(default_config=None, emulator=True): top = os.path.abspath(os.path.join(script_dir, "../../../../..")) os.chdir(top) @@ -610,7 +610,8 @@ def main(default_config=None): run_disabled_tests=args.run_disabled_tests, test_filters=test_filters, verbose=args.verbose, - debug_on_error=args.debug_on_error) + debug_on_error=args.debug_on_error, + emulator=emulator) test_result.print_results() if test_result.failed_projects: diff --git a/scripts/run_tests.py b/scripts/run_tests.py index 1a90ad0..332949a 100755 --- a/scripts/run_tests.py +++ b/scripts/run_tests.py @@ -257,7 +257,8 @@ def run_tests( run_disabled_tests: bool = False, test_filters: Optional[list[re.Pattern]] = None, verbose: bool=False, - debug_on_error: bool= False + debug_on_error: bool= False, + emulator:bool=True ) -> TestResults: """Run tests for a project. @@ -318,6 +319,9 @@ def run_tests( test_start_time = time.time() ignore_tests = False + if not emulator and not isinstance(test, TrustyHostTest): + return 0 + match test: case TrustyHostTest(): # append nice and expand path to command @@ -426,6 +430,7 @@ def test_projects( test_filters: Optional[list[re.Pattern]] = None, verbose: bool=False, debug_on_error: bool= False, + emulator: bool=True ) -> MultiProjectTestResults: """Run tests for multiple project. @@ -457,6 +462,7 @@ def test_projects( test_filters=test_filters, verbose=verbose, debug_on_error=debug_on_error, + emulator=emulator )) return MultiProjectTestResults(results) -- cgit v1.2.3