OLD | NEW |
1 # Copyright 2008 the V8 project authors. All rights reserved. | 1 # Copyright 2008 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 17 matching lines...) Expand all Loading... |
28 import itertools | 28 import itertools |
29 import os | 29 import os |
30 import re | 30 import re |
31 | 31 |
32 from testrunner.local import testsuite | 32 from testrunner.local import testsuite |
33 from testrunner.local import utils | 33 from testrunner.local import utils |
34 from testrunner.objects import testcase | 34 from testrunner.objects import testcase |
35 | 35 |
36 | 36 |
37 FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") | 37 FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") |
| 38 INVALID_FLAGS = ["--enable-slow-asserts"] |
38 | 39 |
39 | 40 |
40 class MessageTestSuite(testsuite.TestSuite): | 41 class MessageTestSuite(testsuite.TestSuite): |
41 def __init__(self, name, root): | 42 def __init__(self, name, root): |
42 super(MessageTestSuite, self).__init__(name, root) | 43 super(MessageTestSuite, self).__init__(name, root) |
43 | 44 |
44 def ListTests(self, context): | 45 def ListTests(self, context): |
45 tests = [] | 46 tests = [] |
46 for dirname, dirs, files in os.walk(self.root): | 47 for dirname, dirs, files in os.walk(self.root): |
47 for dotted in [x for x in dirs if x.startswith('.')]: | 48 for dotted in [x for x in dirs if x.startswith('.')]: |
48 dirs.remove(dotted) | 49 dirs.remove(dotted) |
49 dirs.sort() | 50 dirs.sort() |
50 files.sort() | 51 files.sort() |
51 for filename in files: | 52 for filename in files: |
52 if filename.endswith(".js"): | 53 if filename.endswith(".js"): |
53 testname = os.path.join(dirname[len(self.root) + 1:], filename[:-3]) | 54 testname = os.path.join(dirname[len(self.root) + 1:], filename[:-3]) |
54 test = testcase.TestCase(self, testname) | 55 test = testcase.TestCase(self, testname) |
55 tests.append(test) | 56 tests.append(test) |
56 return tests | 57 return tests |
57 | 58 |
58 def GetFlagsForTestCase(self, testcase, context): | 59 def GetFlagsForTestCase(self, testcase, context): |
59 source = self.GetSourceForTest(testcase) | 60 source = self.GetSourceForTest(testcase) |
60 result = [] | 61 result = [] |
61 flags_match = re.findall(FLAGS_PATTERN, source) | 62 flags_match = re.findall(FLAGS_PATTERN, source) |
62 for match in flags_match: | 63 for match in flags_match: |
63 result += match.strip().split() | 64 result += match.strip().split() |
64 result += context.mode_flags | 65 result += context.mode_flags |
| 66 result = [x for x in result if x not in INVALID_FLAGS] |
65 result.append(os.path.join(self.root, testcase.path + ".js")) | 67 result.append(os.path.join(self.root, testcase.path + ".js")) |
66 return testcase.flags + result | 68 return testcase.flags + result |
67 | 69 |
68 def GetSourceForTest(self, testcase): | 70 def GetSourceForTest(self, testcase): |
69 filename = os.path.join(self.root, testcase.path + self.suffix()) | 71 filename = os.path.join(self.root, testcase.path + self.suffix()) |
70 with open(filename) as f: | 72 with open(filename) as f: |
71 return f.read() | 73 return f.read() |
72 | 74 |
73 def _IgnoreLine(self, string): | 75 def _IgnoreLine(self, string): |
74 """Ignore empty lines, valgrind output and Android output.""" | 76 """Ignore empty lines, valgrind output and Android output.""" |
(...skipping 28 matching lines...) Expand all Loading... |
103 if not re.match(pattern, actual): | 105 if not re.match(pattern, actual): |
104 return True | 106 return True |
105 return False | 107 return False |
106 | 108 |
107 def StripOutputForTransmit(self, testcase): | 109 def StripOutputForTransmit(self, testcase): |
108 pass | 110 pass |
109 | 111 |
110 | 112 |
111 def GetSuite(name, root): | 113 def GetSuite(name, root): |
112 return MessageTestSuite(name, root) | 114 return MessageTestSuite(name, root) |
OLD | NEW |