OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/python | |
2 # Copyright 2015 the V8 project authors. All rights reserved. | |
3 # Use of this source code is governed by a BSD-style license that can be | |
4 # found in the LICENSE file. | |
5 | |
6 # Script to re-generate SimdJs.json from a SimdJs.json.template. | |
7 | |
8 import os | |
9 import re | |
10 | |
11 SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__)) | |
12 | |
Michael Achenbach
2015/05/20 10:33:17
I'm rubber-stamping this. Instead of a string, a p
bradn
2015/05/20 11:30:05
Yeah I almost did that.
Switching.
| |
13 HEADER = """\ | |
14 { | |
15 "name": "SIMDJS", | |
16 "run_count": 5, | |
17 "units": "ms", | |
18 "total": true, | |
19 "resources": [ | |
20 %(files)s | |
21 "test/simdjs/data/src/benchmarks/base.js", | |
22 "test/simdjs/data/src/ecmascript_simd.js" | |
23 ], | |
24 "flags": ["--harmony-object", "test/simdjs/harness-adapt.js"], | |
25 "path": ["../../"], | |
26 "tests": [ | |
27 """ | |
28 | |
29 TEST_ITEM = """\ | |
30 { | |
31 "name": "%(name)s", | |
32 "main": "test/simdjs/harness-finish.js", | |
33 "flags": ["test/simdjs/data/src/benchmarks/%(name)s.js"], | |
34 "results_regexp": "%%s\\\\([ ]*([0-9.]+)(ms)?\\\\)", | |
35 "tests": [ | |
36 {"name": "SIMD"}, | |
37 {"name": "Non-SIMD"}, | |
38 {"name": "Speedup", "units": "score"}, | |
39 {"name": "Iterations", "units": "count"} | |
40 ] | |
41 }""" | |
42 | |
43 FOOTER = """\ | |
44 ] | |
45 } | |
46 """ | |
47 | |
48 run_js = open( | |
49 os.path.join(SCRIPT_DIR, 'data', 'src', 'benchmarks', 'run.js')).read() | |
50 | |
51 tests = re.findall("load \\(\\'([^']+)[.]js\\'\\)", run_js) | |
52 | |
53 SKIP_FILES = [ | |
54 '../ecmascript_simd', | |
55 'base', | |
56 # TODO(bradnelson): Drop these when tests are fixed upstream. | |
57 'aobench', | |
58 'averageFloat32x4Load', | |
59 'matrix-multiplication-load', | |
60 ] | |
61 | |
62 tests = [t for t in tests if t not in SKIP_FILES] | |
63 | |
64 header = HEADER % { | |
65 'files': '\n'.join( | |
66 [' "test/simdjs/data/src/benchmarks/%s.js",' % t for t in tests]) | |
67 } | |
68 test_list = ',\n'.join([TEST_ITEM % {'name': t} for t in tests]) + '\n' | |
69 | |
70 data = header + test_list + FOOTER | |
71 | |
72 with open(os.path.join(SCRIPT_DIR, 'SimdJS.json'), 'w') as fh: | |
73 fh.write(data) | |
OLD | NEW |