Chromium Code Reviews| Index: test/mkgrokdump/testcfg.py |
| diff --git a/test/mkgrokdump/testcfg.py b/test/mkgrokdump/testcfg.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3c9a89c27e3d9a5b35ec9730b143612f1c4a307e |
| --- /dev/null |
| +++ b/test/mkgrokdump/testcfg.py |
| @@ -0,0 +1,45 @@ |
| +# Copyright 2017 the V8 project authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +import os |
| +import difflib |
| + |
| +from testrunner.local import testsuite |
| +from testrunner.objects import testcase |
| + |
| + |
| +class MkGrokdump(testsuite.TestSuite): |
| + |
| + def __init__(self, name, root): |
| + super(MkGrokdump, self).__init__(name, root) |
| + |
| + def ListTests(self, context): |
| + test = testcase.TestCase(self, self.shell()) |
| + return [test] |
| + |
| + def GetFlagsForTestCase(self, testcase, context): |
| + return [] |
| + |
| + def IsFailureOutput(self, testcase): |
| + output = testcase.output |
| + v8_path = os.path.dirname(os.path.dirname(os.path.abspath(self.root))) |
| + expected_path = os.path.join(v8_path, "tools", "v8heapconst.py") |
| + with open(expected_path) as f: |
| + expected = f.read() |
| + if expected != output.stdout: |
| + if "generated from a non-shipping build" in output.stdout: |
| + return False |
| + assert "generated from a shipping build" in output.stdout |
|
Michael Achenbach
2017/04/19 07:04:28
Don't use assert statements here as they bypass th
|
| + expected_lines = expected.splitlines() |
| + actual_lines = output.stdout.splitlines() |
| + output.stdout = "%s differs from mkgrokdump output:\n\n" % expected_path |
| + output.stdout += '\n'.join(difflib.unified_diff(expected_lines, actual_lines)) |
| + return True |
| + return False |
| + |
| + def shell(self): |
| + return "mkgrokdump" |
| + |
| +def GetSuite(name, root): |
| + return MkGrokdump(name, root) |