Commit 3f5aeb5d authored by Hans Wennborg's avatar Hans Wennborg

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}
parent dc364e9a
......@@ -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
......@@ -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
......@@ -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
......@@ -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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment