Multiple parallel invocations of gtest-parallel can fail(!)
alexweej opened this issue · comments
We noticed in our build system when upgrading to a new version of gtest-parallel that the --output_dir
handling results in this kind of error:
Traceback (most recent call last):
File "/opt/bb/bin/gtest-parallel.py", line 18, in <module>
sys.exit(gtest_parallel.main())
File "/opt/bb/bin/gtest_parallel.py", line 745, in main
logger.move_to('passed', task_manager.passed)
File "/opt/bb/bin/gtest_parallel.py", line 294, in move_to
os.makedirs(destination_dir)
File "/opt/bb/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 17] File exists: '/tmp/gtest-parallel-logs/passed'
Regardless of this particular bug, invoking gtest-parallel now leaves stuff around in the temporary directory forever (until that dir is cleaned).
This didn't seem to be an issue in older versions of gtest-parallel.
I took a look at the source, and couldn't see a very straightforward way to disable the output dir logging - is it critical to the functionality of the latest version? If so, perhaps we should consider making --output_dir
default to None
, and in such case using a proper generated temporary directory by default which is then cleaned up on exit.
Thoughts?
Thanks
I see this is actually documented on https://github.com/google/gtest-parallel#multiple-invocations but I'd argue that given that the older version of gtest-parallel did not have this problem, a sensible default is reasonable.
I don't mind contributing this change - I will get the CLA checked with my organization.
I think that's fair, so long as we properly document that --output_dir
should be used to save log files (and remove the existing note saying that when running multiple invocations --output_dir
should be used). With this behavior in place we can use a regular tmpdir
, and multiple parallel invocations will work by default.
I think this got fixed with #57 (saving to new temporary directories that are removed after execution if -d is not set). I'll remove the multiple-invocation section. Please confirm that this works fine and reopen if that's not the case. Sorry about the delay.