forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dummy_gtest
executable file
·46 lines (41 loc) · 1.71 KB
/
dummy_gtest
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env vpython
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""This is a fake version of a non-Telemetry performance test (gtest_perf_test).
It is used by ../scripts_smoke_unittest.py.
"""
import argparse
import os
import sys
import shutil
# This is just a random line of output that can be converted into graph_json.
print r"*RESULT clockless_video_playback_vp8: bear_silent.webm= 53.406108056578425 runs/s"
# Simulate trace file generation when "--trace-dir" switch is present.
parser = argparse.ArgumentParser()
parser.add_argument(
"--argument-to-check-that-arguments-work", action='store_true')
parser.add_argument(
"--trace-dir",
type=str,
help="Simulate trace file generation to the given path.")
options, _ = parser.parse_known_args(sys.argv[1:])
if options.trace_dir:
trace_file = os.path.join(os.path.dirname(__file__), 'dummy_trace.json')
shutil.copy(trace_file, options.trace_dir)
test_result_file = os.path.join(
os.path.dirname(__file__), 'dummy_luci_test_result_template.json')
with open(test_result_file, 'r') as f:
test_result = f.read()
test_result = test_result.replace(
'FULL_TRACE_FILE_PATH', os.path.join(options.trace_dir,
'dummy_trace.json'))
test_result = ''.join([line.strip() for line in test_result.splitlines()])
with open(
os.path.join(options.trace_dir, 'dummy_luci_test_result.json'), 'w') as f:
f.write(test_result)
if options.argument_to_check_that_arguments_work:
print 'Arguments worked!'
else:
print '--argument-to-check-that-arguments-work was not passed. Failing.'
sys.exit(1)