about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Koloski <dkoloski@google.com>2023-06-15 12:17:40 -0400
committerDavid Koloski <dkoloski@google.com>2023-06-15 12:17:40 -0400
commit71db99935a7dd98dfd9253dac55e58f098f56996 (patch)
tree39effe0fa7567b72c638fc221f8dfa5bde2256b7
parent4bd4e2ea824f4f458cae8917047ebb6b88853fe6 (diff)
downloadrust-71db99935a7dd98dfd9253dac55e58f098f56996.tar.gz
rust-71db99935a7dd98dfd9253dac55e58f098f56996.zip
Add support for test tmpdir to fuchsia test runner
Also format the script to keep the code nice.
-rwxr-xr-xsrc/ci/docker/scripts/fuchsia-test-runner.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/ci/docker/scripts/fuchsia-test-runner.py b/src/ci/docker/scripts/fuchsia-test-runner.py
index ecef56f56f1..78a8a6662ea 100755
--- a/src/ci/docker/scripts/fuchsia-test-runner.py
+++ b/src/ci/docker/scripts/fuchsia-test-runner.py
@@ -171,7 +171,6 @@ class TestEnvironment:
     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())
@@ -424,7 +423,7 @@ class TestEnvironment:
         )
 
         # Create lockfiles
-        open(self.pm_lockfile_path(), 'a').close()
+        open(self.pm_lockfile_path(), "a").close()
 
         # Write to file
         self.write_to_file()
@@ -458,6 +457,7 @@ class TestEnvironment:
         ],
         use: [
             {{ storage: "data", path: "/data" }},
+            {{ storage: "tmp", path: "/tmp" }},
             {{ protocol: [ "fuchsia.process.Launcher" ] }},
             {{ protocol: [ "fuchsia.posix.socket.Provider" ] }}
         ],
@@ -571,6 +571,9 @@ class TestEnvironment:
                 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)
                 )
@@ -642,7 +645,7 @@ class TestEnvironment:
             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(
                     [
@@ -1045,9 +1048,7 @@ def main():
     )
     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()