mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-05 18:20:34 +00:00
test_runner: Refer to crates by their names, not paths
When looking up crate options from test_options.py we used their path relative to the crosvm root (e.g. common/p9). But when looking up options for binaries, the name is parsed from cargo output and just the crate name (e.g. p9). Fix this by just using the crate name. BUG=b:195126527 TEST=./tools/run_tests Change-Id: I09a3469daa071dc66295d777449dc101a6564162 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3248127 Commit-Queue: Dennis Kempin <denniskempin@google.com> Tested-by: Dennis Kempin <denniskempin@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
parent
f28bca1ddc
commit
85d5655160
1 changed files with 10 additions and 9 deletions
|
@ -56,6 +56,7 @@ TEST_TIMEOUT_SECS = 60
|
|||
PARALLELISM = 4
|
||||
|
||||
CROSVM_ROOT = Path(__file__).parent.parent.parent.resolve()
|
||||
COMMON_ROOT = CROSVM_ROOT / "common"
|
||||
|
||||
|
||||
class ExecutableResults(object):
|
||||
|
@ -106,12 +107,12 @@ def should_run_executable(executable: Executable, target_arch: Arch):
|
|||
def list_main_crates():
|
||||
yield "crosvm"
|
||||
for path in CROSVM_ROOT.glob("*/Cargo.toml"):
|
||||
yield str(path.parent.relative_to(CROSVM_ROOT))
|
||||
yield path.parent.name
|
||||
|
||||
|
||||
def list_extra_crates():
|
||||
for path in CROSVM_ROOT.glob("common/*/Cargo.toml"):
|
||||
yield str(path.parent.relative_to(CROSVM_ROOT))
|
||||
def list_common_crates():
|
||||
for path in COMMON_ROOT.glob("*/Cargo.toml"):
|
||||
yield path.parent.name
|
||||
|
||||
|
||||
def cargo(
|
||||
|
@ -218,14 +219,14 @@ def build_all_binaries(target: TestTarget, target_arch: Arch):
|
|||
main_crates, env=build_env, features=set(["all-linux"])
|
||||
)
|
||||
|
||||
for crate_path in list_extra_crates():
|
||||
if not should_build_crate(crate_path, target_arch):
|
||||
for crate in list_common_crates():
|
||||
if not should_build_crate(crate, target_arch):
|
||||
continue
|
||||
print("Building tests for:", crate_path)
|
||||
print(f"Building tests for: common/{crate}")
|
||||
yield from cargo_build_executables(
|
||||
[],
|
||||
env=build_env,
|
||||
cwd=CROSVM_ROOT.joinpath(crate_path),
|
||||
cwd=COMMON_ROOT / crate,
|
||||
)
|
||||
|
||||
|
||||
|
@ -389,7 +390,7 @@ def main():
|
|||
|
||||
def verify_crate_options():
|
||||
"""Verify that CRATE_OPTIONS are for existing crates."""
|
||||
all_crates = list(list_main_crates()) + list(list_extra_crates())
|
||||
all_crates = list(list_main_crates()) + list(list_common_crates())
|
||||
for crate, _ in CRATE_OPTIONS.items():
|
||||
if crate not in all_crates:
|
||||
raise Exception("No such crate: %s" % crate)
|
||||
|
|
Loading…
Reference in a new issue