[libcxx-commits] [libcxx] [libc++] Fix issue with running transitive includes tests on Docker-in-Docker (PR #110554)
via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Oct 2 09:52:22 PDT 2024
================
@@ -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):
----------------
EricWF wrote:
This should produce much better output:
```
from pathlib import Path
import argparse, difflib, sys
def main():
parser = argparse.ArgumentParser(description='Diff two files')
parser.add_argument('a', help='First file to diff')
parser.add_argument('b', help='Second file to diff')
args = parser.parse_args()
# open two files & spray the diff to stdout; return false iff a proble
a = Path(args.a).read_text().splitlines(keepends=True)
b = Path(args.b).read_text().splitlines(keepends=True)
has_diff = False
for line in difflib.context_diff(a, b, args.a, args.b):
has_diff = True
print(line, end='', file=sys.stderr)
if has_diff:
print(f'Files differ! [{args.a}, {args.b}]', file=sys.stderr)
sys.exit(1)
main()
```
https://github.com/llvm/llvm-project/pull/110554
More information about the libcxx-commits
mailing list