| Index: test/webkit/testcfg.py
|
| diff --git a/test/mjsunit/testcfg.py b/test/webkit/testcfg.py
|
| similarity index 64%
|
| copy from test/mjsunit/testcfg.py
|
| copy to test/webkit/testcfg.py
|
| index c960ce6b30107e167ad4576f24d0e29594444fd8..2c4a29c03e61a836878073ca4e63890a19197bb6 100644
|
| --- a/test/mjsunit/testcfg.py
|
| +++ b/test/webkit/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,20 +37,24 @@ 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 WebkitTestSuite(testsuite.TestSuite):
|
|
|
| def __init__(self, name, root):
|
| - super(MjsunitTestSuite, self).__init__(name, root)
|
| + super(WebkitTestSuite, self).__init__(name, root)
|
|
|
| def ListTests(self, context):
|
| tests = []
|
| for dirname, dirs, files in os.walk(self.root):
|
| for dotted in [x for x in dirs if x.startswith('.')]:
|
| dirs.remove(dotted)
|
| + if 'resources' in dirs:
|
| + dirs.remove('resources')
|
| +
|
| dirs.sort()
|
| 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 +82,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 +98,38 @@ class MjsunitTestSuite(testsuite.TestSuite):
|
| with open(filename) as f:
|
| return f.read()
|
|
|
| + # TODO(machenbach): Share with test/message/testcfg.py
|
| + def _IgnoreLine(self, string):
|
| + """Ignore empty lines, valgrind output and Android output."""
|
| + if not string: return True
|
| + return (string.startswith("==") or string.startswith("**") or
|
| + string.startswith("ANDROID") or
|
| + # These five patterns appear in normal Native Client output.
|
| + string.startswith("DEBUG MODE ENABLED") or
|
| + string.startswith("tools/nacl-run.py") or
|
| + string.find("BYPASSING ALL ACL CHECKS") > 0 or
|
| + string.find("Native Client module will be loaded") > 0 or
|
| + string.find("NaClHostDescOpen:") > 0)
|
| +
|
| + def IsFailureOutput(self, output, testpath):
|
| + if super(WebkitTestSuite, 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 self._IgnoreLine(line.strip()): continue
|
| + yield line.strip()
|
| + for (expected, actual) in itertools.izip_longest(
|
| + ExpIterator(), ActIterator(), fillvalue=''):
|
| + if expected != actual:
|
| + return True
|
| + return False
|
| +
|
|
|
| def GetSuite(name, root):
|
| - return MjsunitTestSuite(name, root)
|
| + return WebkitTestSuite(name, root)
|
|
|