Index: testing/scripts/run_telemetry_benchmark_as_googletest.py |
diff --git a/testing/scripts/run_telemetry_benchmark_as_googletest.py b/testing/scripts/run_telemetry_benchmark_as_googletest.py |
index dd8d23b69bd04a29ded9edbc6bbfbe53bea1b14f..674c4c9e9433beac1c6bfc372ff7c0d6511d0f23 100755 |
--- a/testing/scripts/run_telemetry_benchmark_as_googletest.py |
+++ b/testing/scripts/run_telemetry_benchmark_as_googletest.py |
@@ -44,9 +44,18 @@ def main(): |
parser.add_argument( |
'--isolated-script-test-output', type=argparse.FileType('w'), |
required=True) |
- parser.add_argument( |
- '--isolated-script-test-chartjson-output', type=argparse.FileType('w'), |
- required=False) |
+ # Only create the chartjson directory if this test is producing chartjson |
+ # results. Otherwise, remove from the argument list. |
+ writing_chartjson_results = '--output-format=chartjson' in sys.argv |
+ if writing_chartjson_results: |
+ parser.add_argument( |
+ '--isolated-script-test-chartjson-output', type=argparse.FileType('w'), |
+ required=False) |
+ else: |
+ for arg in sys.argv: |
+ if 'isolated-script-test-chartjson-output' in arg: |
+ sys.argv.remove(arg) |
+ break |
Ken Russell (switch to Gerrit)
2016/09/22 20:31:48
Instead of this somewhat contorted code, could you
eyaich1
2016/09/23 13:52:38
Done.
|
parser.add_argument('--xvfb', help='Start xvfb.', action='store_true') |
args, rest_args = parser.parse_known_args() |
xvfb_proc = None |
@@ -65,8 +74,8 @@ def main(): |
tempfile_dir = tempfile.mkdtemp('telemetry') |
valid = True |
failures = [] |
- chartjson = (args.isolated_script_test_chartjson_output is not None and |
- '--output-format=chartjson' in rest_args) |
+ chartjson = (writing_chartjson_results |
+ and args.isolated_script_test_chartjson_output is not None) |
chartresults = None |
try: |
rc = common.run_command([sys.executable] + rest_args + [ |