From 9503e86ff40b4c675c81821a8cf7c11650957d3e Mon Sep 17 00:00:00 2001 From: Dennis Kempin Date: Mon, 7 Feb 2022 16:16:29 -0800 Subject: [PATCH] Enable bit_field_derive tests proc-macro tests run on the host, adding logic into the test runner to accomodate for that. BUG=b:218374759 TEST=./tools/presubmit Change-Id: I83c853b9e28dae725d299509f7e3a07f56bd6ad8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3445531 Reviewed-by: Daniel Verkamp Tested-by: kokoro Commit-Queue: Dennis Kempin --- tools/impl/test_config.py | 1 - tools/impl/test_runner.py | 8 +++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/impl/test_config.py b/tools/impl/test_config.py index f1269def68..6166b45be1 100755 --- a/tools/impl/test_config.py +++ b/tools/impl/test_config.py @@ -32,7 +32,6 @@ class TestOption(enum.Enum): # Please add a bug number when restricting a tests. CRATE_OPTIONS: dict[str, list[TestOption]] = { "aarch64": [TestOption.BUILD_ARM_ONLY, TestOption.DO_NOT_BUILD_ARMHF], #b/210015864 - "bit_field_derive": [TestOption.RUN_X86_ONLY], # b/206843832 "crosvm_plugin": [TestOption.BUILD_X86_ONLY], "devices": [TestOption.SINGLE_THREADED, TestOption.DO_NOT_BUILD_ARMHF], "disk": [TestOption.RUN_X86_ONLY], # b/202294155 diff --git a/tools/impl/test_runner.py b/tools/impl/test_runner.py index 150c04cd48..2e4ad13643 100755 --- a/tools/impl/test_runner.py +++ b/tools/impl/test_runner.py @@ -74,6 +74,7 @@ class Executable(NamedTuple): binary_path: Path crate_name: str cargo_target: str + kind: str is_test: bool is_fresh: bool @@ -168,6 +169,7 @@ def cargo( Path(json_line.get("executable")), crate_name=json_line.get("package_id", "").split(" ")[0], cargo_target=json_line.get("target").get("name"), + kind=json_line.get("target").get("kind")[0], is_test=json_line.get("profile", {}).get("test", False), is_fresh=json_line.get("fresh", False), ) @@ -245,8 +247,12 @@ def execute_test(target: TestTarget, executable: Executable): if TestOption.SINGLE_THREADED in options: args += ["--test-threads=1"] + # proc-macros and their tests are executed on the host. + if executable.kind == "proc-macro": + target = TestTarget("host") + if VERBOSE: - print(f"Running test {executable.name}...") + print(f"Running test {executable.name} on {target}...") try: # Pipe stdout/err to be printed in the main process if needed. test_process = test_target.exec_file_on_target(