From 439f06092e6d1cd9b435dcf22984f5d3eca49daa Mon Sep 17 00:00:00 2001 From: Eric Xiao Date: Sat, 13 Jun 2026 14:14:45 -0700 Subject: [PATCH 1/2] Do not symlink to bazel temp dir --- src/software/field_tests/field_test_fixture.py | 17 +++++------------ .../simulated_tests/simulated_test_fixture.py | 17 +++++------------ 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/src/software/field_tests/field_test_fixture.py b/src/software/field_tests/field_test_fixture.py index c23a4fdbf8..e230ad8ede 100644 --- a/src/software/field_tests/field_test_fixture.py +++ b/src/software/field_tests/field_test_fixture.py @@ -206,23 +206,16 @@ def get_runtime_dir(): """Gets the base runtime directory for the test execution. TODO: Refactor #3744 - If running under Bazel, it uses TEST_TMPDIR to keep tests isolated. To prevent UNIX - socket path length limits from being exceeded by Bazel's long paths, it creates a short - symlink in /tmp to the TEST_TMPDIR. + Uses a persistent directory so that UNIX socket paths stay short + and replay logs survive after the test ends. :return: The path to the runtime directory. """ - test_tmpdir = os.environ.get("TEST_TMPDIR") - if not test_tmpdir: - return "/tmp/tbots" import uuid - symlink_path = os.path.join("/tmp", f"tbt_{uuid.uuid4().hex[:8]}") - try: - os.symlink(test_tmpdir, symlink_path) - except OSError: - pass - return symlink_path + runtime_dir = os.path.join("/tmp", f"tbots_{uuid.uuid4().hex[:8]}") + os.makedirs(runtime_dir, exist_ok=True) + return runtime_dir RUNTIME_DIR = get_runtime_dir() diff --git a/src/software/simulated_tests/simulated_test_fixture.py b/src/software/simulated_tests/simulated_test_fixture.py index 1edf1c7ebc..84ab52e7af 100644 --- a/src/software/simulated_tests/simulated_test_fixture.py +++ b/src/software/simulated_tests/simulated_test_fixture.py @@ -423,23 +423,16 @@ def get_runtime_dir(): """Gets the base runtime directory for the test execution. TODO: Refactor #3744 - If running under Bazel, it uses TEST_TMPDIR to keep tests isolated. To prevent UNIX - socket path length limits from being exceeded by Bazel's long paths, it creates a short - symlink in /tmp to the TEST_TMPDIR. + Uses a persistent directory so that UNIX socket paths stay short + and replay logs survive after the test ends. :return: The path to the runtime directory. """ - test_tmpdir = os.environ.get("TEST_TMPDIR") - if not test_tmpdir: - return "/tmp/tbots" import uuid - symlink_path = os.path.join("/tmp", f"tbt_{uuid.uuid4().hex[:8]}") - try: - os.symlink(test_tmpdir, symlink_path) - except OSError: - pass - return symlink_path + runtime_dir = os.path.join("/tmp", f"tbots_{uuid.uuid4().hex[:8]}") + os.makedirs(runtime_dir, exist_ok=True) + return runtime_dir RUNTIME_DIR = get_runtime_dir() From 8b45bbc8da49a6b2b3894d1c3593bc86e8524994 Mon Sep 17 00:00:00 2001 From: Eric Xiao Date: Sat, 13 Jun 2026 14:22:06 -0700 Subject: [PATCH 2/2] Rewrite comments --- src/software/field_tests/field_test_fixture.py | 5 +++-- src/software/simulated_tests/simulated_test_fixture.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/software/field_tests/field_test_fixture.py b/src/software/field_tests/field_test_fixture.py index e230ad8ede..fe3d9eb992 100644 --- a/src/software/field_tests/field_test_fixture.py +++ b/src/software/field_tests/field_test_fixture.py @@ -204,10 +204,11 @@ def excepthook(args): def get_runtime_dir(): """Gets the base runtime directory for the test execution. + TODO: Refactor #3744 - Uses a persistent directory so that UNIX socket paths stay short - and replay logs survive after the test ends. + Creates a new persistent directory for each test so that tests + running in parallel do not interfere with each other. :return: The path to the runtime directory. """ diff --git a/src/software/simulated_tests/simulated_test_fixture.py b/src/software/simulated_tests/simulated_test_fixture.py index 84ab52e7af..6b4dd49dab 100644 --- a/src/software/simulated_tests/simulated_test_fixture.py +++ b/src/software/simulated_tests/simulated_test_fixture.py @@ -421,10 +421,11 @@ def run_test( def get_runtime_dir(): """Gets the base runtime directory for the test execution. + TODO: Refactor #3744 - Uses a persistent directory so that UNIX socket paths stay short - and replay logs survive after the test ends. + Creates a new persistent directory for each test so that tests + running in parallel do not interfere with each other. :return: The path to the runtime directory. """