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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2017 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 import filecmp
7 import os
8 import shutil
9 import subprocess
10 import sys
11 import tempfile
12
13 _THIS_DIR_PATH = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
14
15 sys.path.insert(0, _THIS_DIR_PATH)
16 import symbolize_trace
17
18
19 def _DownloadFromCloudStorage(path):
20 BUCKET = 'chrome-partner-telemetry'
21 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.
22 subprocess.check_call(args)
23
24
25 def GetGzipCrc(path):
26 args = 'gzip -v -l ' + path + ' | awk \'{print $2}\' | tail -n 1'
27 return subprocess.call(args, shell=True)
28
29 def TestMac():
30 trace_presymbolization_path = os.path.join(
31 _THIS_DIR_PATH, 'data', 'mac_trace_presymbolization.json.gz')
32 _DownloadFromCloudStorage(trace_presymbolization_path)
33
34 trace_postsymbolization_path = os.path.join(
35 _THIS_DIR_PATH, 'data', 'mac_trace_postsymbolization.json.gz')
36 _DownloadFromCloudStorage(trace_postsymbolization_path)
37
38 _, temporary_trace = tempfile.mkstemp(suffix='.json.gz')
39 try:
40 shutil.copy(trace_presymbolization_path, temporary_trace)
41 symbolize_trace.main(['--only-symbolize-chrome-symbols',
42 temporary_trace])
43 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
44 == GetGzipCrc(trace_postsymbolization_path))
45 print 'Success: ' + str(success)
46 finally:
47 os.remove(temporary_trace)
48
49
50 if __name__ == '__main__':
51 if sys.platform == 'darwin':
52 TestMac()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698