OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 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 """Creates IPC fuzzer packages suitable for uploading to ClusterFuzz. Stores | 6 """Creates IPC fuzzer packages suitable for uploading to ClusterFuzz. Stores |
7 the packages into chrome build directory. See fuzzer_list below for the list of | 7 the packages into chrome build directory. See fuzzer_list below for the list of |
8 fuzzers. | 8 fuzzers. |
9 """ | 9 """ |
10 | 10 |
11 import argparse | 11 import argparse |
12 import distutils.archive_util | 12 import distutils.archive_util |
13 import os | 13 import os |
14 import shutil | 14 import shutil |
15 import sys | 15 import sys |
16 import tempfile | 16 import tempfile |
17 | 17 |
| 18 FUZZER_LIST = [ |
| 19 'ipc_fuzzer_mut', |
| 20 'ipc_fuzzer_gen', |
| 21 ] |
| 22 |
| 23 def GetPlatform(): |
| 24 platform = None |
| 25 if sys.platform.startswith('win'): |
| 26 platform = 'WINDOWS' |
| 27 elif sys.platform.startswith('linux'): |
| 28 platform = 'LINUX' |
| 29 elif sys.platform == 'darwin': |
| 30 platform = 'MAC' |
| 31 |
| 32 assert platform is not None |
| 33 return platform |
| 34 |
18 class CFPackageBuilder: | 35 class CFPackageBuilder: |
19 def __init__(self): | 36 def __init__(self): |
20 self.fuzzer_list = [ | 37 self.platform = GetPlatform() |
21 'ipc_fuzzer_mut', | 38 if self.platform == 'WINDOWS': |
22 'ipc_fuzzer_gen', | 39 self.fuzzer_list = [i + '.exe' for i in FUZZER_LIST] |
23 ] | 40 else: |
| 41 self.fuzzer_list = FUZZER_LIST |
24 | 42 |
25 def parse_args(self): | 43 def parse_args(self): |
26 desc = 'Builder of IPC fuzzer packages for ClusterFuzz' | 44 desc = 'Builder of IPC fuzzer packages for ClusterFuzz' |
27 parser = argparse.ArgumentParser(description=desc) | 45 parser = argparse.ArgumentParser(description=desc) |
28 parser.add_argument('--out-dir', dest='out_dir', default='out', | 46 parser.add_argument('--out-dir', dest='out_dir', default='out', |
29 help='output directory under src/ directory') | 47 help='output directory under src/ directory') |
30 parser.add_argument('--build-type', dest='build_type', default='Release', | 48 parser.add_argument('--build-type', dest='build_type', default='Release', |
31 help='Debug vs. Release build') | 49 help='Debug vs. Release build') |
32 self.args = parser.parse_args() | 50 self.args = parser.parse_args() |
33 | 51 |
(...skipping 30 matching lines...) Expand all Loading... |
64 self.get_paths() | 82 self.get_paths() |
65 self.enter_tmp_workdir() | 83 self.enter_tmp_workdir() |
66 for fuzzer in self.fuzzer_list: | 84 for fuzzer in self.fuzzer_list: |
67 self.build_package(fuzzer) | 85 self.build_package(fuzzer) |
68 self.rm_tmp_workdir() | 86 self.rm_tmp_workdir() |
69 return 0 | 87 return 0 |
70 | 88 |
71 if __name__ == "__main__": | 89 if __name__ == "__main__": |
72 builder = CFPackageBuilder() | 90 builder = CFPackageBuilder() |
73 sys.exit(builder.main()) | 91 sys.exit(builder.main()) |
OLD | NEW |