| OLD | NEW |
| 1 # Copyright 2012 the V8 project authors. All rights reserved. | 1 # Copyright 2012 the V8 project authors. All rights reserved. |
| 2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
| 3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
| 4 # met: | 4 # met: |
| 5 # | 5 # |
| 6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
| 7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
| 8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
| 9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
| 10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 import os | 30 import os |
| 31 import shutil | 31 import shutil |
| 32 import sys | 32 import sys |
| 33 import tarfile | 33 import tarfile |
| 34 import imp | 34 import imp |
| 35 | 35 |
| 36 from testrunner.local import testsuite | 36 from testrunner.local import testsuite |
| 37 from testrunner.local import utils | 37 from testrunner.local import utils |
| 38 from testrunner.objects import testcase | 38 from testrunner.objects import testcase |
| 39 | 39 |
| 40 TEST_262_ARCHIVE_REVISION = "43acf61" # This is the 2015-03-31 revision. | 40 # The revision hash needs to be 7 characters? |
| 41 TEST_262_ARCHIVE_MD5 = "a77a0352a0462be98e50522a15b7a3c4" | 41 TEST_262_ARCHIVE_REVISION = "488c0a7" # This is the 2015-06-11 revision. |
| 42 TEST_262_ARCHIVE_MD5 = "f7d4ec9be81f1e1f10fd8a61c71baead" |
| 42 TEST_262_URL = "https://github.com/tc39/test262/tarball/%s" | 43 TEST_262_URL = "https://github.com/tc39/test262/tarball/%s" |
| 43 TEST_262_HARNESS_FILES = ["sta.js", "assert.js"] | 44 TEST_262_HARNESS_FILES = ["sta.js", "assert.js"] |
| 44 | 45 |
| 45 TEST_262_SUITE_PATH = ["data", "test"] | 46 TEST_262_SUITE_PATH = ["data", "test"] |
| 46 TEST_262_HARNESS_PATH = ["data", "harness"] | 47 TEST_262_HARNESS_PATH = ["data", "harness"] |
| 47 TEST_262_TOOLS_PATH = ["data", "tools", "packaging"] | 48 TEST_262_TOOLS_PATH = ["data", "tools", "packaging"] |
| 48 | 49 |
| 49 class Test262TestSuite(testsuite.TestSuite): | 50 class Test262TestSuite(testsuite.TestSuite): |
| 50 | 51 |
| 51 def __init__(self, name, root): | 52 def __init__(self, name, root): |
| (...skipping 20 matching lines...) Expand all Loading... |
| 72 filename[:-3]) | 73 filename[:-3]) |
| 73 case = testcase.TestCase(self, testname) | 74 case = testcase.TestCase(self, testname) |
| 74 tests.append(case) | 75 tests.append(case) |
| 75 return tests | 76 return tests |
| 76 | 77 |
| 77 def GetFlagsForTestCase(self, testcase, context): | 78 def GetFlagsForTestCase(self, testcase, context): |
| 78 return (testcase.flags + context.mode_flags + self.harness + | 79 return (testcase.flags + context.mode_flags + self.harness + |
| 79 self.GetIncludesForTest(testcase) + ["--harmony"] + | 80 self.GetIncludesForTest(testcase) + ["--harmony"] + |
| 80 [os.path.join(self.testroot, testcase.path + ".js")]) | 81 [os.path.join(self.testroot, testcase.path + ".js")]) |
| 81 | 82 |
| 83 def VariantFlags(self, testcase, default_flags): |
| 84 flags = super(Test262TestSuite, self).VariantFlags(testcase, default_flags) |
| 85 test_record = self.GetTestRecord(testcase) |
| 86 if "noStrict" in test_record: |
| 87 return flags |
| 88 strict_flags = [f + ["--use-strict"] for f in flags] |
| 89 if "onlyStrict" in test_record: |
| 90 return strict_flags |
| 91 return flags + strict_flags |
| 92 |
| 82 def LoadParseTestRecord(self): | 93 def LoadParseTestRecord(self): |
| 83 if not self.ParseTestRecord: | 94 if not self.ParseTestRecord: |
| 84 root = os.path.join(self.root, *TEST_262_TOOLS_PATH) | 95 root = os.path.join(self.root, *TEST_262_TOOLS_PATH) |
| 85 f = None | 96 f = None |
| 86 try: | 97 try: |
| 87 (f, pathname, description) = imp.find_module("parseTestRecord", [root]) | 98 (f, pathname, description) = imp.find_module("parseTestRecord", [root]) |
| 88 module = imp.load_module("parseTestRecord", f, pathname, description) | 99 module = imp.load_module("parseTestRecord", f, pathname, description) |
| 89 self.ParseTestRecord = module.parseTestRecord | 100 self.ParseTestRecord = module.parseTestRecord |
| 90 except: | 101 except: |
| 91 raise ImportError("Cannot load parseTestRecord; you may need to " | 102 raise ImportError("Cannot load parseTestRecord; you may need to " |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 # Magic incantation to allow longer path names on Windows. | 176 # Magic incantation to allow longer path names on Windows. |
| 166 archive.extractall(u"\\\\?\\%s" % self.root) | 177 archive.extractall(u"\\\\?\\%s" % self.root) |
| 167 else: | 178 else: |
| 168 archive.extractall(self.root) | 179 archive.extractall(self.root) |
| 169 os.rename(os.path.join(self.root, "tc39-test262-%s" % revision), | 180 os.rename(os.path.join(self.root, "tc39-test262-%s" % revision), |
| 170 directory_name) | 181 directory_name) |
| 171 | 182 |
| 172 | 183 |
| 173 def GetSuite(name, root): | 184 def GetSuite(name, root): |
| 174 return Test262TestSuite(name, root) | 185 return Test262TestSuite(name, root) |
| OLD | NEW |