|
12 | 12 | import sys |
13 | 13 | import hashlib |
14 | 14 |
|
15 | | - |
16 | 15 | def main(): |
17 | 16 | parser = argparse.ArgumentParser() |
18 | 17 |
|
19 | 18 | parser.add_argument( |
20 | 19 | '--input', dest='file_path', action='store', required=True) |
| 20 | + parser.add_argument( |
| 21 | + '--clang-cpu', dest='clang_cpu', action='store', required=True) |
21 | 22 |
|
22 | 23 | args = parser.parse_args() |
23 | 24 |
|
24 | | - files = open(args.file_path, 'r') |
25 | | - lines = files.read().split() |
| 25 | + with open(args.file_path) as f: |
| 26 | + data = json.load(f) |
26 | 27 |
|
27 | 28 | output = {} |
28 | | - |
29 | | - for line in lines: |
30 | | - key, val = line.strip().split('=') |
31 | | - md5 = hashlib.md5(key.encode()).hexdigest() |
32 | | - hash_key = 'md5_%s' % md5 |
33 | | - # Uncomment this line to get the hash keys |
34 | | - # print val, hash_key |
35 | | - output[hash_key] = os.path.dirname(val) |
| 29 | + target = args.clang_cpu + '-fuchsia' |
| 30 | + |
| 31 | + for d in data: |
| 32 | + if target in d['target']: |
| 33 | + for runtime in d['runtime']: |
| 34 | + # key contains the soname and the cflags used to compile it. |
| 35 | + # this allows us to distinguish between different sanitizers |
| 36 | + # and experiments |
| 37 | + key = runtime['soname'] + ''.join(d['cflags']) |
| 38 | + md5 = hashlib.md5(key.encode()).hexdigest() |
| 39 | + hash_key = 'md5_%s' % md5 |
| 40 | + # Uncomment this line to get the hash keys |
| 41 | + # print runtime['dist'], d['cflags'], hash_key |
| 42 | + output[hash_key] = os.path.dirname(runtime['dist']) |
36 | 43 |
|
37 | 44 | print(json.dumps(output)) |
38 | 45 |
|
|
0 commit comments