| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """Archives or replays webpages and creates SKPs in a Google Storage location. | 6 """Archives or replays webpages and creates SKPs in a Google Storage location. |
| 7 | 7 |
| 8 To archive webpages and store SKP files (archives should be rarely updated): | 8 To archive webpages and store SKP files (archives should be rarely updated): |
| 9 | 9 |
| 10 cd skia | 10 cd skia |
| 11 python tools/skp/webpages_playback.py --dest_gsbase=gs://rmistry --record \ | 11 python tools/skp/webpages_playback.py --data_store=gs://rmistry --record \ |
| 12 --page_sets=all --skia_tools=/home/default/trunk/out/Debug/ \ | 12 --page_sets=all --skia_tools=/home/default/trunk/out/Debug/ \ |
| 13 --browser_executable=/tmp/chromium/out/Release/chrome | 13 --browser_executable=/tmp/chromium/out/Release/chrome |
| 14 | 14 |
| 15 The above command uses Google Storage bucket 'rmistry' to download needed files. |
| 15 | 16 |
| 16 To replay archived webpages and re-generate SKP files (should be run whenever | 17 To replay archived webpages and re-generate SKP files (should be run whenever |
| 17 SkPicture.PICTURE_VERSION changes): | 18 SkPicture.PICTURE_VERSION changes): |
| 18 | 19 |
| 19 cd skia | 20 cd skia |
| 20 python tools/skp/webpages_playback.py --dest_gsbase=gs://rmistry \ | 21 python tools/skp/webpages_playback.py --data_store=gs://rmistry \ |
| 21 --page_sets=all --skia_tools=/home/default/trunk/out/Debug/ \ | 22 --page_sets=all --skia_tools=/home/default/trunk/out/Debug/ \ |
| 22 --browser_executable=/tmp/chromium/out/Release/chrome | 23 --browser_executable=/tmp/chromium/out/Release/chrome |
| 23 | 24 |
| 24 | 25 |
| 25 Specify the --page_sets flag (default value is 'all') to pick a list of which | 26 Specify the --page_sets flag (default value is 'all') to pick a list of which |
| 26 webpages should be archived and/or replayed. Eg: | 27 webpages should be archived and/or replayed. Eg: |
| 27 | 28 |
| 28 --page_sets=tools/skp/page_sets/skia_yahooanswers_desktop.py,\ | 29 --page_sets=tools/skp/page_sets/skia_yahooanswers_desktop.py,\ |
| 29 tools/skp/page_sets/skia_googlecalendar_nexus10.py | 30 tools/skp/page_sets/skia_googlecalendar_nexus10.py |
| 30 | 31 |
| 31 The --browser_executable flag should point to the browser binary you want to use | 32 The --browser_executable flag should point to the browser binary you want to use |
| 32 to capture archives and/or capture SKP files. Majority of the time it should be | 33 to capture archives and/or capture SKP files. Majority of the time it should be |
| 33 a newly built chrome binary. | 34 a newly built chrome binary. |
| 34 | 35 |
| 35 The --upload_to_gs flag controls whether generated artifacts will be uploaded | 36 The --data_store flag controls where the needed artifacts, such as |
| 36 to Google Storage (default value is False if not specified). | 37 credential files, are downloaded from. It also controls where the |
| 38 generated artifacts, such as recorded webpages and resulting skp renderings, |
| 39 are uploaded to. URLs with scheme 'gs://' use Google Storage. Otherwise |
| 40 use local filesystem. |
| 41 |
| 42 The --upload=True flag means generated artifacts will be |
| 43 uploaded or copied to the location specified by --data_store. (default value is |
| 44 False if not specified). |
| 37 | 45 |
| 38 The --non-interactive flag controls whether the script will prompt the user | 46 The --non-interactive flag controls whether the script will prompt the user |
| 39 (default value is False if not specified). | 47 (default value is False if not specified). |
| 40 | 48 |
| 41 The --skia_tools flag if specified will allow this script to run | 49 The --skia_tools flag if specified will allow this script to run |
| 42 debugger, render_pictures, and render_pdfs on the captured | 50 debugger, render_pictures, and render_pdfs on the captured |
| 43 SKP(s). The tools are run after all SKPs are succesfully captured to make sure | 51 SKP(s). The tools are run after all SKPs are succesfully captured to make sure |
| 44 they can be added to the buildbots with no breakages. | 52 they can be added to the buildbots with no breakages. |
| 45 """ | 53 """ |
| 46 | 54 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 """Class that archives or replays webpages and creates SKPs.""" | 124 """Class that archives or replays webpages and creates SKPs.""" |
| 117 | 125 |
| 118 def __init__(self, parse_options): | 126 def __init__(self, parse_options): |
| 119 """Constructs a SkPicturePlayback BuildStep instance.""" | 127 """Constructs a SkPicturePlayback BuildStep instance.""" |
| 120 assert parse_options.browser_executable, 'Must specify --browser_executable' | 128 assert parse_options.browser_executable, 'Must specify --browser_executable' |
| 121 self._browser_executable = parse_options.browser_executable | 129 self._browser_executable = parse_options.browser_executable |
| 122 | 130 |
| 123 self._all_page_sets_specified = parse_options.page_sets == 'all' | 131 self._all_page_sets_specified = parse_options.page_sets == 'all' |
| 124 self._page_sets = self._ParsePageSets(parse_options.page_sets) | 132 self._page_sets = self._ParsePageSets(parse_options.page_sets) |
| 125 | 133 |
| 126 self._dest_gsbase = parse_options.dest_gsbase | |
| 127 self._record = parse_options.record | 134 self._record = parse_options.record |
| 128 self._skia_tools = parse_options.skia_tools | 135 self._skia_tools = parse_options.skia_tools |
| 129 self._non_interactive = parse_options.non_interactive | 136 self._non_interactive = parse_options.non_interactive |
| 130 self._upload_to_gs = parse_options.upload_to_gs | 137 self._upload = parse_options.upload |
| 138 data_store_location = parse_options.data_store |
| 139 if data_store_location.startswith(gs_utils.GS_PREFIX): |
| 140 self.gs = GoogleStorageDataStore(data_store_location) |
| 141 else: |
| 142 self.gs = LocalFileSystemDataStore(data_store_location) |
| 131 self._alternate_upload_dir = parse_options.alternate_upload_dir | 143 self._alternate_upload_dir = parse_options.alternate_upload_dir |
| 132 self._skip_all_gs_access = parse_options.skip_all_gs_access | |
| 133 self._telemetry_binaries_dir = os.path.join(parse_options.chrome_src_path, | 144 self._telemetry_binaries_dir = os.path.join(parse_options.chrome_src_path, |
| 134 'tools', 'perf') | 145 'tools', 'perf') |
| 135 | 146 |
| 136 self._local_skp_dir = os.path.join( | 147 self._local_skp_dir = os.path.join( |
| 137 parse_options.output_dir, ROOT_PLAYBACK_DIR_NAME, SKPICTURES_DIR_NAME) | 148 parse_options.output_dir, ROOT_PLAYBACK_DIR_NAME, SKPICTURES_DIR_NAME) |
| 138 self._local_record_webpages_archive_dir = os.path.join( | 149 self._local_record_webpages_archive_dir = os.path.join( |
| 139 parse_options.output_dir, ROOT_PLAYBACK_DIR_NAME, 'webpages_archive') | 150 parse_options.output_dir, ROOT_PLAYBACK_DIR_NAME, 'webpages_archive') |
| 140 | 151 |
| 141 # List of SKP files generated by this script. | 152 # List of SKP files generated by this script. |
| 142 self._skp_files = [] | 153 self._skp_files = [] |
| (...skipping 14 matching lines...) Expand all Loading... |
| 157 ps = glob.glob(page_sets) | 168 ps = glob.glob(page_sets) |
| 158 else: | 169 else: |
| 159 ps = page_sets.split(',') | 170 ps = page_sets.split(',') |
| 160 ps.sort() | 171 ps.sort() |
| 161 return ps | 172 return ps |
| 162 | 173 |
| 163 def Run(self): | 174 def Run(self): |
| 164 """Run the SkPicturePlayback BuildStep.""" | 175 """Run the SkPicturePlayback BuildStep.""" |
| 165 | 176 |
| 166 # Download the credentials file if it was not previously downloaded. | 177 # Download the credentials file if it was not previously downloaded. |
| 167 if self._skip_all_gs_access: | 178 if not os.path.isfile(CREDENTIALS_FILE_PATH): |
| 168 print """\n\nPlease create a %s file that contains: | 179 # Download the credentials.json file from Google Storage. |
| 180 self.gs.download_file(CREDENTIALS_GS_PATH, CREDENTIALS_FILE_PATH) |
| 181 |
| 182 if not os.path.isfile(CREDENTIALS_FILE_PATH): |
| 183 print """\n\nCould not locate credentials file in the storage. |
| 184 Please create a %s file that contains: |
| 169 { | 185 { |
| 170 "google": { | 186 "google": { |
| 171 "username": "google_testing_account_username", | 187 "username": "google_testing_account_username", |
| 172 "password": "google_testing_account_password" | 188 "password": "google_testing_account_password" |
| 173 }, | 189 }, |
| 174 "facebook": { | 190 "facebook": { |
| 175 "username": "facebook_testing_account_username", | 191 "username": "facebook_testing_account_username", |
| 176 "password": "facebook_testing_account_password" | 192 "password": "facebook_testing_account_password" |
| 177 } | 193 } |
| 178 }\n\n""" % CREDENTIALS_FILE_PATH | 194 }\n\n""" % CREDENTIALS_FILE_PATH |
| 179 raw_input("Please press a key when you are ready to proceed...") | 195 raw_input("Please press a key when you are ready to proceed...") |
| 180 elif not os.path.isfile(CREDENTIALS_FILE_PATH): | |
| 181 # Download the credentials.json file from Google Storage. | |
| 182 gs_bucket = remove_prefix(self._dest_gsbase.lstrip(), gs_utils.GS_PREFIX) | |
| 183 gs_utils.GSUtils().download_file(gs_bucket, CREDENTIALS_GS_PATH, | |
| 184 CREDENTIALS_FILE_PATH) | |
| 185 | 196 |
| 186 # Delete any left over data files in the data directory. | 197 # Delete any left over data files in the data directory. |
| 187 for archive_file in glob.glob( | 198 for archive_file in glob.glob( |
| 188 os.path.join(LOCAL_REPLAY_WEBPAGES_ARCHIVE_DIR, 'skia_*')): | 199 os.path.join(LOCAL_REPLAY_WEBPAGES_ARCHIVE_DIR, 'skia_*')): |
| 189 os.remove(archive_file) | 200 os.remove(archive_file) |
| 190 | 201 |
| 191 # Delete the local root directory if it already exists. | 202 # Delete the local root directory if it already exists. |
| 192 if os.path.exists(LOCAL_PLAYBACK_ROOT_DIR): | 203 if os.path.exists(LOCAL_PLAYBACK_ROOT_DIR): |
| 193 shutil.rmtree(LOCAL_PLAYBACK_ROOT_DIR) | 204 shutil.rmtree(LOCAL_PLAYBACK_ROOT_DIR) |
| 194 | 205 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 break | 248 break |
| 238 except Exception: | 249 except Exception: |
| 239 # There was a failure continue with the loop. | 250 # There was a failure continue with the loop. |
| 240 traceback.print_exc() | 251 traceback.print_exc() |
| 241 else: | 252 else: |
| 242 # If we get here then record_wpr did not succeed and thus did not | 253 # If we get here then record_wpr did not succeed and thus did not |
| 243 # break out of the loop. | 254 # break out of the loop. |
| 244 raise Exception('record_wpr failed for page_set: %s' % page_set) | 255 raise Exception('record_wpr failed for page_set: %s' % page_set) |
| 245 | 256 |
| 246 else: | 257 else: |
| 247 if not self._skip_all_gs_access: | 258 # Get the webpages archive so that it can be replayed. |
| 248 # Get the webpages archive so that it can be replayed. | 259 self._DownloadWebpagesArchive(wpr_data_file, page_set_json_name) |
| 249 self._DownloadWebpagesArchive(wpr_data_file, page_set_json_name) | |
| 250 | 260 |
| 251 run_benchmark_cmd = ( | 261 run_benchmark_cmd = ( |
| 252 'PYTHONPATH=%s:$PYTHONPATH' % page_set_dir, | 262 'PYTHONPATH=%s:$PYTHONPATH' % page_set_dir, |
| 253 'DISPLAY=%s' % X11_DISPLAY, | 263 'DISPLAY=%s' % X11_DISPLAY, |
| 254 'timeout', '300', | 264 'timeout', '300', |
| 255 os.path.join(self._telemetry_binaries_dir, 'run_benchmark'), | 265 os.path.join(self._telemetry_binaries_dir, 'run_benchmark'), |
| 256 '--extra-browser-args=--disable-setuid-sandbox', | 266 '--extra-browser-args=--disable-setuid-sandbox', |
| 257 '--browser=exact', | 267 '--browser=exact', |
| 258 '--browser-executable=%s' % self._browser_executable, | 268 '--browser-executable=%s' % self._browser_executable, |
| 259 SKP_BENCHMARK, | 269 SKP_BENCHMARK, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 if code != 0: | 317 if code != 0: |
| 308 raise Exception('%s failed!' % ' '.join(tools_cmd)) | 318 raise Exception('%s failed!' % ' '.join(tools_cmd)) |
| 309 | 319 |
| 310 if not self._non_interactive: | 320 if not self._non_interactive: |
| 311 print '\n\n=======Running debugger=======' | 321 print '\n\n=======Running debugger=======' |
| 312 os.system('%s %s' % (os.path.join(self._skia_tools, 'debugger'), | 322 os.system('%s %s' % (os.path.join(self._skia_tools, 'debugger'), |
| 313 self._local_skp_dir)) | 323 self._local_skp_dir)) |
| 314 | 324 |
| 315 print '\n\n' | 325 print '\n\n' |
| 316 | 326 |
| 317 if not self._skip_all_gs_access and self._upload_to_gs: | 327 if self._upload: |
| 318 print '\n\n=======Uploading to Google Storage=======\n\n' | 328 print '\n\n=======Uploading to %s=======\n\n' % self.gs.target_type() |
| 319 # Copy the directory structure in the root directory into Google Storage. | 329 # Copy the directory structure in the root directory into Google Storage. |
| 320 dest_dir_name = ROOT_PLAYBACK_DIR_NAME | 330 dest_dir_name = ROOT_PLAYBACK_DIR_NAME |
| 321 if self._alternate_upload_dir: | 331 if self._alternate_upload_dir: |
| 322 dest_dir_name = self._alternate_upload_dir | 332 dest_dir_name = self._alternate_upload_dir |
| 323 | 333 |
| 324 gs_bucket = remove_prefix(self._dest_gsbase.lstrip(), gs_utils.GS_PREFIX) | 334 self.gs.upload_dir_contents( |
| 325 gs_utils.GSUtils().upload_dir_contents( | 335 LOCAL_PLAYBACK_ROOT_DIR, dest_dir_name, |
| 326 LOCAL_PLAYBACK_ROOT_DIR, gs_bucket, dest_dir_name, | |
| 327 upload_if=gs_utils.GSUtils.UploadIf.IF_MODIFIED, | 336 upload_if=gs_utils.GSUtils.UploadIf.IF_MODIFIED, |
| 328 predefined_acl=GS_PREDEFINED_ACL, | 337 predefined_acl=GS_PREDEFINED_ACL, |
| 329 fine_grained_acl_list=GS_FINE_GRAINED_ACL_LIST) | 338 fine_grained_acl_list=GS_FINE_GRAINED_ACL_LIST) |
| 330 | 339 |
| 331 print '\n\n=======New SKPs have been uploaded to %s =======\n\n' % ( | 340 print '\n\n=======New SKPs have been uploaded to %s =======\n\n' % ( |
| 332 posixpath.join(self._dest_gsbase, dest_dir_name, SKPICTURES_DIR_NAME)) | 341 posixpath.join(self.gs.target_name(), dest_dir_name, |
| 342 SKPICTURES_DIR_NAME)) |
| 333 else: | 343 else: |
| 334 print '\n\n=======Not Uploading to Google Storage=======\n\n' | 344 print '\n\n=======Not Uploading to %s=======\n\n' % self.gs.target_type() |
| 335 print 'Generated resources are available in %s\n\n' % ( | 345 print 'Generated resources are available in %s\n\n' % ( |
| 336 LOCAL_PLAYBACK_ROOT_DIR) | 346 LOCAL_PLAYBACK_ROOT_DIR) |
| 337 | 347 |
| 338 return 0 | 348 return 0 |
| 339 | 349 |
| 340 def _RenameSkpFiles(self, page_set): | 350 def _RenameSkpFiles(self, page_set): |
| 341 """Rename generated SKP files into more descriptive names. | 351 """Rename generated SKP files into more descriptive names. |
| 342 | 352 |
| 343 Look into the subdirectory of TMP_SKP_DIR and find the most interesting | 353 Look into the subdirectory of TMP_SKP_DIR and find the most interesting |
| 344 .skp in there to be this page_set's representative .skp. | 354 .skp in there to be this page_set's representative .skp. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 shutil.rmtree(d) | 386 shutil.rmtree(d) |
| 377 os.makedirs(d) | 387 os.makedirs(d) |
| 378 | 388 |
| 379 def _DownloadWebpagesArchive(self, wpr_data_file, page_set_json_name): | 389 def _DownloadWebpagesArchive(self, wpr_data_file, page_set_json_name): |
| 380 """Downloads the webpages archive and its required page set from GS.""" | 390 """Downloads the webpages archive and its required page set from GS.""" |
| 381 wpr_source = posixpath.join(ROOT_PLAYBACK_DIR_NAME, 'webpages_archive', | 391 wpr_source = posixpath.join(ROOT_PLAYBACK_DIR_NAME, 'webpages_archive', |
| 382 wpr_data_file) | 392 wpr_data_file) |
| 383 page_set_source = posixpath.join(ROOT_PLAYBACK_DIR_NAME, | 393 page_set_source = posixpath.join(ROOT_PLAYBACK_DIR_NAME, |
| 384 'webpages_archive', | 394 'webpages_archive', |
| 385 page_set_json_name) | 395 page_set_json_name) |
| 386 gs = gs_utils.GSUtils() | 396 gs = self.gs |
| 387 gs_bucket = remove_prefix(self._dest_gsbase.lstrip(), gs_utils.GS_PREFIX) | 397 if (gs.does_storage_object_exist(wpr_source) and |
| 388 if (gs.does_storage_object_exist(gs_bucket, wpr_source) and | 398 gs.does_storage_object_exist(page_set_source)): |
| 389 gs.does_storage_object_exist(gs_bucket, page_set_source)): | 399 gs.download_file(wpr_source, |
| 390 gs.download_file(gs_bucket, wpr_source, | |
| 391 os.path.join(LOCAL_REPLAY_WEBPAGES_ARCHIVE_DIR, | 400 os.path.join(LOCAL_REPLAY_WEBPAGES_ARCHIVE_DIR, |
| 392 wpr_data_file)) | 401 wpr_data_file)) |
| 393 gs.download_file(gs_bucket, page_set_source, | 402 gs.download_file(page_set_source, |
| 394 os.path.join(LOCAL_REPLAY_WEBPAGES_ARCHIVE_DIR, | 403 os.path.join(LOCAL_REPLAY_WEBPAGES_ARCHIVE_DIR, |
| 395 page_set_json_name)) | 404 page_set_json_name)) |
| 396 else: | 405 else: |
| 397 raise Exception('%s and %s do not exist in Google Storage!' % ( | 406 raise Exception('%s and %s do not exist in %s!' % (gs.target_type(), |
| 398 wpr_source, page_set_source)) | 407 wpr_source, page_set_source)) |
| 399 | 408 |
| 409 class DataStore: |
| 410 """An abstract base class for uploading recordings to a data storage. |
| 411 The interface emulates the google storage api.""" |
| 412 def target_name(self): |
| 413 raise NotImplementedError() |
| 414 def target_type(self): |
| 415 raise NotImplementedError() |
| 416 def does_storage_object_exist(self, *args): |
| 417 raise NotImplementedError() |
| 418 def download_file(self, *args): |
| 419 raise NotImplementedError() |
| 420 def upload_dir_contents(self, source_dir, **kwargs): |
| 421 raise NotImplementedError() |
| 422 |
| 423 class GoogleStorageDataStore(DataStore): |
| 424 def __init__(self, data_store_url): |
| 425 self._data_store_url = data_store_url |
| 426 self._bucket = remove_prefix(self._data_store_url.lstrip(), |
| 427 gs_utils.GS_PREFIX) |
| 428 self.gs = gs_utils.GSUtils() |
| 429 def target_name(self): |
| 430 return self._data_store_url |
| 431 def target_type(self): |
| 432 return 'Google Storage' |
| 433 def does_storage_object_exist(self, *args): |
| 434 return self.gs.does_storage_object_exist(self._bucket, *args) |
| 435 def download_file(self, *args): |
| 436 self.gs.download_file(self._bucket, *args) |
| 437 def upload_dir_contents(self, source_dir, **kwargs): |
| 438 self.gs.upload_dir_contents(source_dir, self._bucket, **kwargs) |
| 439 |
| 440 class LocalFileSystemDataStore(DataStore): |
| 441 def __init__(self, data_store_location): |
| 442 self._base_dir = data_store_location |
| 443 def target_name(self): |
| 444 return self._base_dir |
| 445 def target_type(self): |
| 446 return self._base_dir |
| 447 def does_storage_object_exist(self, name, *args): |
| 448 return os.path.isfile(os.path.join(self._base_dir, name)) |
| 449 def download_file(self, name, local_path, *args): |
| 450 shutil.copyfile(os.path.join(self._base_dir, name), local_path) |
| 451 def upload_dir_contents(self, source_dir, dest_dir, **kwargs): |
| 452 def copytree(source_dir, dest_dir): |
| 453 if not os.path.exists(dest_dir): |
| 454 os.makedirs(dest_dir) |
| 455 for item in os.listdir(source_dir): |
| 456 source = os.path.join(source_dir, item) |
| 457 dest = os.path.join(dest_dir, item) |
| 458 if os.path.isdir(source): |
| 459 copytree(source, dest) |
| 460 else: |
| 461 shutil.copy2(source, dest) |
| 462 copytree(source_dir, os.path.join(self._base_dir, dest_dir)) |
| 400 | 463 |
| 401 if '__main__' == __name__: | 464 if '__main__' == __name__: |
| 402 option_parser = optparse.OptionParser() | 465 option_parser = optparse.OptionParser() |
| 403 option_parser.add_option( | 466 option_parser.add_option( |
| 404 '', '--page_sets', | 467 '', '--page_sets', |
| 405 help='Specifies the page sets to use to archive. Supports globs.', | 468 help='Specifies the page sets to use to archive. Supports globs.', |
| 406 default='all') | 469 default='all') |
| 407 option_parser.add_option( | 470 option_parser.add_option( |
| 408 '', '--skip_all_gs_access', action='store_true', | |
| 409 help='All Google Storage interactions will be skipped if this flag is ' | |
| 410 'specified. This is useful for cases where the user does not have ' | |
| 411 'the required .boto file but would like to generate webpage ' | |
| 412 'archives and SKPs from the Skia page sets.', | |
| 413 default=False) | |
| 414 option_parser.add_option( | |
| 415 '', '--record', action='store_true', | 471 '', '--record', action='store_true', |
| 416 help='Specifies whether a new website archive should be created.', | 472 help='Specifies whether a new website archive should be created.', |
| 417 default=False) | 473 default=False) |
| 418 option_parser.add_option( | 474 option_parser.add_option( |
| 419 '', '--dest_gsbase', | |
| 420 help='gs:// bucket_name, the bucket to upload the file to.', | |
| 421 default='gs://chromium-skia-gm') | |
| 422 option_parser.add_option( | |
| 423 '', '--skia_tools', | 475 '', '--skia_tools', |
| 424 help=('Path to compiled Skia executable tools. ' | 476 help=('Path to compiled Skia executable tools. ' |
| 425 'render_pictures/render_pdfs is run on the set ' | 477 'render_pictures/render_pdfs is run on the set ' |
| 426 'after all SKPs are captured. If the script is run without ' | 478 'after all SKPs are captured. If the script is run without ' |
| 427 '--non-interactive then the debugger is also run at the end. Debug ' | 479 '--non-interactive then the debugger is also run at the end. Debug ' |
| 428 'builds are recommended because they seem to catch more failures ' | 480 'builds are recommended because they seem to catch more failures ' |
| 429 'than Release builds.'), | 481 'than Release builds.'), |
| 430 default=None) | 482 default=None) |
| 431 option_parser.add_option( | 483 option_parser.add_option( |
| 432 '', '--upload_to_gs', action='store_true', | 484 '', '--upload', action='store_true', |
| 433 help='Does not upload to Google Storage if this is False.', | 485 help=('Uploads to Google Storage or copies to local filesystem storage ' |
| 486 ' if this is True.'), |
| 434 default=False) | 487 default=False) |
| 435 option_parser.add_option( | 488 option_parser.add_option( |
| 489 '', '--data_store', |
| 490 help=('The location of the file storage to use to download and upload ' |
| 491 'files. Can be \'gs://<bucket>\' for Google Storage, or ' |
| 492 'a directory for local filesystem storage'), |
| 493 default='gs://chromium-skia-gm') |
| 494 option_parser.add_option( |
| 436 '', '--alternate_upload_dir', | 495 '', '--alternate_upload_dir', |
| 437 help='Uploads to a different directory in Google Storage if this flag is ' | 496 help= ('Uploads to a different directory in Google Storage or local ' |
| 438 'specified', | 497 'storage if this flag is specified'), |
| 439 default=None) | 498 default=None) |
| 440 option_parser.add_option( | 499 option_parser.add_option( |
| 441 '', '--output_dir', | 500 '', '--output_dir', |
| 442 help='Directory where SKPs and webpage archives will be outputted to.', | 501 help=('Temporary directory where SKPs and webpage archives will be ' |
| 502 'outputted to.'), |
| 443 default=tempfile.gettempdir()) | 503 default=tempfile.gettempdir()) |
| 444 option_parser.add_option( | 504 option_parser.add_option( |
| 445 '', '--browser_executable', | 505 '', '--browser_executable', |
| 446 help='The exact browser executable to run.', | 506 help='The exact browser executable to run.', |
| 447 default=None) | 507 default=None) |
| 448 option_parser.add_option( | 508 option_parser.add_option( |
| 449 '', '--chrome_src_path', | 509 '', '--chrome_src_path', |
| 450 help='Path to the chromium src directory.', | 510 help='Path to the chromium src directory.', |
| 451 default=None) | 511 default=None) |
| 452 option_parser.add_option( | 512 option_parser.add_option( |
| 453 '', '--non-interactive', action='store_true', | 513 '', '--non-interactive', action='store_true', |
| 454 help='Runs the script without any prompts. If this flag is specified and ' | 514 help='Runs the script without any prompts. If this flag is specified and ' |
| 455 '--skia_tools is specified then the debugger is not run.', | 515 '--skia_tools is specified then the debugger is not run.', |
| 456 default=False) | 516 default=False) |
| 457 options, unused_args = option_parser.parse_args() | 517 options, unused_args = option_parser.parse_args() |
| 458 | 518 |
| 459 playback = SkPicturePlayback(options) | 519 playback = SkPicturePlayback(options) |
| 460 sys.exit(playback.Run()) | 520 sys.exit(playback.Run()) |
| OLD | NEW |