diff --git a/libcxx/test/libcxx/transitive_includes.sanitize.py b/libcxx/test/libcxx/transitive_includes.sanitize.py --- a/libcxx/test/libcxx/transitive_includes.sanitize.py +++ b/libcxx/test/libcxx/transitive_includes.sanitize.py @@ -17,11 +17,16 @@ headers = [] for line in sys.stdin.readlines(): - match = re.search('c\+\+/v[0-9]+/(.+)', line) + # On Windows, the path separators can either be forward slash or backslash. + # If it is a backslash, Clang prints it escaped as two consecutive + # backslashes, and they need to be escaped in the RE. (Use a raw string for + # the pattern to avoid needing another level of escaping on the Python string + # literal level.) + match = re.search(r'c\+\+(/|\\\\)v[0-9]+(/|\\\\)(.+)', line) if not match: continue - header = match.group(1) + header = match.group(3) if os.path.basename(header).endswith('.h'): # Skip C headers continue @@ -30,4 +35,7 @@ headers.append(header) -print('\n'.join(sorted(set(headers)))) +# Write the output to stdout in binary mode, with '\n' linebreaks on all +# platforms. +sys.stdout.buffer.write(bytes('\n'.join(sorted(set(headers))), 'ascii')) +sys.stdout.buffer.write(b'\n') diff --git a/libcxx/test/libcxx/transitive_includes.sh.cpp b/libcxx/test/libcxx/transitive_includes.sh.cpp --- a/libcxx/test/libcxx/transitive_includes.sh.cpp +++ b/libcxx/test/libcxx/transitive_includes.sh.cpp @@ -31,8 +31,8 @@ // This test uses --trace-includes, which is not supported by GCC. // UNSUPPORTED: gcc -// This test doesn't work on AIX or Windows, but it should. Needs investigation. -// XFAIL: buildhost=aix, buildhost=windows +// This test doesn't work on AIX, but it should. Needs investigation. +// XFAIL: buildhost=aix // This test is not supported when we remove the transitive includes provided for backwards // compatibility. When we bulk-remove them, we'll adjust the includes that are expected by