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 <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
This commit is contained in:
Dennis Kempin 2022-02-07 16:16:29 -08:00 committed by Commit Bot
parent e225a10959
commit 9503e86ff4
2 changed files with 7 additions and 2 deletions

View file

@ -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

View file

@ -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(