Index: test/simdjs/generate.py |
diff --git a/test/simdjs/generate.py b/test/simdjs/generate.py |
new file mode 100755 |
index 0000000000000000000000000000000000000000..e48203fd78330fbebd0f6f342feb04ac9fa91fa8 |
--- /dev/null |
+++ b/test/simdjs/generate.py |
@@ -0,0 +1,73 @@ |
+#!/usr/bin/python |
+# Copyright 2015 the V8 project authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+# Script to re-generate SimdJs.json from a SimdJs.json.template. |
+ |
+import os |
+import re |
+ |
+SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__)) |
+ |
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.
|
+HEADER = """\ |
+{ |
+ "name": "SIMDJS", |
+ "run_count": 5, |
+ "units": "ms", |
+ "total": true, |
+ "resources": [ |
+%(files)s |
+ "test/simdjs/data/src/benchmarks/base.js", |
+ "test/simdjs/data/src/ecmascript_simd.js" |
+ ], |
+ "flags": ["--harmony-object", "test/simdjs/harness-adapt.js"], |
+ "path": ["../../"], |
+ "tests": [ |
+""" |
+ |
+TEST_ITEM = """\ |
+ { |
+ "name": "%(name)s", |
+ "main": "test/simdjs/harness-finish.js", |
+ "flags": ["test/simdjs/data/src/benchmarks/%(name)s.js"], |
+ "results_regexp": "%%s\\\\([ ]*([0-9.]+)(ms)?\\\\)", |
+ "tests": [ |
+ {"name": "SIMD"}, |
+ {"name": "Non-SIMD"}, |
+ {"name": "Speedup", "units": "score"}, |
+ {"name": "Iterations", "units": "count"} |
+ ] |
+ }""" |
+ |
+FOOTER = """\ |
+ ] |
+} |
+""" |
+ |
+run_js = open( |
+ os.path.join(SCRIPT_DIR, 'data', 'src', 'benchmarks', 'run.js')).read() |
+ |
+tests = re.findall("load \\(\\'([^']+)[.]js\\'\\)", run_js) |
+ |
+SKIP_FILES = [ |
+ '../ecmascript_simd', |
+ 'base', |
+ # TODO(bradnelson): Drop these when tests are fixed upstream. |
+ 'aobench', |
+ 'averageFloat32x4Load', |
+ 'matrix-multiplication-load', |
+] |
+ |
+tests = [t for t in tests if t not in SKIP_FILES] |
+ |
+header = HEADER % { |
+ 'files': '\n'.join( |
+ [' "test/simdjs/data/src/benchmarks/%s.js",' % t for t in tests]) |
+} |
+test_list = ',\n'.join([TEST_ITEM % {'name': t} for t in tests]) + '\n' |
+ |
+data = header + test_list + FOOTER |
+ |
+with open(os.path.join(SCRIPT_DIR, 'SimdJS.json'), 'w') as fh: |
+ fh.write(data) |