Skip to content

Commit

Permalink
Rollup merge of #112664 - djkoloski:fuchsia_test_runner_tmpdir, r=tma…
Browse files Browse the repository at this point in the history
…ndry

Add support for test tmpdir to fuchsia test runner

Also format the script to keep the code nice.

This fixes the `tests/ui/std/switch-stdout.rs` test on Fuchsia.

r? `@tmandry`
  • Loading branch information
GuillaumeGomez authored Jun 15, 2023
2 parents b36ddee + 71db999 commit 56a5b7e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/ci/docker/scripts/fuchsia-test-runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ def ffx_isolate_dir(self):
def home_dir(self):
return os.path.join(self.tmp_dir(), "user-home")


def start_ffx_isolation(self):
# Most of this is translated directly from ffx's isolate library
os.mkdir(self.ffx_isolate_dir())
Expand Down Expand Up @@ -424,7 +423,7 @@ def start(self):
)

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

# Write to file
self.write_to_file()
Expand Down Expand Up @@ -458,6 +457,7 @@ def start(self):
],
use: [
{{ storage: "data", path: "/data" }},
{{ storage: "tmp", path: "/tmp" }},
{{ protocol: [ "fuchsia.process.Launcher" ] }},
{{ protocol: [ "fuchsia.posix.socket.Provider" ] }}
],
Expand Down Expand Up @@ -571,6 +571,9 @@ def log(msg):
if os.getenv("RUST_BACKTRACE") == None:
env_vars += f'\n "RUST_BACKTRACE=0",'

# Use /tmp as the test temporary directory
env_vars += f'\n "RUST_TEST_TMPDIR=/tmp",'

cml.write(
self.CML_TEMPLATE.format(env_vars=env_vars, exe_name=exe_name)
)
Expand Down Expand Up @@ -642,7 +645,7 @@ def log(msg):
log("Publishing package to repo...")

# Publish package to repo
with open(self.pm_lockfile_path(), 'w') as pm_lockfile:
with open(self.pm_lockfile_path(), "w") as pm_lockfile:
fcntl.lockf(pm_lockfile.fileno(), fcntl.LOCK_EX)
subprocess.check_call(
[
Expand Down Expand Up @@ -1045,9 +1048,7 @@ def print_help(args):
)
debug_parser.set_defaults(func=debug)

syslog_parser = subparsers.add_parser(
"syslog", help="prints the device syslog"
)
syslog_parser = subparsers.add_parser("syslog", help="prints the device syslog")
syslog_parser.set_defaults(func=syslog)

args = parser.parse_args()
Expand Down

0 comments on commit 56a5b7e

Please sign in to comment.