diff --git a/libcxx/test/libcxx/transitive_includes.gen.py b/libcxx/test/libcxx/transitive_includes.gen.py index 22fde8e72c3a2cc..c1f5b55a9a75cc5 100644 --- a/libcxx/test/libcxx/transitive_includes.gen.py +++ b/libcxx/test/libcxx/transitive_includes.gen.py @@ -91,7 +91,7 @@ // RUN: %{{cxx}} %s %{{flags}} %{{compile_flags}} --trace-includes -fshow-skipped-includes --preprocess > /dev/null 2> %t/trace-includes.txt // RUN: %{{python}} %{{libcxx-dir}}/test/libcxx/transitive_includes/to_csv.py %t/trace-includes.txt > %t/actual_transitive_includes.csv // RUN: %{{python}} %{{libcxx-dir}}/test/libcxx/transitive_includes/expected.py %{{cxx_std}} "{header}" %t/expected_transitive_includes.csv -// RUN: diff %t/expected_transitive_includes.csv %t/actual_transitive_includes.csv +// RUN: %{{python}} %{{libcxx-dir}}/test/libcxx/transitive_includes/diff.py %t/expected_transitive_includes.csv %t/actual_transitive_includes.csv #include <{header}> """ ) diff --git a/libcxx/test/libcxx/transitive_includes/diff.py b/libcxx/test/libcxx/transitive_includes/diff.py new file mode 100755 index 000000000000000..c30a6a9841a31ba --- /dev/null +++ b/libcxx/test/libcxx/transitive_includes/diff.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python +# ===----------------------------------------------------------------------===## +# +# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +# ===----------------------------------------------------------------------===## + +import argparse +import os +import sys + +if __name__ == "__main__": + parser = argparse.ArgumentParser( + description="""Diff two files.""", + ) + parser.add_argument("file1", default=None) + parser.add_argument("file2", default=None) + args = parser.parse_args() + + def doread(f): + with open(f, 'r') as file: + content = file.read() + lines = [l.strip() for l in content.splitlines()] + return list(filter(None, lines)) + + content1 = doread(args.file1) + content2 = doread(args.file2) + + for l1, l2 in zip(content1, content2): + if l1 != l2: + print("line not equal") + print(l1) + print(l2) + sys.exit(1) diff --git a/libcxx/test/libcxx/transitive_includes/expected.py b/libcxx/test/libcxx/transitive_includes/expected.py index 483cbf7e4d20bee..3fc0a728c41dc8a 100755 --- a/libcxx/test/libcxx/transitive_includes/expected.py +++ b/libcxx/test/libcxx/transitive_includes/expected.py @@ -2681,11 +2681,11 @@ for line in files[args.standard].splitlines(): # print(f"READING LINE: {line}") if line.startswith(args.header + ' '): - print(f"WRITING THIS TO OUTPUT: {line}\n") + # print(f"WRITING THIS TO OUTPUT: {line}\n") output.write(line + '\n') with open(args.out, 'r') as output: - print("WRITTEN OUTPUT IS:") + # print("WRITTEN OUTPUT IS:") print(output.read()) # CSV_ROOT = os.path.dirname(__file__)