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

Unified Diff: tracing/bin/run_symbolize_trace_tests

Issue 2950723002: Add an end-to-end test for symbolize_trace on macOS. (Closed)
Patch Set: Created 3 years, 6 months 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
Index: tracing/bin/run_symbolize_trace_tests
diff --git a/tracing/bin/run_symbolize_trace_tests b/tracing/bin/run_symbolize_trace_tests
new file mode 100755
index 0000000000000000000000000000000000000000..e4afe79c25df5bb89cdcc0a936de280f771a685a
--- /dev/null
+++ b/tracing/bin/run_symbolize_trace_tests
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+# Copyright 2017 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.
+
+import filecmp
+import os
+import shutil
+import subprocess
+import sys
+import tempfile
+
+_THIS_DIR_PATH = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
+
+sys.path.insert(0, _THIS_DIR_PATH)
+import symbolize_trace
+
+
+def _DownloadFromCloudStorage(path):
+ BUCKET = 'chrome-partner-telemetry'
+ args = [ 'download_from_google_storage.py', '-s', path + '.sha1', '--bucket', BUCKET ]
etienneb 2017/06/20 03:28:09 split line
erikchen 2017/06/23 00:33:45 Done.
+ subprocess.check_call(args)
+
+
+def GetGzipCrc(path):
+ args = 'gzip -v -l ' + path + ' | awk \'{print $2}\' | tail -n 1'
+ return subprocess.call(args, shell=True)
+
+def TestMac():
+ trace_presymbolization_path = os.path.join(
+ _THIS_DIR_PATH, 'data', 'mac_trace_presymbolization.json.gz')
+ _DownloadFromCloudStorage(trace_presymbolization_path)
+
+ trace_postsymbolization_path = os.path.join(
+ _THIS_DIR_PATH, 'data', 'mac_trace_postsymbolization.json.gz')
+ _DownloadFromCloudStorage(trace_postsymbolization_path)
+
+ _, temporary_trace = tempfile.mkstemp(suffix='.json.gz')
+ try:
+ shutil.copy(trace_presymbolization_path, temporary_trace)
+ symbolize_trace.main(['--only-symbolize-chrome-symbols',
+ temporary_trace])
+ success = (GetGzipCrc(temporary_trace)
etienneb 2017/06/20 03:28:09 why comparing CRC? File comparison should be the s
erikchen 2017/06/23 00:33:45 gzip files have a timestamp built in, so can't be
+ == GetGzipCrc(trace_postsymbolization_path))
+ print 'Success: ' + str(success)
+ finally:
+ os.remove(temporary_trace)
+
+
+if __name__ == '__main__':
+ if sys.platform == 'darwin':
+ TestMac()

Powered by Google App Engine
This is Rietveld 408576698