Skip to content

Commit 7676778

Browse files
authored
Log to gtest-parallel-logs/ subdir. (#46)
This changes the default logdir from /tmp/gtest-parallel to /tmp/gtest-parallel-logs. The primary motivation is that that we do this by appending gtest-parallel-logs (to /tmp by default), so that if a user provides a directory that is already in use, we wouldn't clear that directory out completely (--output_dir=Docs/ was previously dangerous, as we'd nuke Docs/*). Now instead we'd only clear out a subdirectory that we create and own ourselves. Fixes #44.
1 parent c821231 commit 7676778

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

gtest_parallel.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -603,8 +603,11 @@ def main():
603603
usage = 'usage: %prog [options] binary [binary ...] -- [additional args]')
604604

605605
parser.add_option('-d', '--output_dir', type='string',
606-
default=os.path.join(tempfile.gettempdir(), "gtest-parallel"),
607-
help='output directory for test logs')
606+
default=tempfile.gettempdir(),
607+
help='Output directory for test logs. Logs will be '
608+
'available under gtest-parallel-logs/, so '
609+
'--output_dir=/tmp will results in all logs being '
610+
'available under /tmp/gtest-parallel-logs/.')
608611
parser.add_option('-r', '--repeat', type='int', default=1,
609612
help='Number of times to execute all the tests.')
610613
parser.add_option('--retry_failed', type='int', default=0,
@@ -640,6 +643,11 @@ def main():
640643
'case in parallel.')
641644

642645
(options, binaries) = parser.parse_args()
646+
# Append gtest-parallel-logs to log output, this is to avoid deleting user
647+
# data if an user passes a directory where files are already present. If a
648+
# user specifies --output_dir=Docs/, we'll create Docs/gtest-parallel-logs
649+
# and clean that directory out on startup, instead of nuking Docs/.
650+
options.output_dir = os.path.join(options.output_dir, 'gtest-parallel-logs')
643651

644652
if binaries == []:
645653
parser.print_usage()

0 commit comments

Comments
 (0)