Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(859)

Unified Diff: testing/scripts/run_gtest_perf_test.py

Issue 2479543002: Porting relevant legacy conversion code from performance_lp to src side (Closed)
Patch Set: Renaming protected functions Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/BUILD.gn ('k') | tools/perf/generate_legacy_perf_dashboard_json.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/scripts/run_gtest_perf_test.py
diff --git a/testing/scripts/run_gtest_perf_test.py b/testing/scripts/run_gtest_perf_test.py
index ba4746cea1b20ba98cca1eb8ed65bc99b0eff75c..ac43ec75e0eb8327ca3a36e299b22b33b3d2b10b 100755
--- a/testing/scripts/run_gtest_perf_test.py
+++ b/testing/scripts/run_gtest_perf_test.py
@@ -29,6 +29,18 @@ import traceback
import common
+
+def GetChromiumSrcDir():
+ return os.path.abspath(
+ os.path.join(os.path.abspath(__file__), '..', '..', '..'))
+
+def GetPerfDir():
+ return os.path.join(GetChromiumSrcDir(), 'tools', 'perf')
+# Add src/tools/perf where generate_legacy_perf_dashboard_json.py lives
+sys.path.append(GetPerfDir())
+
+import generate_legacy_perf_dashboard_json
+
# Add src/testing/ into sys.path for importing xvfb.
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import xvfb
@@ -78,24 +90,28 @@ def main():
executable = '.\%s.exe' % executable
else:
executable = './%s' % executable
-
- rc = common.run_command_with_output([executable] + [
- '--write-abbreviated-json-results-to', args.isolated_script_test_output,
- ], env=env, stdoutfile=args.isolated_script_test_chartjson_output)
-
- # Now get the correct json format from the stdout to write to the
- # perf results file
+ with common.temporary_file() as tempfile_path:
+ valid = (common.run_command_with_output([executable],
+ env=env, stdoutfile=tempfile_path) == 0)
+
+ # Now get the correct json format from the stdout to write to the
+ # perf results file
+ results_processor = (
+ generate_legacy_perf_dashboard_json.LegacyResultsProcessor())
+ charts = results_processor.GenerateJsonResults(tempfile_path)
+ # Write the returned encoded json to a the charts output file
+ with open(args.isolated_script_test_chartjson_output, 'w') as f:
+ f.write(charts)
except Exception:
traceback.print_exc()
valid = False
- if not valid:
- failures = ['(entire test suite)']
- with open(args.isolated_script_test_output, 'w') as fp:
- json.dump({
- 'valid': valid,
- 'failures': failures,
- }, fp)
+ failures = [] if valid else ['(entire test suite)']
+ with open(args.isolated_script_test_output, 'w') as fp:
+ json.dump({
+ 'valid': valid,
+ 'failures': failures,
+ }, fp)
return rc
« no previous file with comments | « cc/BUILD.gn ('k') | tools/perf/generate_legacy_perf_dashboard_json.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698