Allow low_bandwith_audio_test.py to pass unknown arg to the test.

* The idea is copied from flags_compatibility since this file does a bit the same thing.
* Remove extra_test_args which is not used and becomes unecessary.
* Fix lint issues.

Bug: b/197492097
Change-Id: I378e163a5116ded13619f91ce50859519c9550df
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/252004
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Jeremy Leconte <jleconte@google.com>
Cr-Commit-Position: refs/heads/main@{#36044}
This commit is contained in:
Jeremy Leconte 2022-02-22 09:53:41 +01:00 committed by WebRTC LUCI CQ
parent c8f0502f0f
commit 7b0a30ec9a

View File

@ -67,24 +67,16 @@ def _ParseArgs():
'--isolated-script-test-output',
default=None,
help='Path to output an empty JSON file which Chromium infra requires.')
parser.add_argument('--extra-test-args',
default=[],
action='append',
help='Extra args to path to the test binary.')
# Ignore Chromium-specific flags
parser.add_argument('--test-launcher-summary-output', type=str, default=None)
args = parser.parse_args()
return args
return parser.parse_known_args()
def _GetPlatform():
if sys.platform == 'win32':
return 'win'
elif sys.platform == 'darwin':
if sys.platform == 'darwin':
return 'mac'
elif sys.platform.startswith('linux'):
if sys.platform.startswith('linux'):
return 'linux'
raise AssertionError('Unknown platform %s' % sys.platform)
@ -258,14 +250,13 @@ def _ConfigurePythonPath(args):
# Fail early in case the proto hasn't been built.
try:
#pylint: disable=unused-variable
#pylint: disable=unused-import
import histogram_pb2
except ImportError as e:
logging.exception(e)
raise ImportError('Could not import histogram_pb2. You need to build the '
'low_bandwidth_audio_perf_test target before invoking '
'this script. Expected to find '
'histogram_pb2.py in %s.' % histogram_proto_path)
'histogram_pb2.py in %s.' % histogram_proto_path) from e
def main():
@ -274,7 +265,7 @@ def main():
datefmt='%Y-%m-%d %H:%M:%S')
logging.info('Invoked with %s', str(sys.argv))
args = _ParseArgs()
args, extra_test_args = _ParseArgs()
_ConfigurePythonPath(args)
@ -309,7 +300,7 @@ def main():
test_process = subprocess.Popen(_LogCommand(test_command + [
'--sample_rate_hz=%d' % analyzer.sample_rate_hz,
'--test_case_prefix=%s' % analyzer.name,
] + args.extra_test_args),
] + extra_test_args),
universal_newlines=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)