Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run compiler test suite in parallel on Fuchsia #108585

Merged
merged 1 commit into from
Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
djkoloski marked this conversation as resolved.
Show resolved Hide resolved

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 @@ -717,7 +717,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 @@ -729,9 +729,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 @@ -908,7 +905,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