diff options
author | Hans Wennborg <hans@chromium.org> | 2015-05-15 13:21:03 -0700 |
---|---|---|
committer | Hans Wennborg <hans@chromium.org> | 2015-05-15 20:22:11 +0000 |
commit | 3f5aeb5d2f932a971a0e6fa1da2c6253e4dba103 (patch) | |
tree | c6107fc32291efbe2dd31b8af57627947e8ac96d /tools | |
parent | dc364e9a13403cbc7b7eed3239baa463256b9ca4 (diff) | |
download | chromium_src-3f5aeb5d2f932a971a0e6fa1da2c6253e4dba103.zip chromium_src-3f5aeb5d2f932a971a0e6fa1da2c6253e4dba103.tar.gz chromium_src-3f5aeb5d2f932a971a0e6fa1da2c6253e4dba103.tar.bz2 |
Revert "Remove test result whitespace stripping from blink_gc_plugin test script"
This reverts https://crrev.com/5171d85366fe1bd7c1de43e866adc3c3e50bc419
BUG=none
TBR=thakis
Review URL: https://codereview.chromium.org/1131933004
Cr-Commit-Position: refs/heads/master@{#330184}
Diffstat (limited to 'tools')
11 files changed, 24 insertions, 27 deletions
diff --git a/tools/clang/blink_gc_plugin/tests/cycle_ptrs.txt b/tools/clang/blink_gc_plugin/tests/cycle_ptrs.txt index 4d242a6..7ad6c48 100644 --- a/tools/clang/blink_gc_plugin/tests/cycle_ptrs.txt +++ b/tools/clang/blink_gc_plugin/tests/cycle_ptrs.txt @@ -5,4 +5,3 @@ Found a potentially leaking cycle starting from a GC root: ./cycle_ptrs.h:34:5: blink::B (m_c) => blink::C ./cycle_ptrs.h:39:5: blink::C (m_d) => blink::D ./cycle_ptrs.h:44:5: blink::D (m_es) => blink::E - diff --git a/tools/clang/blink_gc_plugin/tests/cycle_sub.txt b/tools/clang/blink_gc_plugin/tests/cycle_sub.txt index b37907d..9c015c8 100644 --- a/tools/clang/blink_gc_plugin/tests/cycle_sub.txt +++ b/tools/clang/blink_gc_plugin/tests/cycle_sub.txt @@ -3,4 +3,3 @@ Found a potentially leaking cycle starting from a GC root: ./cycle_sub.h:31:5: blink::C (m_a) => blink::A ./cycle_sub.h:22:11: blink::A (<subclass>) => blink::B ./cycle_sub.h:26:5: blink::B (m_c) => blink::C - diff --git a/tools/clang/blink_gc_plugin/tests/cycle_super.txt b/tools/clang/blink_gc_plugin/tests/cycle_super.txt index 89b3675..374074b 100644 --- a/tools/clang/blink_gc_plugin/tests/cycle_super.txt +++ b/tools/clang/blink_gc_plugin/tests/cycle_super.txt @@ -2,4 +2,3 @@ Found a potentially leaking cycle starting from a GC root: ./cycle_super.h:36:5: blink::D (m_c) => blink::C ./cycle_super.h:21:5: blink::C (blink::B <: blink::A <: m_d) => blink::D - diff --git a/tools/clang/blink_gc_plugin/tests/cycle_super_neg.txt b/tools/clang/blink_gc_plugin/tests/cycle_super_neg.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tools/clang/blink_gc_plugin/tests/cycle_super_neg.txt @@ -0,0 +1 @@ + diff --git a/tools/clang/blink_gc_plugin/tests/register_weak_members_template.txt b/tools/clang/blink_gc_plugin/tests/register_weak_members_template.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tools/clang/blink_gc_plugin/tests/register_weak_members_template.txt @@ -0,0 +1 @@ + diff --git a/tools/clang/blink_gc_plugin/tests/test.py b/tools/clang/blink_gc_plugin/tests/test.py index 5ade032..acb7e74 100755 --- a/tools/clang/blink_gc_plugin/tests/test.py +++ b/tools/clang/blink_gc_plugin/tests/test.py @@ -4,20 +4,18 @@ # found in the LICENSE file. -import argparse import glob import os import subprocess import sys -def run_test(test_base_name, cmd, reset_results): +def run_test(test_base_name, cmd): """Run a test case. Args: test_base_name: The name for the test C++ source file without the extension. cmd: The actual command to run for the test. - reset_results: True if the results should be overwritten in place. Returns: None on pass, or a str with the description of the failure. @@ -49,31 +47,31 @@ def run_test(test_base_name, cmd, reset_results): # from a previous run. os.remove('%s.graph.json' % test_base_name) + # TODO(dcheng): Remove the rstrip() and just rebaseline the tests to match. + actual = actual.rstrip() + # On Windows, clang emits CRLF as the end of line marker. Normalize it to LF # to match posix systems. actual = actual.replace('\r\n', '\n') - result_file = '%s.txt%s' % ( - test_base_name, '' if reset_results else '.actual') try: - expected = open('%s.txt' % test_base_name).read() + expected = open('%s.txt' % test_base_name).read().rstrip() except IOError: - open(result_file, 'w').write(actual) + open('%s.txt.actual' % test_base_name, 'w').write(actual) return 'no expected file found' if expected != actual: - open(result_file, 'w').write(actual) + open('%s.txt.actual' % test_base_name, 'w').write(actual) return 'expected and actual differed' -def run_tests(clang_path, plugin_path, reset_results): +def run_tests(clang_path, plugin_path): """Runs the tests. Args: clang_path: The path to the clang binary to be tested. plugin_path: An optional path to the plugin to test. This may be None, if plugin is built directly into clang, like on Windows. - reset_results: True if the results should be overwritten in place. Returns: (passing, failing): Two lists containing the base names of the passing and @@ -103,7 +101,7 @@ def run_tests(clang_path, plugin_path, reset_results): pass cmd.append(test) - failure_message = run_test(test_base_name, cmd, reset_results) + failure_message = run_test(test_base_name, cmd) if failure_message: print 'failed: %s' % failure_message failing.append(test_base_name) @@ -115,23 +113,18 @@ def run_tests(clang_path, plugin_path, reset_results): def main(): - parser = argparse.ArgumentParser() - parser.add_argument( - '--reset-results', action='store_true', - help='If specified, overwrites the expected results in place.') - parser.add_argument('clang_path', help='The path to the clang binary.') - parser.add_argument('plugin_path', nargs='?', - help='The path to the plugin library, if any.') - args = parser.parse_args() + if len(sys.argv) < 2: + print 'Usage: <path to clang>[ <path to plugin>]' + return -1 os.chdir(os.path.dirname(os.path.realpath(__file__))) - print 'Using clang %s...' % args.clang_path - print 'Using plugin %s...' % args.plugin_path + clang_path = sys.argv[1] + plugin_path = sys.argv[2] if len(sys.argv) > 2 else None + print 'Using clang %s...' % clang_path + print 'Using plugin %s...' % plugin_path - passing, failing = run_tests(args.clang_path, - args.plugin_path, - args.reset_results) + passing, failing = run_tests(clang_path, plugin_path) print 'Ran %d tests: %d succeeded, %d failed' % ( len(passing) + len(failing), len(passing), len(failing)) for test in failing: diff --git a/tools/clang/blink_gc_plugin/tests/trace_after_dispatch_impl.txt b/tools/clang/blink_gc_plugin/tests/trace_after_dispatch_impl.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tools/clang/blink_gc_plugin/tests/trace_after_dispatch_impl.txt @@ -0,0 +1 @@ + diff --git a/tools/clang/blink_gc_plugin/tests/traceimpl.txt b/tools/clang/blink_gc_plugin/tests/traceimpl.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tools/clang/blink_gc_plugin/tests/traceimpl.txt @@ -0,0 +1 @@ + diff --git a/tools/clang/blink_gc_plugin/tests/traceimpl_derived_from_templated_base.txt b/tools/clang/blink_gc_plugin/tests/traceimpl_derived_from_templated_base.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tools/clang/blink_gc_plugin/tests/traceimpl_derived_from_templated_base.txt @@ -0,0 +1 @@ + diff --git a/tools/clang/blink_gc_plugin/tests/traceimpl_omitted_trace.txt b/tools/clang/blink_gc_plugin/tests/traceimpl_omitted_trace.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tools/clang/blink_gc_plugin/tests/traceimpl_omitted_trace.txt @@ -0,0 +1 @@ + diff --git a/tools/clang/blink_gc_plugin/tests/traceimpl_overloaded.txt b/tools/clang/blink_gc_plugin/tests/traceimpl_overloaded.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tools/clang/blink_gc_plugin/tests/traceimpl_overloaded.txt @@ -0,0 +1 @@ + |