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}
This commit is contained in:
Jeremy Leconte
2022-11-22 11:06:47 +01:00
committed by WebRTC LUCI CQ
parent a3a3b6d798
commit c6ae33fb07
13 changed files with 93 additions and 326 deletions

View File

@ -53,8 +53,9 @@ class WebRTCMetaBuildWrapper(mb.MetaBuildWrapper):
is_android = 'target_os="android"' in vals['gn_args']
is_fuchsia = 'target_os="fuchsia"' in vals['gn_args']
is_linux = self.platform.startswith('linux') and not is_android
is_ios = 'target_os="ios"' in vals['gn_args']
is_linux = self.platform.startswith('linux') and not is_android
is_win = self.platform.startswith('win')
if test_type == 'nontest':
self.WriteFailureAndRaise('We should not be isolating %s.' % target,
@ -87,16 +88,11 @@ class WebRTCMetaBuildWrapper(mb.MetaBuildWrapper):
'../../.task_template_packages/logdog_butler', '--logcat-output-file',
'${ISOLATED_OUTDIR}/logcats', '--store-tombstones'
]
elif is_ios or is_fuchsia:
cmdline += [
vpython_exe, '../../tools_webrtc/flags_compatibility.py',
'bin/run_%s' % target
]
extra_files.append('../../tools_webrtc/flags_compatibility.py')
elif test_type == 'raw':
cmdline += [vpython_exe, '../../tools_webrtc/flags_compatibility.py']
extra_files.append('../../tools_webrtc/flags_compatibility.py')
cmdline.append(_GetExecutable(target, self.platform))
elif is_ios or is_fuchsia or test_type == 'raw':
if is_win:
cmdline += ['bin\\run_{}.bat'.format(target)]
else:
cmdline += ['bin/run_{}'.format(target)]
else:
if isolate_map[target].get('use_webcam', False):
cmdline += [