Chromium Code Reviews| Index: test/blink/testcfg.py |
| diff --git a/test/mjsunit/testcfg.py b/test/blink/testcfg.py |
| similarity index 75% |
| copy from test/mjsunit/testcfg.py |
| copy to test/blink/testcfg.py |
| index c960ce6b30107e167ad4576f24d0e29594444fd8..57d4eb7a36c5893c7b39d0731578c92e1a3e21c6 100644 |
| --- a/test/mjsunit/testcfg.py |
| +++ b/test/blink/testcfg.py |
| @@ -1,4 +1,4 @@ |
| -# Copyright 2008 the V8 project authors. All rights reserved. |
| +# Copyright 2013 the V8 project authors. All rights reserved. |
| # Redistribution and use in source and binary forms, with or without |
| # modification, are permitted provided that the following conditions are |
| # met: |
| @@ -25,6 +25,7 @@ |
| # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| +import itertools |
| import os |
| import re |
| @@ -36,10 +37,11 @@ FILES_PATTERN = re.compile(r"//\s+Files:(.*)") |
| SELF_SCRIPT_PATTERN = re.compile(r"//\s+Env: TEST_FILE_NAME") |
| -class MjsunitTestSuite(testsuite.TestSuite): |
| +# TODO (machenbach): Share commonalities with mjstest. |
| +class BlinkTestSuite(testsuite.TestSuite): |
| def __init__(self, name, root): |
| - super(MjsunitTestSuite, self).__init__(name, root) |
| + super(BlinkTestSuite, self).__init__(name, root) |
| def ListTests(self, context): |
| tests = [] |
| @@ -49,7 +51,7 @@ class MjsunitTestSuite(testsuite.TestSuite): |
| dirs.sort() |
|
Jakob Kummerow
2013/06/17 14:22:52
I think you want to filter the "resources" directo
|
| files.sort() |
| for filename in files: |
| - if filename.endswith(".js") and filename != "mjsunit.js": |
| + if filename.endswith(".js"): |
| testname = os.path.join(dirname[len(self.root) + 1:], filename[:-3]) |
| test = testcase.TestCase(self, testname) |
| tests.append(test) |
| @@ -77,8 +79,9 @@ class MjsunitTestSuite(testsuite.TestSuite): |
| if SELF_SCRIPT_PATTERN.search(source): |
| env = ["-e", "TEST_FILE_NAME=\"%s\"" % testfilename.replace("\\", "\\\\")] |
| files = env + files |
| - files.append(os.path.join(self.root, "mjsunit.js")) |
| + files.append(os.path.join(self.root, "resources/standalone-pre.js")) |
| files.append(testfilename) |
| + files.append(os.path.join(self.root, "resources/standalone-post.js")) |
| flags += files |
| if context.isolates: |
| @@ -92,6 +95,24 @@ class MjsunitTestSuite(testsuite.TestSuite): |
| with open(filename) as f: |
| return f.read() |
| + def IsFailureOutput(self, output, testpath): |
| + if super(BlinkTestSuite, self).IsFailureOutput(output, testpath): |
| + return True |
| + file_name = os.path.join(self.root, testpath) + "-expected.txt" |
| + with file(file_name, "r") as expected: |
| + def ExpIterator(): |
| + for line in expected.readlines(): |
| + if line.startswith("#") or not line.strip(): continue |
| + yield line.strip() |
| + def ActIterator(): |
| + for line in output.stdout.splitlines(): |
| + if not line.strip(): continue |
|
Jakob Kummerow
2013/06/17 14:22:52
To make this test suite pass on Android and NaCl,
|
| + yield line.strip() |
| + for (expected, actual) in itertools.izip(ExpIterator(), ActIterator()): |
| + if expected != actual: |
| + return True |
| + return False |
| + |
| def GetSuite(name, root): |
| - return MjsunitTestSuite(name, root) |
| + return BlinkTestSuite(name, root) |