Don't display colors on gtest-parallel logs on swarming.

It makes the logs hard to read, and swarming doesn't output colors anyway.

Also:
- Fix a bug where we tried to access output_dir when combining the logs even if the flag was not set.
- Update a comment explaining why we just 'eat' the --isolated-script-test-chartjson-output flag.

NOTRY=True
BUG=webrtc:7524

Review-Url: https://codereview.webrtc.org/2843263005
Cr-Commit-Position: refs/heads/master@{#17973}
This commit is contained in:
ehmaldonado
2017-05-02 05:52:57 -07:00
committed by Commit bot
parent 3c1e558449
commit 950614eb0c
3 changed files with 22 additions and 9 deletions

View File

@ -61,10 +61,15 @@ def main():
parser = argparse.ArgumentParser()
parser.add_argument('--isolated-script-test-output', type=str, default=None)
# TODO(ehmaldonado): Implement this flag instead of just "eating" it.
# We don't need to implement this flag, and possibly can't, since it's
# intended for results of Telemetry tests. See
# https://chromium.googlesource.com/external/github.com/catapult-project/catapult/+/HEAD/dashboard/docs/data-format.md
parser.add_argument('--isolated-script-test-chartjson-output', type=str,
default=None)
# TODO(ehmaldonado): Figure out a way to avoid duplicating the flags in
# gtest-parallel.
parser.add_argument('--gtest_color', type=str, default='auto')
parser.add_argument('--output_dir', type=str, default=None)
parser.add_argument('--timeout', type=int, default=None)
@ -89,6 +94,8 @@ def main():
gtest_total_shards,
'--shard_index',
gtest_shard_index,
'--gtest_color',
options.gtest_color,
]
# --isolated-script-test-output is used to upload results to the flakiness
@ -122,14 +129,15 @@ def main():
exit_code = subprocess.call(command, env=test_env, cwd=os.getcwd())
for test_status in 'passed', 'failed', 'interrupted':
logs_dir = os.path.join(options.output_dir, test_status)
if not os.path.isdir(logs_dir):
continue
logs = [os.path.join(logs_dir, log) for log in os.listdir(logs_dir)]
log_file = os.path.join(options.output_dir, '%s-tests.log' % test_status)
CatFiles(logs, log_file)
os.rmdir(logs_dir)
if options.output_dir:
for test_status in 'passed', 'failed', 'interrupted':
logs_dir = os.path.join(options.output_dir, test_status)
if not os.path.isdir(logs_dir):
continue
logs = [os.path.join(logs_dir, log) for log in os.listdir(logs_dir)]
log_file = os.path.join(options.output_dir, '%s-tests.log' % test_status)
CatFiles(logs, log_file)
os.rmdir(logs_dir)
return exit_code