[llvm] [llvm-lit][test] Updated built-in cat command tests (PR #104473)

Paul Kirth via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 16 09:13:20 PDT 2024


================
@@ -1,83 +1,77 @@
 ## Test cat command with a single file.
 #
-# RUN: rm -rf %T/testCat
-# RUN: mkdir -p %T/testCat
-# RUN: echo "abcdefgh" > %T/testCat/temp.write
-# RUN: cat %T/testCat/temp.write > %T/testCat/tempcat.write
-# RUN: %{python} %S/../check_path.py file %T/testCat/tempcat.write > %T/testCat/path.out
-# RUN: FileCheck --check-prefix=FILE-EXISTS < %T/testCat/path.out %s
-# RUN: FileCheck --check-prefix=CAT-OUTPUT < %T/testCat/tempcat.write %s
+# RUN: rm -rf %t
+# RUN: mkdir -p %t
+# RUN: echo "abcdefgh" > %t/temp.write
+# RUN: cat %t/temp.write > %t/tempcat.write
+# RUN: %{python} %S/../check_path.py file %t/tempcat.write > %t/path.out
+# RUN: FileCheck --check-prefix=FILE-EXISTS < %t/path.out %s
+# RUN: FileCheck --check-prefix=CAT-OUTPUT --implicit-check-not={{.}} \
+# RUN:      --match-full-lines --strict-whitespace < %t/tempcat.write %s
 # FILE-EXISTS: True
-# CAT-OUTPUT: abcdefgh
+# CAT-OUTPUT:abcdefgh
 #
 ## Test cat command with multiple files.
 #
-# RUN: rm -rf %T/testCat
-# RUN: mkdir -p %T/testCat
-# RUN: echo "abcdefgh" > %T/testCat/temp1.write
-# RUN: echo "efghijkl" > %T/testCat/temp2.write
-# RUN: echo "mnopqrst" > %T/testCat/temp3.write
-# RUN: cat %T/testCat/temp1.write %T/testCat/temp2.write %T/testCat/temp3.write > %T/testCat/tempmulticat.write
-# RUN: %{python} %S/../check_path.py file %T/testCat/tempmulticat.write > %T/testCat/path.out
-# RUN: FileCheck --check-prefix=MULTI-FILE-EXISTS < %T/testCat/path.out %s
-# RUN: FileCheck --check-prefix=MULTI-CAT-OUTPUT < %T/testCat/tempmulticat.write %s
+# RUN: rm -rf %t
+# RUN: mkdir -p %t
+# RUN: echo "abcdefgh" > %t/temp1.write
+# RUN: echo "efghijkl" > %t/temp2.write
+# RUN: echo "mnopqrst" > %t/temp3.write
+# RUN: cat %t/temp1.write %t/temp2.write %t/temp3.write > %t/tempmulticat.write
+# RUN: %{python} %S/../check_path.py file %t/tempmulticat.write > %t/path.out
+# RUN: FileCheck --check-prefix=MULTI-FILE-EXISTS < %t/path.out %s
+# RUN: FileCheck --check-prefix=MULTI-CAT-OUTPUT --implicit-check-not={{.}} \
+# RUN:      --match-full-lines --strict-whitespace < %t/tempmulticat.write %s
 # MULTI-FILE-EXISTS: True
-# MULTI-CAT-OUTPUT: abcdefgh
-# MULTI-CAT-OUTPUT-NEXT: efghijkl
-# MULTI-CAT-OUTPUT-NEXT: mnopqrst
+#      MULTI-CAT-OUTPUT:abcdefgh
+# MULTI-CAT-OUTPUT-NEXT:efghijkl
+# MULTI-CAT-OUTPUT-NEXT:mnopqrst
 #
 ## Test cat command with multiple files and piped output to FileCheck.
 #
-# RUN: rm -rf %T/testCat
-# RUN: mkdir -p %T/testCat
-# RUN: echo "abcdefgh" > %T/testCat/temp1.write
-# RUN: echo "efghijkl" > %T/testCat/temp2.write
-# RUN: cat %T/testCat/temp1.write %T/testCat/temp2.write | FileCheck --check-prefix=PIPED-CAT-OUTPUT %s
-# PIPED-CAT-OUTPUT: abcdefgh
-# PIPED-CAT-OUTPUT-NEXT: efghijkl
+# RUN: rm -rf %t
+# RUN: mkdir -p %t
+# RUN: echo "abcdefgh" > %t/temp1.write
+# RUN: echo "efghijkl" > %t/temp2.write
+# RUN: cat %t/temp1.write %t/temp2.write \
----------------
ilovepi wrote:

@jh7370 Normally, I'd write it that way too, but I suggested this pattern, since its the one I think I've seen the most often. I don't have a strong feeling one way or the other, so lets go with yours, since it looks like we both lean that way.

@connieyzhu please use the style @jh7370 suggested. Sorry for the back and forth on formatting style 😅 

https://github.com/llvm/llvm-project/pull/104473


More information about the llvm-commits mailing list