| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 the V8 project authors. All rights reserved. | 2 # Copyright 2014 the V8 project 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 import itertools | 6 import itertools |
| 7 import js2c | 7 import js2c |
| 8 import multiprocessing | 8 import multiprocessing |
| 9 import optparse | 9 import optparse |
| 10 import os | 10 import os |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 "InternalNumberParse": [_NUMBER_FORMAT, None, None], | 241 "InternalNumberParse": [_NUMBER_FORMAT, None, None], |
| 242 "IsSloppyModeFunction": ["function() {}", None], | 242 "IsSloppyModeFunction": ["function() {}", None], |
| 243 "LoadMutableDouble": ["{foo: 1.2}", None, None], | 243 "LoadMutableDouble": ["{foo: 1.2}", None, None], |
| 244 "NewObjectFromBound": ["(function() {}).bind({})", None], | 244 "NewObjectFromBound": ["(function() {}).bind({})", None], |
| 245 "NumberToRadixString": [None, "2", None], | 245 "NumberToRadixString": [None, "2", None], |
| 246 "ParseJson": ["\"{}\"", 1], | 246 "ParseJson": ["\"{}\"", 1], |
| 247 "RegExpExecMultiple": [None, None, "['a']", "['a']", None], | 247 "RegExpExecMultiple": [None, None, "['a']", "['a']", None], |
| 248 "DefineApiAccessorProperty": [None, None, "undefined", "undefined", None, None
], | 248 "DefineApiAccessorProperty": [None, None, "undefined", "undefined", None, None
], |
| 249 "SetIteratorInitialize": [None, None, "2", None], | 249 "SetIteratorInitialize": [None, None, "2", None], |
| 250 "SetDebugEventListener": ["undefined", None, None], | 250 "SetDebugEventListener": ["undefined", None, None], |
| 251 "SetFunctionBreakPoint": [None, 200, None, None], | 251 "SetFunctionBreakPoint": [None, 218, None, None], |
| 252 "StringBuilderConcat": ["[1, 2, 3]", 3, None, None], | 252 "StringBuilderConcat": ["[1, 2, 3]", 3, None, None], |
| 253 "StringBuilderJoin": ["['a', 'b']", 4, None, None], | 253 "StringBuilderJoin": ["['a', 'b']", 4, None, None], |
| 254 "StringMatch": [None, None, "['a', 'b']", None], | 254 "StringMatch": [None, None, "['a', 'b']", None], |
| 255 "StringNormalize": [None, 2, None], | 255 "StringNormalize": [None, 2, None], |
| 256 "StringReplaceGlobalRegExpWithString": [None, None, None, "['a']", None], | 256 "StringReplaceGlobalRegExpWithString": [None, None, None, "['a']", None], |
| 257 "TypedArrayInitialize": [None, 6, "new ArrayBuffer(8)", None, 4, None], | 257 "TypedArrayInitialize": [None, 6, "new ArrayBuffer(8)", None, 4, None], |
| 258 "TypedArrayInitializeFromArrayLike": [None, 6, None, None, None], | 258 "TypedArrayInitializeFromArrayLike": [None, 6, None, None, None], |
| 259 "TypedArraySetFastCases": [None, None, "0", None], | 259 "TypedArraySetFastCases": [None, None, "0", None], |
| 260 "FunctionIsArrow": ["() => null", None], | 260 "FunctionIsArrow": ["() => null", None], |
| 261 } | 261 } |
| (...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1125 arg = function.args[i] | 1125 arg = function.args[i] |
| 1126 name = arg.name | 1126 name = arg.name |
| 1127 definitions += generator.RandomVariable(name, arg.type, simple=True) | 1127 definitions += generator.RandomVariable(name, arg.type, simple=True) |
| 1128 argslist.append(name) | 1128 argslist.append(name) |
| 1129 return (definitions, argslist) | 1129 return (definitions, argslist) |
| 1130 | 1130 |
| 1131 | 1131 |
| 1132 def _GenerateTestcase(function, definitions, argslist, throws): | 1132 def _GenerateTestcase(function, definitions, argslist, throws): |
| 1133 s = ["// Copyright 2014 the V8 project authors. All rights reserved.", | 1133 s = ["// Copyright 2014 the V8 project authors. All rights reserved.", |
| 1134 "// AUTO-GENERATED BY tools/generate-runtime-tests.py, DO NOT MODIFY", | 1134 "// AUTO-GENERATED BY tools/generate-runtime-tests.py, DO NOT MODIFY", |
| 1135 "// Flags: --allow-natives-syntax --harmony"] + definitions | 1135 "// Flags: --allow-natives-syntax --harmony --harmony-proxies" |
| 1136 ] + definitions |
| 1136 call = "%%%s%s(%s);" % (function.inline, function.name, ", ".join(argslist)) | 1137 call = "%%%s%s(%s);" % (function.inline, function.name, ", ".join(argslist)) |
| 1137 if throws: | 1138 if throws: |
| 1138 s.append("try {") | 1139 s.append("try {") |
| 1139 s.append(call); | 1140 s.append(call); |
| 1140 s.append("} catch(e) {}") | 1141 s.append("} catch(e) {}") |
| 1141 else: | 1142 else: |
| 1142 s.append(call) | 1143 s.append(call) |
| 1143 testcase = "\n".join(s) | 1144 testcase = "\n".join(s) |
| 1144 return testcase | 1145 return testcase |
| 1145 | 1146 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1205 argname = "arg%d%s" % (i, arg.name) | 1206 argname = "arg%d%s" % (i, arg.name) |
| 1206 args.append(argname) | 1207 args.append(argname) |
| 1207 definitions += gen.RandomVariable(argname, arg.type, simple=False) | 1208 definitions += gen.RandomVariable(argname, arg.type, simple=False) |
| 1208 testcase = _GenerateTestcase(function, definitions, args, True) | 1209 testcase = _GenerateTestcase(function, definitions, args, True) |
| 1209 with open(test_file_name, "w") as f: | 1210 with open(test_file_name, "w") as f: |
| 1210 f.write("%s\n" % testcase) | 1211 f.write("%s\n" % testcase) |
| 1211 with open("/dev/null", "w") as devnull: | 1212 with open("/dev/null", "w") as devnull: |
| 1212 with open(stderr_file_name, "w") as stderr: | 1213 with open(stderr_file_name, "w") as stderr: |
| 1213 process = subprocess.Popen( | 1214 process = subprocess.Popen( |
| 1214 [options.binary, "--allow-natives-syntax", "--harmony", | 1215 [options.binary, "--allow-natives-syntax", "--harmony", |
| 1215 "--enable-slow-asserts", test_file_name], | 1216 "--harmony-proxies", "--enable-slow-asserts", test_file_name], |
| 1216 stdout=devnull, stderr=stderr) | 1217 stdout=devnull, stderr=stderr) |
| 1217 end_time = time.time() + options.timeout | 1218 end_time = time.time() + options.timeout |
| 1218 timed_out = False | 1219 timed_out = False |
| 1219 exit_code = None | 1220 exit_code = None |
| 1220 sleep_time = INITIAL_SLEEP_TIME | 1221 sleep_time = INITIAL_SLEEP_TIME |
| 1221 while exit_code is None: | 1222 while exit_code is None: |
| 1222 if time.time() >= end_time: | 1223 if time.time() >= end_time: |
| 1223 # Kill the process and wait for it to exit. | 1224 # Kill the process and wait for it to exit. |
| 1224 os.kill(process.pid, signal.SIGTERM) | 1225 os.kill(process.pid, signal.SIGTERM) |
| 1225 exit_code = process.wait() | 1226 exit_code = process.wait() |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1401 for i in range(len(processes)): | 1402 for i in range(len(processes)): |
| 1402 processes[i].join() | 1403 processes[i].join() |
| 1403 except KeyboardInterrupt: | 1404 except KeyboardInterrupt: |
| 1404 stop_running.set() | 1405 stop_running.set() |
| 1405 for i in range(len(processes)): | 1406 for i in range(len(processes)): |
| 1406 processes[i].join() | 1407 processes[i].join() |
| 1407 return 0 | 1408 return 0 |
| 1408 | 1409 |
| 1409 if __name__ == "__main__": | 1410 if __name__ == "__main__": |
| 1410 sys.exit(Main()) | 1411 sys.exit(Main()) |
| OLD | NEW |