| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Script that helps run the fuzzer locally and in ClusterFuzz. | 5 """Script that helps run the fuzzer locally and in ClusterFuzz. |
| 6 | 6 |
| 7 To prepare to run the fuzzer locally, this script copies the necessary | 7 To prepare to run the fuzzer locally, this script copies the necessary |
| 8 resources. | 8 resources. |
| 9 | 9 |
| 10 To prepare to run the fuzzer in ClusterFuzz this script generates two zip | 10 To prepare to run the fuzzer in ClusterFuzz this script generates two zip |
| 11 files: web_bluetooth_fuzzer.tar.bz2. This zip file can then be directly | 11 files: web_bluetooth_fuzzer.tar.bz2. This zip file can then be directly |
| 12 uploaded to ClusterFuzz. | 12 uploaded to ClusterFuzz. |
| 13 """ | 13 """ |
| 14 | 14 |
| 15 import argparse | 15 import argparse |
| 16 import glob | 16 import glob |
| 17 import os | 17 import os |
| 18 import shutil | 18 import shutil |
| 19 import sys | 19 import sys |
| 20 | 20 |
| 21 # src path from this file's path. | 21 # src path from this file's path. |
| 22 SRC_PATH = os.path.join( | 22 SRC_PATH = os.path.join( |
| 23 os.pardir, os.pardir, os.pardir, os.pardir, os.pardir, os.pardir, os.pardir) | 23 os.pardir, os.pardir, os.pardir, os.pardir, os.pardir, os.pardir, os.pardir) |
| 24 LAYOUT_TESTS_RESOURCES_PATH = os.path.join( | 24 LAYOUT_TESTS_RESOURCES_PATH = os.path.join( |
| 25 SRC_PATH, 'third_party', 'WebKit', 'LayoutTests', 'resources') | 25 SRC_PATH, 'third_party', 'WebKit', 'LayoutTests', 'resources') |
| 26 COMMON_FUZZER_RESOURCES_PATH = os.path.join( |
| 27 SRC_PATH, 'testing', 'clusterfuzz', 'common') |
| 26 RESOURCES = [ | 28 RESOURCES = [ |
| 27 os.path.join(LAYOUT_TESTS_RESOURCES_PATH, 'testharness.js'), | 29 os.path.join(LAYOUT_TESTS_RESOURCES_PATH, 'testharness.js'), |
| 28 os.path.join(LAYOUT_TESTS_RESOURCES_PATH, 'testharnessreport.js'), | 30 os.path.join(LAYOUT_TESTS_RESOURCES_PATH, 'testharnessreport.js'), |
| 29 os.path.join(LAYOUT_TESTS_RESOURCES_PATH, 'bluetooth', | 31 os.path.join(LAYOUT_TESTS_RESOURCES_PATH, 'bluetooth', |
| 30 'bluetooth-helpers.js'), | 32 'bluetooth-helpers.js'), |
| 33 os.path.join(COMMON_FUZZER_RESOURCES_PATH, 'fuzzy_types.py'), |
| 34 os.path.join(COMMON_FUZZER_RESOURCES_PATH, 'utils.py'), |
| 35 os.path.join(COMMON_FUZZER_RESOURCES_PATH, '__init__.py'), |
| 31 ] | 36 ] |
| 32 | 37 |
| 33 | 38 |
| 34 def _GetCurrentPath(): | 39 def _GetCurrentPath(): |
| 35 """Returns this file's directory path""" | 40 """Returns this file's directory path""" |
| 36 return os.path.dirname(os.path.realpath(__file__)) | 41 return os.path.dirname(os.path.realpath(__file__)) |
| 37 | 42 |
| 38 | 43 |
| 39 def RetrieveResources(): | 44 def RetrieveResources(): |
| 40 # Create resources directory if it doesn't exist. Clear it otherwise. | 45 # Create resources directory if it doesn't exist. Clear it otherwise. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 'web_bluetooth_fuzzer') | 100 'web_bluetooth_fuzzer') |
| 96 shutil.make_archive( | 101 shutil.make_archive( |
| 97 compressed_file_path, | 102 compressed_file_path, |
| 98 format='bztar', | 103 format='bztar', |
| 99 root_dir=os.path.join(current_path, os.pardir), | 104 root_dir=os.path.join(current_path, os.pardir), |
| 100 base_dir='web_bluetooth_fuzzer') | 105 base_dir='web_bluetooth_fuzzer') |
| 101 print 'File wrote to: ' + compressed_file_path + '.tar.bz2' | 106 print 'File wrote to: ' + compressed_file_path + '.tar.bz2' |
| 102 | 107 |
| 103 if __name__ == '__main__': | 108 if __name__ == '__main__': |
| 104 sys.exit(main()) | 109 sys.exit(main()) |
| OLD | NEW |