Replace dash by underscore in the command line argument before absl flag parsing.
The expected behavior is to have something similar than python:
https://docs.python.org/dev/library/argparse.html#dest:
"Any internal - characters will be converted to _ characters to make sure the string is a valid attribute name".
This allows to catch chromium arguments like 'isolated-script-test-output' that previously needed some preprocessing done for example in flags_compatibility.py.
This CL also fixes a fuchsia specific issue where the test runner needs a 'isolated-script-test-output' argument but then pass the argument to WebRTC that expects a 'isolated_script_test_output' argument. Thus calling flags_compatibility before the test_runner fails and there is not much room to change the argument in between the test runner and the test.
Change-Id: I48a591743fa50484a0ec584a3f9e97d9e0fd25ef
Bug: webrtc:14694
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/284541
Commit-Queue: Jeremy Leconte <jleconte@google.com>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38707}
diff --git a/tools_webrtc/gtest-parallel-wrapper.py b/tools_webrtc/gtest-parallel-wrapper.py
index 2972e6c..a64c773 100755
--- a/tools_webrtc/gtest-parallel-wrapper.py
+++ b/tools_webrtc/gtest-parallel-wrapper.py
@@ -63,7 +63,7 @@
--test_artifacts_dir=SOME_OUTPUT_DIR/test_artifacts \
--some_flag=some_value \
--another_flag \
- --isolated_script_test_perf_output=SOME_OTHER_DIR \
+ --isolated-script-test-perf-output=SOME_OTHER_DIR \
--foo=bar \
--baz
@@ -155,32 +155,12 @@
# know what will be the swarming output dir.
parser.add_argument('--store-test-artifacts', action='store_true')
- # No-sandbox is a Chromium-specific flag, ignore it.
- # TODO(bugs.webrtc.org/8115): Remove workaround when fixed.
- parser.add_argument('--no-sandbox',
- action='store_true',
- help=argparse.SUPPRESS)
-
parser.add_argument('executable')
parser.add_argument('executable_args', nargs='*')
options, unrecognized_args = parser.parse_known_args(argv)
- webrtc_flags_to_change = {
- '--isolated-script-test-perf-output':
- '--isolated_script_test_perf_output',
- '--isolated-script-test-output': '--isolated_script_test_output',
- }
- args_to_pass = []
- for arg in unrecognized_args:
- if any(arg.startswith(k) for k in list(webrtc_flags_to_change.keys())):
- arg_split = arg.split('=')
- args_to_pass.append(webrtc_flags_to_change[arg_split[0]] + '=' +
- arg_split[1])
- else:
- args_to_pass.append(arg)
-
- executable_args = options.executable_args + args_to_pass
+ executable_args = options.executable_args + unrecognized_args
if options.store_test_artifacts:
assert options.output_dir, (