mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-25 05:03:05 +00:00
test_runner: Parallelize building of common/ crates
Each of these is a separate workspace and can be built in parallel. BUG=b:195126527 TEST=./tools/run_tests Change-Id: I9ad61b5d5d83903fda36c948ba470bba8f608d46 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3248128 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
85d5655160
commit
df7d744fec
1 changed files with 22 additions and 9 deletions
|
@ -203,6 +203,17 @@ def cargo_build_executables(
|
||||||
yield from cargo("test", cwd, ["--no-run", *flags], env)
|
yield from cargo("test", cwd, ["--no-run", *flags], env)
|
||||||
|
|
||||||
|
|
||||||
|
def build_common_crate(build_env: dict[str, str], crate_name: str):
|
||||||
|
print(f"Building tests for: common/{crate_name}")
|
||||||
|
return list(
|
||||||
|
cargo_build_executables(
|
||||||
|
[],
|
||||||
|
env=build_env,
|
||||||
|
cwd=COMMON_ROOT / crate_name,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def build_all_binaries(target: TestTarget, target_arch: Arch):
|
def build_all_binaries(target: TestTarget, target_arch: Arch):
|
||||||
"""Discover all crates and build them."""
|
"""Discover all crates and build them."""
|
||||||
build_env = os.environ.copy()
|
build_env = os.environ.copy()
|
||||||
|
@ -219,15 +230,17 @@ def build_all_binaries(target: TestTarget, target_arch: Arch):
|
||||||
main_crates, env=build_env, features=set(["all-linux"])
|
main_crates, env=build_env, features=set(["all-linux"])
|
||||||
)
|
)
|
||||||
|
|
||||||
for crate in list_common_crates():
|
common_crates = [
|
||||||
if not should_build_crate(crate, target_arch):
|
crate
|
||||||
continue
|
for crate in list_common_crates()
|
||||||
print(f"Building tests for: common/{crate}")
|
if should_build_crate(crate, target_arch)
|
||||||
yield from cargo_build_executables(
|
]
|
||||||
[],
|
|
||||||
env=build_env,
|
with Pool(PARALLELISM) as pool:
|
||||||
cwd=COMMON_ROOT / crate,
|
for executables in pool.imap(
|
||||||
)
|
functools.partial(build_common_crate, build_env), common_crates
|
||||||
|
):
|
||||||
|
yield from executables
|
||||||
|
|
||||||
|
|
||||||
def execute_test(target: TestTarget, executable: Executable):
|
def execute_test(target: TestTarget, executable: Executable):
|
||||||
|
|
Loading…
Reference in a new issue