Skip to content

Commit

Permalink
NEBDUTY-500: use unique temp directories for unit tests data (#310)
Browse files Browse the repository at this point in the history
when running tests using ya make we have TMPDIR set to unique name for each
chunk of unit tests.

In stable branch we still using cmake which doesn't pass unique TMPDIR and
therefore when running in parallel execution of different tests can overwrite
each other data and fail.

This commit fixes this by passing unique TMPDIR before calling cpp unit test.
  • Loading branch information
budevg committed Feb 1, 2024
1 parent 67d95ff commit 557c562
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions build/scripts/split_unittest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import argparse
import os
import tempfile
import shlex
import subprocess
Expand Down Expand Up @@ -70,10 +71,12 @@ def main():
else:
cmd = args.command

rc = subprocess.call(cmd)
if rc:
print("Some tests failed. To reproduce run: {}".format(shlex.join(cmd)))
return rc
with tempfile.TemporaryDirectory() as tmpdir:
os.environ["TMPDIR"] = tmpdir
rc = subprocess.call(cmd, cwd=tmpdir)
if rc:
print("Some tests failed. To reproduce run: {}".format(shlex.join(cmd)))
return rc


if __name__ == "__main__":
Expand Down

0 comments on commit 557c562

Please sign in to comment.