Chromium Code Reviews| Index: test/fuzz-natives/testcfg.py |
| diff --git a/test/fuzz-natives/testcfg.py b/test/fuzz-natives/testcfg.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..58c06203e5a29f55ed9563e64413f1e8f2f6ded2 |
| --- /dev/null |
| +++ b/test/fuzz-natives/testcfg.py |
| @@ -0,0 +1,47 @@ |
| +# Copyright 2014 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. |
| + |
| +import os |
| + |
| +from testrunner.local import commands |
| +from testrunner.local import testsuite |
| +from testrunner.local import utils |
| +from testrunner.objects import testcase |
| + |
| +class FuzzNativesTestSuite(testsuite.TestSuite): |
| + |
| + def __init__(self, name, root): |
| + super(FuzzNativesTestSuite, self).__init__(name, root) |
| + |
| + def ListTests(self, context): |
| + shell = os.path.abspath(os.path.join(context.shell_dir, self.shell())) |
| + if utils.IsWindows(): |
| + shell += ".exe" |
| + output = commands.Execute( |
| + context.command_prefix + |
| + [shell, "--allow-natives-syntax", "-e", |
| + "try { var natives = %ListNatives();" |
| + " for (var n in natives) { print(natives[n]); }" |
| + "} catch(e) {}"] + |
| + context.extra_flags) |
| + if output.exit_code != 0: |
|
Michael Achenbach
2014/04/29 15:51:53
If the command fails, the test driver would rather
Jakob Kummerow
2014/04/30 13:46:12
%ListNatives() isn't available in Release; the try
|
| + print output.stdout |
| + print output.stderr |
| + return [] |
| + tests = [] |
| + for line in output.stdout.strip().split(): |
| + (name, argc) = line.split(",") |
| + flags = ["--allow-natives-syntax", |
| + "-e", "var NAME = '%s', ARGC = %s;" % (name, argc)] |
| + test = testcase.TestCase(self, name, flags) |
| + tests.append(test) |
| + return tests |
| + |
| + def GetFlagsForTestCase(self, testcase, context): |
| + name = testcase.path |
| + basefile = os.path.join(self.root, "base.js") |
| + return testcase.flags + [basefile] + context.mode_flags |
| + |
| +def GetSuite(name, root): |
| + return FuzzNativesTestSuite(name, root) |