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 expected_lines = expected.splitlines() |
| 31 actual_lines = output.stdout.splitlines() |
| 32 diff = difflib.unified_diff(expected_lines, actual_lines, lineterm="", |
| 33 fromfile="expected_path") |
| 34 diffstring = '\n'.join(diff) |
| 35 if diffstring is not "": |
| 36 if "generated from a non-shipping build" in output.stdout: |
| 37 return False |
| 38 if not "generated from a shipping build" in output.stdout: |
| 39 output.stdout = "Unexpected output:\n\n" + output.stdout |
| 40 return True |
| 41 output.stdout = diffstring |
| 42 return True |
| 43 return False |
| 44 |
| 45 def shell(self): |
| 46 return "mkgrokdump" |
| 47 |
| 48 def GetSuite(name, root): |
| 49 return MkGrokdump(name, root) |
OLD | NEW |