OLD | NEW |
| (Empty) |
1 # Copyright 2017 the V8 project authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 import os | |
6 import difflib | |
7 | |
8 from testrunner.local import testsuite | |
9 from testrunner.objects import testcase | |
10 | |
11 | |
12 class MkGrokdump(testsuite.TestSuite): | |
13 | |
14 def __init__(self, name, root): | |
15 super(MkGrokdump, self).__init__(name, root) | |
16 | |
17 def ListTests(self, context): | |
18 test = testcase.TestCase(self, self.shell()) | |
19 return [test] | |
20 | |
21 def GetFlagsForTestCase(self, testcase, context): | |
22 return [] | |
23 | |
24 def IsFailureOutput(self, testcase): | |
25 output = testcase.output | |
26 v8_path = os.path.dirname(os.path.dirname(os.path.abspath(self.root))) | |
27 expected_path = os.path.join(v8_path, "tools", "v8heapconst.py") | |
28 with open(expected_path) as f: | |
29 expected = f.read() | |
30 if expected != output.stdout: | |
31 if "generated from a non-shipping build" in output.stdout: | |
32 return False | |
33 assert "generated from a shipping build" in output.stdout | |
34 expected_lines = expected.splitlines() | |
35 actual_lines = output.stdout.splitlines() | |
36 output.stdout = "%s differs from mkgrokdump output:\n\n" % expected_path | |
37 output.stdout += '\n'.join(difflib.unified_diff(expected_lines, actual_lin
es)) | |
38 return True | |
39 return False | |
40 | |
41 def shell(self): | |
42 return "mkgrokdump" | |
43 | |
44 def GetSuite(name, root): | |
45 return MkGrokdump(name, root) | |
OLD | NEW |