OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2014 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2014 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 | 6 |
7 """Run the webpages_playback automation script.""" | 7 """Run the webpages_playback automation script.""" |
8 | 8 |
9 | 9 |
10 import os | 10 import os |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 '--page_sets', 'all', | 57 '--page_sets', 'all', |
58 '--browser_executable', browser_executable, | 58 '--browser_executable', browser_executable, |
59 '--non-interactive', | 59 '--non-interactive', |
60 '--upload', | 60 '--upload', |
61 '--alternate_upload_dir', upload_dir, | 61 '--alternate_upload_dir', upload_dir, |
62 '--chrome_src_path', chrome_src_path, | 62 '--chrome_src_path', chrome_src_path, |
63 ] | 63 ] |
64 | 64 |
65 try: | 65 try: |
66 shell_utils.run(webpages_playback_cmd) | 66 shell_utils.run(webpages_playback_cmd) |
67 | |
68 # Temporary change to enable Slimming Paint runs. See skia:3763. | |
69 skia_page_sets_path = os.path.join( | |
70 os.path.dirname(os.path.realpath(__file__)), 'page_sets') | |
71 sp_skia_page_sets = [ | |
72 os.path.join(skia_page_sets_path, 'skia_carsvg_desktop.py'), | |
73 os.path.join(skia_page_sets_path, 'skia_chalkboard_desktop.py'), | |
74 os.path.join(skia_page_sets_path, 'skia_css3gradients_desktop.py'), | |
75 os.path.join(skia_page_sets_path, 'skia_espn_desktop.py'), | |
76 os.path.join(skia_page_sets_path, 'skia_gmailthread_desktop.py'), | |
77 os.path.join(skia_page_sets_path, 'skia_googlehome_desktop.py'), | |
78 os.path.join(skia_page_sets_path, 'skia_googlespreadsheet_desktop.py'), | |
79 os.path.join(skia_page_sets_path, 'skia_jsfiddlebigcar_desktop.py'), | |
80 os.path.join(skia_page_sets_path, 'skia_mapsvg_desktop.py'), | |
81 os.path.join(skia_page_sets_path, 'skia_nytimes_desktop.py'), | |
82 os.path.join(skia_page_sets_path, 'skia_samoasvg_desktop.py'), | |
83 os.path.join(skia_page_sets_path, 'skia_tigersvg_desktop.py'), | |
84 os.path.join(skia_page_sets_path, 'skia_ugamsolutions_desktop.py'), | |
85 os.path.join(skia_page_sets_path, 'skia_digg_nexus10.py'), | |
86 os.path.join(skia_page_sets_path, 'skia_gmail_nexus10.py'), | |
87 os.path.join(skia_page_sets_path, 'skia_pravda_nexus10.py'), | |
88 ] | |
89 webpages_playback_cmd.extend([ | |
90 '--skp_prefix', 'sp_', | |
91 '--browser_extra_args', '--enable-slimming-paint', | |
92 '--page_sets', '%s' % ','.join(sp_skia_page_sets), | |
93 ]) | |
94 shell_utils.run(webpages_playback_cmd) | |
95 finally: | 67 finally: |
96 # Clean up any leftover browser instances. This can happen if there are | 68 # Clean up any leftover browser instances. This can happen if there are |
97 # telemetry crashes, processes are not always cleaned up appropriately by | 69 # telemetry crashes, processes are not always cleaned up appropriately by |
98 # the webpagereplay and telemetry frameworks. | 70 # the webpagereplay and telemetry frameworks. |
99 procs = subprocess.check_output(['ps', 'ax']) | 71 procs = subprocess.check_output(['ps', 'ax']) |
100 for line in procs.splitlines(): | 72 for line in procs.splitlines(): |
101 if browser_executable in line: | 73 if browser_executable in line: |
102 pid = line.strip().split(' ')[0] | 74 pid = line.strip().split(' ')[0] |
103 if pid != str(os.getpid()) and not 'python' in line: | 75 if pid != str(os.getpid()) and not 'python' in line: |
104 try: | 76 try: |
105 shell_utils.run(['kill', '-9', pid]) | 77 shell_utils.run(['kill', '-9', pid]) |
106 except shell_utils.CommandFailedException as e: | 78 except shell_utils.CommandFailedException as e: |
107 print e | 79 print e |
108 else: | 80 else: |
109 print 'Refusing to kill self.' | 81 print 'Refusing to kill self.' |
110 | 82 |
111 print 'writing %s: %s' % (SKP_VERSION_FILE, skp_version) | 83 print 'writing %s: %s' % (SKP_VERSION_FILE, skp_version) |
112 with open(SKP_VERSION_FILE, 'w') as f: | 84 with open(SKP_VERSION_FILE, 'w') as f: |
113 f.write(str(skp_version)) | 85 f.write(str(skp_version)) |
114 | 86 |
115 | 87 |
116 if '__main__' == __name__: | 88 if '__main__' == __name__: |
117 if len(sys.argv) != 3: | 89 if len(sys.argv) != 3: |
118 print >> sys.stderr, 'USAGE: %s <chrome src path> <browser executable>' | 90 print >> sys.stderr, 'USAGE: %s <chrome src path> <browser executable>' |
119 sys.exit(1) | 91 sys.exit(1) |
120 main(*sys.argv[1:]) | 92 main(*sys.argv[1:]) |
OLD | NEW |