]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-129980: Include test name in TSAN filename in multiprocess test runner (GH-129981)
authorSam Gross <colesbury@gmail.com>
Tue, 11 Feb 2025 17:09:43 +0000 (12:09 -0500)
committerGitHub <noreply@github.com>
Tue, 11 Feb 2025 17:09:43 +0000 (12:09 -0500)
Lib/test/libregrtest/worker.py

index 0c9f5bd6e42f11daae5f9df59bdefccf15046c79..5d75bf7ae787ed201d20da45d9a2257a45210392 100644 (file)
@@ -56,6 +56,15 @@ def create_worker_process(runtests: WorkerRunTests, output_fd: int,
     if USE_PROCESS_GROUP and test_name not in NEED_TTY:
         kwargs['start_new_session'] = True
 
+    # Include the test name in the TSAN log file name
+    if 'TSAN_OPTIONS' in env:
+        parts = env['TSAN_OPTIONS'].split(' ')
+        for i, part in enumerate(parts):
+            if part.startswith('log_path='):
+                parts[i] = f'{part}.{test_name}'
+                break
+        env['TSAN_OPTIONS'] = ' '.join(parts)
+
     # Pass json_file to the worker process
     json_file = runtests.json_file
     json_file.configure_subprocess(kwargs)