Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: test/test262/testcfg.py

Issue 478163002: test/test262: update testcfg.py for new test262 (Closed) Base URL: git@github.com:smikes/v8.git@master
Patch Set: Incorporate code review comments from Jakob Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« test/test262/test262.status ('K') | « test/test262/test262.status ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 18 matching lines...) Expand all
29 import hashlib 29 import hashlib
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 34
35 from testrunner.local import testsuite 35 from testrunner.local import testsuite
36 from testrunner.local import utils 36 from testrunner.local import utils
37 from testrunner.objects import testcase 37 from testrunner.objects import testcase
38 38
39 TEST_262_ARCHIVE_REVISION = "595a36b" # This is the 2014-Aug-10 revision.
40 TEST_262_ARCHIVE_MD5 = "89dfc8458f474cdb7e8e178f3215dd06"
41 TEST_262_URL = "https://github.com/tc39/test262/tarball/%s"
42 TEST_262_HARNESS = ["sta.js"]
39 43
40 TEST_262_ARCHIVE_REVISION = "fbba29f" # This is the r365 revision. 44 TEST_262_ROOT = ["data", "test"]
41 TEST_262_ARCHIVE_MD5 = "e1ff0db438cc12de8fb6da80621b4ef6" 45 TEST_262_SUITE_ROOT = TEST_262_ROOT + ["suite"]
42 TEST_262_URL = "https://github.com/tc39/test262/tarball/%s" 46 TEST_262_HARNESS_ROOT = TEST_262_ROOT + ["harness"]
43 TEST_262_HARNESS = ["sta.js", "testBuiltInObject.js", "testIntl.js"] 47 TEST_262_PYTHON_ROOT = ["data", "tools", "packaging"]
Jakob Kummerow 2014/08/18 17:18:39 Since this is now only used in the line right belo
smikes 2014/08/18 19:38:01 I think it can't go into GetSuite because GetSuite
48 TEST_262_PYTHON_PATH = os.path.join('test', 'test262', *TEST_262_PYTHON_ROOT)
44 49
50 original_sys_path = sys.path
51 sys.path.append(os.path.abspath(TEST_262_PYTHON_PATH))
52 try:
53 from parseTestRecord import parseTestRecord as ParseTestRecord
54 except ImportError:
55 print "Need to --download-data for test262"
56 sys.path = original_sys_path
45 57
46 class Test262TestSuite(testsuite.TestSuite): 58 class Test262TestSuite(testsuite.TestSuite):
47 59
48 def __init__(self, name, root): 60 def __init__(self, name, root):
49 super(Test262TestSuite, self).__init__(name, root) 61 super(Test262TestSuite, self).__init__(name, root)
50 self.testroot = os.path.join(root, "data", "test", "suite") 62 self.testroot = os.path.join(self.root, *TEST_262_SUITE_ROOT)
51 self.harness = [os.path.join(self.root, "data", "test", "harness", f) 63 self.harnesspath = os.path.join(self.root, *TEST_262_HARNESS_ROOT)
64 self.harness = [os.path.join(self.harnesspath, f)
52 for f in TEST_262_HARNESS] 65 for f in TEST_262_HARNESS]
53 self.harness += [os.path.join(self.root, "harness-adapt.js")] 66 self.harness += [os.path.join(self.root, "harness-adapt.js")]
54 67
55 def CommonTestName(self, testcase): 68 def CommonTestName(self, testcase):
56 return testcase.path.split(os.path.sep)[-1] 69 return testcase.path.split(os.path.sep)[-1]
57 70
58 def ListTests(self, context): 71 def ListTests(self, context):
59 tests = [] 72 tests = []
60 for dirname, dirs, files in os.walk(self.testroot): 73 for dirname, dirs, files in os.walk(self.testroot):
61 for dotted in [x for x in dirs if x.startswith(".")]: 74 for dotted in [x for x in dirs if x.startswith(".")]:
62 dirs.remove(dotted) 75 dirs.remove(dotted)
63 if context.noi18n and "intl402" in dirs: 76 if context.noi18n and "intl402" in dirs:
64 dirs.remove("intl402") 77 dirs.remove("intl402")
65 dirs.sort() 78 dirs.sort()
66 files.sort() 79 files.sort()
67 for filename in files: 80 for filename in files:
68 if filename.endswith(".js"): 81 if filename.endswith(".js"):
69 testname = os.path.join(dirname[len(self.testroot) + 1:], 82 testname = os.path.join(dirname[len(self.testroot) + 1:],
70 filename[:-3]) 83 filename[:-3])
71 case = testcase.TestCase(self, testname) 84 case = testcase.TestCase(self, testname)
72 tests.append(case) 85 tests.append(case)
73 return tests 86 return tests
74 87
75 def GetFlagsForTestCase(self, testcase, context): 88 def GetFlagsForTestCase(self, testcase, context):
76 return (testcase.flags + context.mode_flags + self.harness + 89 return (testcase.flags + context.mode_flags + self.harness +
90 self.GetIncludesForTest(testcase) +
77 [os.path.join(self.testroot, testcase.path + ".js")]) 91 [os.path.join(self.testroot, testcase.path + ".js")])
78 92
93 def GetTestRecord(self, testcase):
94 if hasattr(testcase, "test_record"):
Jakob Kummerow 2014/08/18 17:18:39 nit: one return statement is more readable, and in
smikes 2014/08/18 19:38:01 Done.
95 return testcase.test_record
96 testcase.test_record = ParseTestRecord(self.GetSourceForTest(testcase),
97 testcase.path)
98 return testcase.test_record
99
100 def GetIncludesForTest(self, testcase):
101 test_record = self.GetTestRecord(testcase)
102 if "includes" in test_record:
103 return [os.path.join(self.harnesspath, f)
104 for f in test_record['includes']]
105 return []
106
79 def GetSourceForTest(self, testcase): 107 def GetSourceForTest(self, testcase):
80 filename = os.path.join(self.testroot, testcase.path + ".js") 108 filename = os.path.join(self.testroot, testcase.path + ".js")
81 with open(filename) as f: 109 with open(filename) as f:
82 return f.read() 110 testcase.source = f.read()
111 return testcase.source
83 112
84 def IsNegativeTest(self, testcase): 113 def IsNegativeTest(self, testcase):
85 return "@negative" in self.GetSourceForTest(testcase) 114 test_record = self.GetTestRecord(testcase)
115 if "negative" in test_record:
116 return test_record['negative']
Jakob Kummerow 2014/08/18 17:18:39 one more nit: the rest of this file uses double qu
smikes 2014/08/18 19:38:01 Done.
117 return False
86 118
87 def IsFailureOutput(self, output, testpath): 119 def IsFailureOutput(self, output, testpath):
88 if output.exit_code != 0: 120 if output.exit_code != 0:
89 return True 121 return True
90 return "FAILED!" in output.stdout 122 return "FAILED!" in output.stdout
91 123
92 def DownloadData(self): 124 def DownloadData(self):
93 revision = TEST_262_ARCHIVE_REVISION 125 revision = TEST_262_ARCHIVE_REVISION
94 archive_url = TEST_262_URL % revision 126 archive_url = TEST_262_URL % revision
95 archive_name = os.path.join(self.root, "tc39-test262-%s.tar.gz" % revision) 127 archive_name = os.path.join(self.root, "tc39-test262-%s.tar.gz" % revision)
(...skipping 20 matching lines...) Expand all
116 # Magic incantation to allow longer path names on Windows. 148 # Magic incantation to allow longer path names on Windows.
117 archive.extractall(u"\\\\?\\%s" % self.root) 149 archive.extractall(u"\\\\?\\%s" % self.root)
118 else: 150 else:
119 archive.extractall(self.root) 151 archive.extractall(self.root)
120 os.rename(os.path.join(self.root, "tc39-test262-%s" % revision), 152 os.rename(os.path.join(self.root, "tc39-test262-%s" % revision),
121 directory_name) 153 directory_name)
122 154
123 155
124 def GetSuite(name, root): 156 def GetSuite(name, root):
125 return Test262TestSuite(name, root) 157 return Test262TestSuite(name, root)
OLDNEW
« test/test262/test262.status ('K') | « test/test262/test262.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698