Skip to content

Commit

Permalink
Rollup merge of #108585 - djkoloski:parallel_fuchsia_test_runner, r=t…
Browse files Browse the repository at this point in the history
…mandry

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.
  • Loading branch information
matthiaskrgr authored Mar 2, 2023
2 parents 91dafeb + c9f1a54 commit 478d530
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
39 changes: 26 additions & 13 deletions src/ci/docker/scripts/fuchsia-test-runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import argparse
from dataclasses import dataclass
import fcntl
import glob
import hashlib
import json
Expand Down Expand Up @@ -146,6 +147,9 @@ def host_arch_triple(self):
def zxdb_script_path(self):
return os.path.join(self.tmp_dir(), "zxdb_script")

def pm_lockfile_path(self):
return os.path.join(self.tmp_dir(), "pm.lock")

def log_info(self, msg):
print(msg)

Expand Down Expand Up @@ -460,6 +464,9 @@ def start(self):
stderr=self.subprocess_output(),
)

# Create lockfiles
open(self.pm_lockfile_path(), 'a').close()

# Write to file
self.write_to_file()

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

# Publish package to repo
subprocess.check_call(
[
self.tool_path("pm"),
"publish",
"-a",
"-repo",
self.repo_dir(),
"-f",
far_path,
],
stdout=log_file,
stderr=log_file,
)
with open(self.pm_lockfile_path(), 'w') as pm_lockfile:
fcntl.lockf(pm_lockfile.fileno(), fcntl.LOCK_EX)
subprocess.check_call(
[
self.tool_path("pm"),
"publish",
"-a",
"-repo",
self.repo_dir(),
"-f",
far_path,
],
stdout=log_file,
stderr=log_file,
)
# This lock should be released automatically when the pm
# lockfile is closed, but we'll be polite and unlock it now
# since the spec leaves some wiggle room.
fcntl.lockf(pm_lockfile.fileno(), fcntl.LOCK_UN)

log("Running ffx test...")

Expand Down
7 changes: 2 additions & 5 deletions src/doc/rustc/src/platform-support/fuchsia.md
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ run the full `tests/ui` test suite:
--stage=2 \
test tests/ui \
--target x86_64-unknown-fuchsia \
--run=always --jobs 1 \
--run=always \
--test-args --target-rustcflags \
--test-args -Lnative=${SDK_PATH}/arch/{x64|arm64}/sysroot/lib \
--test-args --target-rustcflags \
Expand All @@ -728,9 +728,6 @@ run the full `tests/ui` test suite:
)
```

*Note: The test suite cannot be run in parallel at the moment, so `x.py`
must be run with `--jobs 1` to ensure only one test runs at a time.*

By default, `x.py` compiles test binaries with `panic=unwind`. If you built your
Rust toolchain with `-Cpanic=abort`, you need to tell `x.py` to compile test
binaries with `panic=abort` as well:
Expand Down Expand Up @@ -907,7 +904,7 @@ through our `x.py` invocation. The full invocation is:
--stage=2 \
test tests/${TEST} \
--target x86_64-unknown-fuchsia \
--run=always --jobs 1 \
--run=always \
--test-args --target-rustcflags \
--test-args -Lnative=${SDK_PATH}/arch/{x64|arm64}/sysroot/lib \
--test-args --target-rustcflags \
Expand Down

0 comments on commit 478d530

Please sign in to comment.