diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2022-03-30 19:29:54 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-03-30 19:29:54 +0000 |
commit | cc3514332c2d889daae14c10a87563ba6930f8e7 (patch) | |
tree | c4f150d8a107c258d34157f76c30ff7df3f6a170 | |
parent | f8c69c1eb75ac4719e0309c6037e33fbd2a7b443 (diff) | |
parent | 3d010d726d47ab2c413a799a9afd81be48cdf11e (diff) | |
download | extras-cc3514332c2d889daae14c10a87563ba6930f8e7.tar.gz |
Merge "simpleperf: sign darwin executables when testing." am: 3d010d726d
Original change: https://android-review.googlesource.com/c/platform/system/extras/+/2045743
Change-Id: I59abdc1ea2aee4ef8176583f0b1e58fec03ccdb4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rwxr-xr-x | simpleperf/scripts/test/do_test.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/simpleperf/scripts/test/do_test.py b/simpleperf/scripts/test/do_test.py index 2c67bb78..b95a1fef 100755 --- a/simpleperf/scripts/test/do_test.py +++ b/simpleperf/scripts/test/do_test.py @@ -32,6 +32,7 @@ import multiprocessing as mp import os from pathlib import Path import re +import subprocess import sys import time from tqdm import tqdm @@ -39,7 +40,7 @@ import types from typing import List, Optional import unittest -from simpleperf_utils import BaseArgumentParser, extant_dir, log_exit, remove +from simpleperf_utils import BaseArgumentParser, extant_dir, log_exit, remove, is_darwin from . api_profiler_test import * from . annotate_test import * @@ -517,6 +518,15 @@ def run_tests_in_child_process(tests: List[str], args: argparse.Namespace) -> bo return False +def sign_executables_on_darwin(): + """ Sign executables on M1 Mac, otherwise they can't run. """ + if not is_darwin(): + return + bin_dir = Path(__file__).resolve().parents[1] / 'bin' / 'darwin' / 'x86_64' + for path in bin_dir.iterdir(): + subprocess.run(f'codesign --force -s - {path}', shell=True, check=True) + + def main() -> bool: args = get_args() tests = get_host_tests() if args.only_host_test else get_all_tests() @@ -532,4 +542,5 @@ def main() -> bool: # Switch to the test dir. os.chdir(test_dir) build_testdata(Path('testdata')) + sign_executables_on_darwin() return run_tests_in_child_process(tests, args) |