OLD | NEW |
1 # Copyright 2014 the V8 project authors. All rights reserved. | 1 # Copyright 2014 the V8 project authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import os | 5 import os |
6 | 6 |
7 from testrunner.local import commands | 7 from testrunner.local import commands |
8 from testrunner.local import testsuite | 8 from testrunner.local import testsuite |
9 from testrunner.local import utils | 9 from testrunner.local import utils |
10 from testrunner.objects import testcase | 10 from testrunner.objects import testcase |
(...skipping 10 matching lines...) Expand all Loading... |
21 output = commands.Execute( | 21 output = commands.Execute( |
22 context.command_prefix + | 22 context.command_prefix + |
23 [shell, "--allow-natives-syntax", "-e", | 23 [shell, "--allow-natives-syntax", "-e", |
24 "try { var natives = %ListNatives();" | 24 "try { var natives = %ListNatives();" |
25 " for (var n in natives) { print(natives[n]); }" | 25 " for (var n in natives) { print(natives[n]); }" |
26 "} catch(e) {}"] + | 26 "} catch(e) {}"] + |
27 context.extra_flags) | 27 context.extra_flags) |
28 if output.exit_code != 0: | 28 if output.exit_code != 0: |
29 print output.stdout | 29 print output.stdout |
30 print output.stderr | 30 print output.stderr |
31 assert false, "Failed to get natives list." | 31 assert False, "Failed to get natives list." |
32 tests = [] | 32 tests = [] |
33 for line in output.stdout.strip().split(): | 33 for line in output.stdout.strip().split(): |
34 (name, argc) = line.split(",") | 34 (name, argc) = line.split(",") |
35 flags = ["--allow-natives-syntax", | 35 flags = ["--allow-natives-syntax", |
36 "-e", "var NAME = '%s', ARGC = %s;" % (name, argc)] | 36 "-e", "var NAME = '%s', ARGC = %s;" % (name, argc)] |
37 test = testcase.TestCase(self, name, flags) | 37 test = testcase.TestCase(self, name, flags) |
38 tests.append(test) | 38 tests.append(test) |
39 return tests | 39 return tests |
40 | 40 |
41 def GetFlagsForTestCase(self, testcase, context): | 41 def GetFlagsForTestCase(self, testcase, context): |
42 name = testcase.path | 42 name = testcase.path |
43 basefile = os.path.join(self.root, "base.js") | 43 basefile = os.path.join(self.root, "base.js") |
44 return testcase.flags + [basefile] + context.mode_flags | 44 return testcase.flags + [basefile] + context.mode_flags |
45 | 45 |
46 def GetSuite(name, root): | 46 def GetSuite(name, root): |
47 return FuzzNativesTestSuite(name, root) | 47 return FuzzNativesTestSuite(name, root) |
OLD | NEW |