mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-15 06:40:43 +01:00
Revert of flag simplification.
In order to unify WebRTC recipes with Chromium recipes this CL tries to revert the old CL https://webrtc-review.googlesource.com/c/src/+/171681. This CL was already partially reverted (https://webrtc-review.googlesource.com/c/src/+/171809). In upcoming CLs, the added flag dump_json_test_results will be removed in order to use isolated-script-test-output instead. Bug: webrtc:13556 Change-Id: I3144498b9a5cbaa56c23b3b8adbac2229ad63c37 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/245602 Reviewed-by: Andrey Logvin <landrey@webrtc.org> Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Jeremy Leconte <jleconte@google.com> Cr-Commit-Position: refs/heads/main@{#35666}
This commit is contained in:
parent
ba38934771
commit
994bf454ec
4 changed files with 173 additions and 145 deletions
|
@ -15,6 +15,7 @@ output files will be performed.
|
|||
|
||||
import argparse
|
||||
import collections
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
|
@ -62,6 +63,10 @@ def _ParseArgs():
|
|||
'--isolated-script-test-perf-output',
|
||||
default=None,
|
||||
help='Path to store perf results in histogram proto format.')
|
||||
parser.add_argument(
|
||||
'--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',
|
||||
|
@ -262,7 +267,6 @@ def _ConfigurePythonPath(args):
|
|||
|
||||
|
||||
def main():
|
||||
# pylint: disable=W0101
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logging.info('Invoked with %s', str(sys.argv))
|
||||
|
||||
|
@ -354,6 +358,10 @@ def main():
|
|||
with open(args.isolated_script_test_perf_output, 'wb') as f:
|
||||
f.write(histograms.AsProto().SerializeToString())
|
||||
|
||||
if args.isolated_script_test_output:
|
||||
with open(args.isolated_script_test_output, 'w') as f:
|
||||
json.dump({"version": 3}, f)
|
||||
|
||||
return test_process.wait()
|
||||
|
||||
|
||||
|
|
|
@ -59,6 +59,11 @@ ABSL_FLAG(
|
|||
|
||||
#else
|
||||
|
||||
ABSL_FLAG(std::string,
|
||||
isolated_script_test_output,
|
||||
"",
|
||||
"Path to output an empty JSON file which Chromium infra requires.");
|
||||
|
||||
ABSL_FLAG(
|
||||
std::string,
|
||||
isolated_script_test_perf_output,
|
||||
|
@ -232,6 +237,14 @@ class TestMainImpl : public TestMain {
|
|||
if (metrics_to_plot) {
|
||||
webrtc::test::PrintPlottableResults(*metrics_to_plot);
|
||||
}
|
||||
|
||||
std::string result_filename =
|
||||
absl::GetFlag(FLAGS_isolated_script_test_output);
|
||||
if (!result_filename.empty()) {
|
||||
std::ofstream result_file(result_filename);
|
||||
result_file << "{\"version\": 3}";
|
||||
result_file.close();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (capture_events) {
|
||||
|
|
|
@ -16,10 +16,15 @@ import sys
|
|||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--isolated-script-test-output')
|
||||
parser.add_argument('--isolated-script-test-perf-output')
|
||||
args, unrecognized_args = parser.parse_known_args()
|
||||
|
||||
test_command = _ForcePythonInterpreter(unrecognized_args)
|
||||
if args.isolated_script_test_output:
|
||||
test_command += [
|
||||
'--isolated_script_test_output', args.isolated_script_test_output
|
||||
]
|
||||
if args.isolated_script_test_perf_output:
|
||||
test_command += [
|
||||
'--isolated_script_test_perf_output=' +
|
||||
|
@ -41,6 +46,5 @@ def _ForcePythonInterpreter(cmd):
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# pylint: disable=W0101
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
sys.exit(main())
|
||||
|
|
|
@ -15,7 +15,8 @@ gtest-parallel, renaming options and translating environment variables into
|
|||
flags. Developers should execute gtest-parallel directly.
|
||||
|
||||
In particular, this translates the GTEST_SHARD_INDEX and GTEST_TOTAL_SHARDS
|
||||
environment variables to the --shard_index and --shard_count flags
|
||||
environment variables to the --shard_index and --shard_count flags, renames
|
||||
the --isolated-script-test-output flag to --dump_json_test_results,
|
||||
and interprets e.g. --workers=2x as 2 workers per core.
|
||||
|
||||
Flags before '--' will be attempted to be understood as arguments to
|
||||
|
@ -44,6 +45,7 @@ For example:
|
|||
--another_flag \
|
||||
--output_dir=SOME_OUTPUT_DIR \
|
||||
--store-test-artifacts
|
||||
--isolated-script-test-output=SOME_DIR \
|
||||
--isolated-script-test-perf-output=SOME_OTHER_DIR \
|
||||
-- \
|
||||
--foo=bar \
|
||||
|
@ -133,6 +135,8 @@ def ParseArgs(argv=None):
|
|||
# These options will be passed unchanged to gtest-parallel.
|
||||
gtest_group.AddArgument('-d', '--output_dir')
|
||||
gtest_group.AddArgument('-r', '--repeat')
|
||||
# TODO(webrtc:13556): use isolated-script-test-output argument instead
|
||||
# of dump_json_test_results as it was done prior to chromium:1051927.
|
||||
gtest_group.AddArgument('--dump_json_test_results')
|
||||
gtest_group.AddArgument('--retry_failed')
|
||||
gtest_group.AddArgument('--gtest_color')
|
||||
|
@ -160,13 +164,16 @@ def ParseArgs(argv=None):
|
|||
|
||||
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 arg.startswith('--isolated-script-test-perf-output'):
|
||||
if any(arg.startswith(k) for k in webrtc_flags_to_change.keys()):
|
||||
arg_split = arg.split('=')
|
||||
assert len(
|
||||
arg_split) == 2, 'You must use the = syntax for this flag.'
|
||||
args_to_pass.append('--isolated_script_test_perf_output=' +
|
||||
args_to_pass.append(webrtc_flags_to_change[arg_split[0]] + '=' +
|
||||
arg_split[1])
|
||||
else:
|
||||
args_to_pass.append(arg)
|
||||
|
@ -178,8 +185,7 @@ def ParseArgs(argv=None):
|
|||
'--output_dir must be specified for storing test artifacts.')
|
||||
test_artifacts_dir = os.path.join(options.output_dir, 'test_artifacts')
|
||||
|
||||
executable_args.insert(0,
|
||||
'--test_artifacts_dir=%s' % test_artifacts_dir)
|
||||
executable_args.insert(0, '--test_artifacts_dir=%s' % test_artifacts_dir)
|
||||
else:
|
||||
test_artifacts_dir = None
|
||||
|
||||
|
@ -227,13 +233,10 @@ def main():
|
|||
|
||||
if output_dir:
|
||||
for test_status in 'passed', 'failed', 'interrupted':
|
||||
logs_dir = os.path.join(output_dir, 'gtest-parallel-logs',
|
||||
test_status)
|
||||
logs_dir = os.path.join(output_dir, 'gtest-parallel-logs', test_status)
|
||||
if not os.path.isdir(logs_dir):
|
||||
continue
|
||||
logs = [
|
||||
os.path.join(logs_dir, log) for log in os.listdir(logs_dir)
|
||||
]
|
||||
logs = [os.path.join(logs_dir, log) for log in os.listdir(logs_dir)]
|
||||
log_file = os.path.join(output_dir, '%s-tests.log' % test_status)
|
||||
_CatFiles(logs, log_file)
|
||||
os.rmdir(logs_dir)
|
||||
|
|
Loading…
Reference in a new issue