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

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

Issue 11028027: Revert trunk to bleeding_edge at r12484 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « test/es5conform/testcfg.py ('k') | test/message/try-catch-finally-no-message.out » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 # with the distribution. 11 # with the distribution.
12 # * Neither the name of Google Inc. nor the names of its 12 # * Neither the name of Google Inc. nor the names of its
13 # contributors may be used to endorse or promote products derived 13 # contributors may be used to endorse or promote products derived
14 # from this software without specific prior written permission. 14 # from this software without specific prior written permission.
15 # 15 #
16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 import itertools 28 import test
29 import os 29 import os
30 from os.path import join, dirname, exists, basename, isdir
30 import re 31 import re
31 32
32 from testrunner.local import testsuite
33 from testrunner.local import utils
34 from testrunner.objects import testcase
35
36
37 FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") 33 FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)")
38 34
39
40 class MessageTestSuite(testsuite.TestSuite):
41 def __init__(self, name, root):
42 super(MessageTestSuite, self).__init__(name, root)
43
44 def ListTests(self, context):
45 tests = []
46 for dirname, dirs, files in os.walk(self.root):
47 for dotted in [x for x in dirs if x.startswith('.')]:
48 dirs.remove(dotted)
49 dirs.sort()
50 files.sort()
51 for filename in files:
52 if filename.endswith(".js"):
53 testname = join(dirname[len(self.root) + 1:], filename[:-3])
54 test = testcase.TestCase(self, testname)
55 tests.append(test)
56 return tests
57
58 def GetFlagsForTestCase(self, testcase, context):
59 source = self.GetSourceForTest(testcase)
60 result = []
61 flags_match = re.findall(FLAGS_PATTERN, source)
62 for match in flags_match:
63 result += match.strip().split()
64 result += context.mode_flags
65 result.append(os.path.join(self.root, testcase.path + ".js"))
66 return testcase.flags + result
67
68 def GetSourceForTest(self, testcase):
69 filename = os.path.join(self.root, testcase.path + self.suffix())
70 with open(filename) as f:
71 return f.read()
72
73 def _IgnoreLine(self, string):
74 """Ignore empty lines, valgrind output and Android output."""
75 if not string: return True
76 return (string.startswith("==") or string.startswith("**") or
77 string.startswith("ANDROID"))
78
79 def IsFailureOutput(self, output, testpath):
80 expected_path = os.path.join(self.root, testpath + ".out")
81 expected_lines = []
82 # Can't use utils.ReadLinesFrom() here because it strips whitespace.
83 with open(expected_path) as f:
84 for line in f:
85 if line.startswith("#") or not line.strip(): continue
86 expected_lines.append(line)
87 raw_lines = output.stdout.splitlines()
88 actual_lines = [ s for s in raw_lines if not self._IgnoreLine(s) ]
89 env = { "basename": os.path.basename(testpath + ".js") }
90 if len(expected_lines) != len(actual_lines):
91 return True
92 for (expected, actual) in itertools.izip(expected_lines, actual_lines):
93 pattern = re.escape(expected.rstrip() % env)
94 pattern = pattern.replace("\\*", ".*")
95 pattern = "^%s$" % pattern
96 if not re.match(pattern, actual):
97 return True
98 return False
99
100 def StripOutputForTransmit(self, testcase):
101 pass
102
103
104 def GetSuite(name, root):
105 return MessageTestSuite(name, root)
106
107
108 # Deprecated definitions below.
109 # TODO(jkummerow): Remove when SCons is no longer supported.
110
111
112 import test
113 from os.path import join, exists, basename, isdir
114
115 class MessageTestCase(test.TestCase): 35 class MessageTestCase(test.TestCase):
116 36
117 def __init__(self, path, file, expected, mode, context, config): 37 def __init__(self, path, file, expected, mode, context, config):
118 super(MessageTestCase, self).__init__(context, path, mode) 38 super(MessageTestCase, self).__init__(context, path, mode)
119 self.file = file 39 self.file = file
120 self.expected = expected 40 self.expected = expected
121 self.config = config 41 self.config = config
122 42
123 def IgnoreLine(self, str): 43 def IgnoreLine(self, str):
124 """Ignore empty lines, valgrind output and Android output.""" 44 """Ignore empty lines, valgrind output and Android output."""
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 return ['d8'] 129 return ['d8']
210 130
211 def GetTestStatus(self, sections, defs): 131 def GetTestStatus(self, sections, defs):
212 status_file = join(self.root, 'message.status') 132 status_file = join(self.root, 'message.status')
213 if exists(status_file): 133 if exists(status_file):
214 test.ReadConfigurationInto(status_file, sections, defs) 134 test.ReadConfigurationInto(status_file, sections, defs)
215 135
216 136
217 def GetConfiguration(context, root): 137 def GetConfiguration(context, root):
218 return MessageTestConfiguration(context, root) 138 return MessageTestConfiguration(context, root)
OLDNEW
« no previous file with comments | « test/es5conform/testcfg.py ('k') | test/message/try-catch-finally-no-message.out » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698