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
3 # found in the LICENSE file.
7 from testrunner.local import commands
8 from testrunner.local import testsuite
9 from testrunner.local import utils
10 from testrunner.objects import testcase
12 class FuzzNativesTestSuite(testsuite.TestSuite):
14 def __init__(self, name, root):
15 super(FuzzNativesTestSuite, self).__init__(name, root)
17 def ListTests(self, context):
18 shell = os.path.abspath(os.path.join(context.shell_dir, self.shell()))
21 output = commands.Execute(
22 context.command_prefix +
23 [shell, "--allow-natives-syntax", "--simd-object", "-e",
24 "try { var natives = %ListNatives();"
25 " for (var n in natives) { print(natives[n]); }"
28 if output.exit_code != 0:
31 assert False, "Failed to get natives list."
33 for line in output.stdout.strip().split():
35 (name, argc) = line.split(",")
36 flags = ["--allow-natives-syntax", "--simd-object",
37 "-e", "var NAME = '%s', ARGC = %s;" % (name, argc)]
38 test = testcase.TestCase(self, name, flags)
41 # Work-around: If parsing didn't work, it might have been due to output
42 # caused by other d8 flags.
46 def GetFlagsForTestCase(self, testcase, context):
48 basefile = os.path.join(self.root, "base.js")
49 return testcase.flags + [basefile] + context.mode_flags
51 def GetSuite(name, root):
52 return FuzzNativesTestSuite(name, root)