Commit 31a6cb0e authored by Daniel Cheng's avatar Daniel Cheng

Enable blink_gc_plugin tests on Windows.

BUG=486571
R=thakis@chromium.org

Review URL: https://codereview.chromium.org/1137373002

Cr-Commit-Position: refs/heads/master@{#329814}
parent b3a547e7
...@@ -20,6 +20,12 @@ if(WIN32) ...@@ -20,6 +20,12 @@ if(WIN32)
list(APPEND absolute_sources ${CMAKE_CURRENT_SOURCE_DIR}/${source}) list(APPEND absolute_sources ${CMAKE_CURRENT_SOURCE_DIR}/${source})
endforeach() endforeach()
set_property(TARGET clang APPEND PROPERTY SOURCES ${absolute_sources}) set_property(TARGET clang APPEND PROPERTY SOURCES ${absolute_sources})
cr_add_test(blink_gc_plugin_test
python
${CMAKE_CURRENT_SOURCE_DIR}/tests/test.py
${CMAKE_BINARY_DIR}/bin/clang
)
else() else()
add_llvm_loadable_module("lib${LIBRARYNAME}" ${plugin_sources}) add_llvm_loadable_module("lib${LIBRARYNAME}" ${plugin_sources})
add_dependencies("lib${LIBRARYNAME}" clang) add_dependencies("lib${LIBRARYNAME}" clang)
......
...@@ -42,18 +42,26 @@ def run_test(test_base_name, cmd): ...@@ -42,18 +42,26 @@ def run_test(test_base_name, cmd):
# 'bad' (e.g. it has a cycle). The output still needs to be captured in # 'bad' (e.g. it has a cycle). The output still needs to be captured in
# that case, since the expected results capture the errors. # that case, since the expected results capture the errors.
actual = e.output actual = e.output
finally:
# Clean up the .graph.json file to prevent false passes from stale 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. # TODO(dcheng): Remove the rstrip() and just rebaseline the tests to match.
actual = actual.rstrip() 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')
try: try:
expected = open('%s.txt' % test_base_name).read().rstrip() expected = open('%s.txt' % test_base_name).read().rstrip()
except IOError: except IOError:
open('%s.txt' % test_base_name, 'w').write(actual) open('%s.txt.actual' % test_base_name, 'w').write(actual)
return 'no expected file found' return 'no expected file found'
if expected != actual: if expected != actual:
open('%s.txt' % test_base_name, 'w').write(actual) open('%s.txt.actual' % test_base_name, 'w').write(actual)
return 'expected and actual differed' return 'expected and actual differed'
...@@ -72,7 +80,10 @@ def run_tests(clang_path, plugin_path): ...@@ -72,7 +80,10 @@ def run_tests(clang_path, plugin_path):
passing = [] passing = []
failing = [] failing = []
base_cmd = [clang_path, '-fsyntax-only', '-std=c++11'] # The plugin option to dump the object graph is incompatible with
# -fsyntax-only. It generates the .graph.json file based on the name of the
# output file, but there is no output filename with -fsyntax-only.
base_cmd = [clang_path, '-c', '-std=c++11']
base_cmd.extend(['-Wno-inaccessible-base']) base_cmd.extend(['-Wno-inaccessible-base'])
if plugin_path: if plugin_path:
base_cmd.extend(['-Xclang', '-load', '-Xclang', plugin_path]) base_cmd.extend(['-Xclang', '-load', '-Xclang', plugin_path])
...@@ -118,6 +129,7 @@ def main(): ...@@ -118,6 +129,7 @@ def main():
len(passing) + len(failing), len(passing), len(failing)) len(passing) + len(failing), len(passing), len(failing))
for test in failing: for test in failing:
print ' %s' % test print ' %s' % test
return len(failing)
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -295,6 +295,11 @@ def UpdateClang(args): ...@@ -295,6 +295,11 @@ def UpdateClang(args):
CopyFile(os.path.join(sanitizer_include_dir, f), CopyFile(os.path.join(sanitizer_include_dir, f),
aux_sanitizer_include_dir) aux_sanitizer_include_dir)
if args.run_tests:
os.chdir(LLVM_BUILD_DIR)
RunCommand(GetVSVersion().SetupScript('x64') +
['&&', 'ninja', 'cr-check-all'])
WriteStampFile(LLVM_WIN_REVISION) WriteStampFile(LLVM_WIN_REVISION)
print 'Clang update was successful.' print 'Clang update was successful.'
return 0 return 0
...@@ -329,6 +334,7 @@ def main(): ...@@ -329,6 +334,7 @@ def main():
# mad if it sees a flag it doesn't recognize. # mad if it sees a flag it doesn't recognize.
parser.add_argument('--if-needed', action='store_true') parser.add_argument('--if-needed', action='store_true')
parser.add_argument('--print-revision', action='store_true') parser.add_argument('--print-revision', action='store_true')
parser.add_argument('--run-tests', action='store_true')
args = parser.parse_args() args = parser.parse_args()
......
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