Skip to content

Commit 478d530

Browse files
authored
Rollup merge of #108585 - djkoloski:parallel_fuchsia_test_runner, r=tmandry
Run compiler test suite in parallel on Fuchsia This also adds file locking around calls to `pm publish` as these calls are not thread-safe.
2 parents 91dafeb + c9f1a54 commit 478d530

File tree

2 files changed

+28
-18
lines changed

2 files changed

+28
-18
lines changed

src/ci/docker/scripts/fuchsia-test-runner.py

+26-13
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import argparse
1111
from dataclasses import dataclass
12+
import fcntl
1213
import glob
1314
import hashlib
1415
import json
@@ -146,6 +147,9 @@ def host_arch_triple(self):
146147
def zxdb_script_path(self):
147148
return os.path.join(self.tmp_dir(), "zxdb_script")
148149

150+
def pm_lockfile_path(self):
151+
return os.path.join(self.tmp_dir(), "pm.lock")
152+
149153
def log_info(self, msg):
150154
print(msg)
151155

@@ -460,6 +464,9 @@ def start(self):
460464
stderr=self.subprocess_output(),
461465
)
462466

467+
# Create lockfiles
468+
open(self.pm_lockfile_path(), 'a').close()
469+
463470
# Write to file
464471
self.write_to_file()
465472

@@ -676,19 +683,25 @@ def log(msg):
676683
log("Publishing package to repo...")
677684

678685
# Publish package to repo
679-
subprocess.check_call(
680-
[
681-
self.tool_path("pm"),
682-
"publish",
683-
"-a",
684-
"-repo",
685-
self.repo_dir(),
686-
"-f",
687-
far_path,
688-
],
689-
stdout=log_file,
690-
stderr=log_file,
691-
)
686+
with open(self.pm_lockfile_path(), 'w') as pm_lockfile:
687+
fcntl.lockf(pm_lockfile.fileno(), fcntl.LOCK_EX)
688+
subprocess.check_call(
689+
[
690+
self.tool_path("pm"),
691+
"publish",
692+
"-a",
693+
"-repo",
694+
self.repo_dir(),
695+
"-f",
696+
far_path,
697+
],
698+
stdout=log_file,
699+
stderr=log_file,
700+
)
701+
# This lock should be released automatically when the pm
702+
# lockfile is closed, but we'll be polite and unlock it now
703+
# since the spec leaves some wiggle room.
704+
fcntl.lockf(pm_lockfile.fileno(), fcntl.LOCK_UN)
692705

693706
log("Running ffx test...")
694707

src/doc/rustc/src/platform-support/fuchsia.md

+2-5
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ run the full `tests/ui` test suite:
716716
--stage=2 \
717717
test tests/ui \
718718
--target x86_64-unknown-fuchsia \
719-
--run=always --jobs 1 \
719+
--run=always \
720720
--test-args --target-rustcflags \
721721
--test-args -Lnative=${SDK_PATH}/arch/{x64|arm64}/sysroot/lib \
722722
--test-args --target-rustcflags \
@@ -728,9 +728,6 @@ run the full `tests/ui` test suite:
728728
)
729729
```
730730

731-
*Note: The test suite cannot be run in parallel at the moment, so `x.py`
732-
must be run with `--jobs 1` to ensure only one test runs at a time.*
733-
734731
By default, `x.py` compiles test binaries with `panic=unwind`. If you built your
735732
Rust toolchain with `-Cpanic=abort`, you need to tell `x.py` to compile test
736733
binaries with `panic=abort` as well:
@@ -907,7 +904,7 @@ through our `x.py` invocation. The full invocation is:
907904
--stage=2 \
908905
test tests/${TEST} \
909906
--target x86_64-unknown-fuchsia \
910-
--run=always --jobs 1 \
907+
--run=always \
911908
--test-args --target-rustcflags \
912909
--test-args -Lnative=${SDK_PATH}/arch/{x64|arm64}/sysroot/lib \
913910
--test-args --target-rustcflags \

0 commit comments

Comments
 (0)