From dee2254996077ec947ec5255d4364e5ef29170ba Mon Sep 17 00:00:00 2001 From: Connie Zhu Date: Thu, 1 Aug 2024 17:36:10 +0000 Subject: [PATCH 1/7] [llvm-lit][test] Adding tests for lit's built-in cat command This patch creates preliminary checks for lit's built-in cat command. These tests verify the cat and cat -v functionality, and display failures with using cat -e which will be implemented in a later patch. --- .../Inputs/shtest-cat/cat-e-allchars.txt | 19 ++++++++++ .../tests/Inputs/shtest-cat/cat-e-newline.txt | 12 +++++++ .../tests/Inputs/shtest-cat/cat-newline.txt | 12 +++++++ .../Inputs/shtest-cat/cat-v-allchars.txt | 34 ++++++++++++++++++ .../utils/lit/tests/Inputs/shtest-cat/lit.cfg | 8 +++++ .../Inputs/shtest-cat/txt-files/allchars | Bin 0 -> 256 bytes .../tests/Inputs/shtest-cat/txt-files/newline | 10 ++++++ llvm/utils/lit/tests/shtest-cat.py | 32 +++++++++++++++++ 8 files changed, 127 insertions(+) create mode 100644 llvm/utils/lit/tests/Inputs/shtest-cat/cat-e-allchars.txt create mode 100644 llvm/utils/lit/tests/Inputs/shtest-cat/cat-e-newline.txt create mode 100644 llvm/utils/lit/tests/Inputs/shtest-cat/cat-newline.txt create mode 100644 llvm/utils/lit/tests/Inputs/shtest-cat/cat-v-allchars.txt create mode 100644 llvm/utils/lit/tests/Inputs/shtest-cat/lit.cfg create mode 100644 llvm/utils/lit/tests/Inputs/shtest-cat/txt-files/allchars create mode 100644 llvm/utils/lit/tests/Inputs/shtest-cat/txt-files/newline create mode 100644 llvm/utils/lit/tests/shtest-cat.py diff --git a/llvm/utils/lit/tests/Inputs/shtest-cat/cat-e-allchars.txt b/llvm/utils/lit/tests/Inputs/shtest-cat/cat-e-allchars.txt new file mode 100644 index 0000000000000..6955b796f695a --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/shtest-cat/cat-e-allchars.txt @@ -0,0 +1,19 @@ +# RUN: cat -e %S/txt-files/allchars | FileCheck %s + +# CHECK: ^@^A^B^C^D^E^F^G^H $ +# CHECK: ^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z +# CHECK-SAME: ^[^\^]^^^_ !"#$%&'()*+,-./ +# CHECK-SAME: 0123456789 +# CHECK-SAME: :;<=>?@ +# CHECK-SAME: ABCDEFGHIJKLMNOPQRSTUVWXYZ +# CHECK-SAME: [\]^_` +# CHECK-SAME: abcdefghijklmnopqrstuvwxyz +# CHECK-SAME: {|}~^? +# CHECK-SAME: M-^@M-^AM-^BM-^CM-^DM-^EM-^FM-^GM-^HM-^IM-^JM-^KM-^LM-^MM-^NM-^OM-^PM-^QM-^RM-^SM-^TM-^UM-^VM-^WM-^XM-^YM-^Z +# CHECK-SAME: M-^[M-^\M-^]M-^^M-^_M- M-!M-"M-#M-$M-%M-&M-'M-(M-)M-*M-+M-,M--M-.M-/ +# CHECK-SAME: M-0M-1M-2M-3M-4M-5M-6M-7M-8M-9 +# CHECK-SAME: M-:M-;M-M-?M-@ +# CHECK-SAME: M-AM-BM-CM-DM-EM-FM-GM-HM-IM-JM-KM-LM-MM-NM-OM-PM-QM-RM-SM-TM-UM-VM-WM-XM-YM-Z +# CHECK-SAME: M-[M-\M-]M-^M-_M-` +# CHECK-SAME: M-aM-bM-cM-dM-eM-fM-gM-hM-iM-jM-kM-lM-mM-nM-oM-pM-qM-rM-sM-tM-uM-vM-wM-xM-yM-z +# CHECK-SAME: M-{M-|M-}M-~M-^? \ No newline at end of file diff --git a/llvm/utils/lit/tests/Inputs/shtest-cat/cat-e-newline.txt b/llvm/utils/lit/tests/Inputs/shtest-cat/cat-e-newline.txt new file mode 100644 index 0000000000000..cd97646461376 --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/shtest-cat/cat-e-newline.txt @@ -0,0 +1,12 @@ +# RUN: cat -e %S/txt-files/newline | FileCheck %s + +# CHECK: new +# CHECK: $ +# CHECK: $ +# CHECK: $ +# CHECK: $ +# CHECK: $ +# CHECK: $ +# CHECK: $ +# CHECK: $ +# CHECK: line \ No newline at end of file diff --git a/llvm/utils/lit/tests/Inputs/shtest-cat/cat-newline.txt b/llvm/utils/lit/tests/Inputs/shtest-cat/cat-newline.txt new file mode 100644 index 0000000000000..de762dc1d639f --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/shtest-cat/cat-newline.txt @@ -0,0 +1,12 @@ +# RUN: cat %S/txt-files/newline | FileCheck %s + +# CHECK: new +# CHECK-EMPTY: +# CHECK-EMPTY: +# CHECK-EMPTY: +# CHECK-EMPTY: +# CHECK-EMPTY: +# CHECK-EMPTY: +# CHECK-EMPTY: +# CHECK-EMPTY: +# CHECK: line \ No newline at end of file diff --git a/llvm/utils/lit/tests/Inputs/shtest-cat/cat-v-allchars.txt b/llvm/utils/lit/tests/Inputs/shtest-cat/cat-v-allchars.txt new file mode 100644 index 0000000000000..70643efd3897a --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/shtest-cat/cat-v-allchars.txt @@ -0,0 +1,34 @@ +# C Program to generate all ASCII characters in allchars.txt +# #include +# int main() { +# FILE *fptr = fopen("allchars.txt", "w"); +# if(fptr == NULL) { +# return 1; +# } +# for(int i = 0; i < 256; i++) { +# fprintf(fptr, "%c", i); +# } +# fclose(fptr); +# return 0; +# } + +# RUN: cat -v %S/txt-files/allchars | FileCheck %s + +# CHECK: ^@^A^B^C^D^E^F^G^H +# CHECK: ^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z +# CHECK-SAME: ^[^\^]^^^_ +# CHECK-SAME: !"#$%&'()*+,-./ +# CHECK-SAME: 0123456789 +# CHECK-SAME: :;<=>?@ +# CHECK-SAME: ABCDEFGHIJKLMNOPQRSTUVWXYZ +# CHECK-SAME: [\]^_` +# CHECK-SAME: abcdefghijklmnopqrstuvwxyz +# CHECK-SAME: {|}~^? +# CHECK-SAME: M-^@M-^AM-^BM-^CM-^DM-^EM-^FM-^GM-^HM-^IM-^JM-^KM-^LM-^MM-^NM-^OM-^PM-^QM-^RM-^SM-^TM-^UM-^VM-^WM-^XM-^YM-^Z +# CHECK-SAME: M-^[M-^\M-^]M-^^M-^_M- M-!M-"M-#M-$M-%M-&M-'M-(M-)M-*M-+M-,M--M-.M-/ +# CHECK-SAME: M-0M-1M-2M-3M-4M-5M-6M-7M-8M-9 +# CHECK-SAME: M-:M-;M-M-?M-@ +# CHECK-SAME: M-AM-BM-CM-DM-EM-FM-GM-HM-IM-JM-KM-LM-MM-NM-OM-PM-QM-RM-SM-TM-UM-VM-WM-XM-YM-Z +# CHECK-SAME: M-[M-\M-]M-^M-_M-` +# CHECK-SAME: M-aM-bM-cM-dM-eM-fM-gM-hM-iM-jM-kM-lM-mM-nM-oM-pM-qM-rM-sM-tM-uM-vM-wM-xM-yM-z +# CHECK-SAME: M-{M-|M-}M-~M-^? \ No newline at end of file diff --git a/llvm/utils/lit/tests/Inputs/shtest-cat/lit.cfg b/llvm/utils/lit/tests/Inputs/shtest-cat/lit.cfg new file mode 100644 index 0000000000000..6b179bf5d4f3b --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/shtest-cat/lit.cfg @@ -0,0 +1,8 @@ +import lit.formats + +config.name = "shtest-cat" +config.suffixes = [".txt"] +config.test_format = lit.formats.ShTest() +config.test_source_root = None +config.test_exec_root = None +config.substitutions.append(("%{python}", '"%s"' % (sys.executable))) \ No newline at end of file diff --git a/llvm/utils/lit/tests/Inputs/shtest-cat/txt-files/allchars b/llvm/utils/lit/tests/Inputs/shtest-cat/txt-files/allchars new file mode 100644 index 0000000000000000000000000000000000000000..c86626638e0bc8cf47ca49bb1525b40e9737ee64 GIT binary patch literal 256 zcmV+b0ssC00RjUA1qKHQ2?`4g4Gs?w5fT#=6&4p585$cL9UdPbAtECrB_<~*DJm;0 zEiNxGF)}kWH8wXmIXXK$Jw87`K|(`BMMg(RNlHshO-@fxQBqS>RaRG6Sz23MU0z>c zVPa!sWoBn+X=-b1ZEkOHadLBXb#`}nd3t+%eSUv{fr5jCg@%WSiHeJijgF6yk&=^? zm6n&7nVOrNot~edp`xRtrKYE-sj922t*)=Iv9hzYwYImoxw^Z&y}rM|!NSAD#m2|T z$;!*j&Cbuz(bCh@)z;V8+1lIO-QM5e;o{@u<>u$;>FVq3?e6dJ@$&QZ_4fDp`TG0( G{r>;0_J4r@ literal 0 HcmV?d00001 diff --git a/llvm/utils/lit/tests/Inputs/shtest-cat/txt-files/newline b/llvm/utils/lit/tests/Inputs/shtest-cat/txt-files/newline new file mode 100644 index 0000000000000..6702897186ebc --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/shtest-cat/txt-files/newline @@ -0,0 +1,10 @@ +new + + + + + + + + +line \ No newline at end of file diff --git a/llvm/utils/lit/tests/shtest-cat.py b/llvm/utils/lit/tests/shtest-cat.py new file mode 100644 index 0000000000000..412fccd98c5ac --- /dev/null +++ b/llvm/utils/lit/tests/shtest-cat.py @@ -0,0 +1,32 @@ +# Check the cat command + +# RUN: not %{lit} -a -v %{inputs}/shtest-cat \ +# RUN: | FileCheck -match-full-lines %s +# +# END. + +# CHECK: FAIL: shtest-cat :: cat-e-allchars.txt ({{[^)]*}}) +# CHECK: cat -e {{.+}}/allchars | FileCheck {{.*}} +# CHECK: # executed command: cat -e {{.*}} +# CHECK: # | Unsupported: 'cat': option -e not recognized +# CHECK: # error: command failed with exit status: {{.*}} +# CHECK: # executed command: FileCheck {{.*}} +# CHECK: # error: command failed with exit status: {{.*}} + +# CHECK: FAIL: shtest-cat :: cat-e-newline.txt ({{[^)]*}}) +# CHECK: cat -e {{.+}}/newline | FileCheck {{.*}} +# CHECK: # executed command: cat -e {{.*}} +# CHECK: # | Unsupported: 'cat': option -e not recognized +# CHECK: # error: command failed with exit status: {{.*}} +# CHECK: # executed command: FileCheck {{.*}} +# CHECK: # error: command failed with exit status: {{.*}} + +# CHECK: PASS: shtest-cat :: cat-newline.txt ({{[^)]*}}) +# CHECK: cat {{.+}}/newline | FileCheck {{.*}} +# CHECK: # executed command: cat {{.*}} +# CHECK: # executed command: FileCheck {{.*}} + +# CHECK: PASS: shtest-cat :: cat-v-allchars.txt ({{[^)]*}}) +# CHECK: cat -v {{.+}}/allchars | FileCheck {{.*}} +# CHECK: # executed command: cat -v {{.*}} +# CHECK: # executed command: FileCheck {{.*}} \ No newline at end of file From 9c2fb031a520c6addd0128b0078a36d55d1d7451 Mon Sep 17 00:00:00 2001 From: Connie Zhu Date: Fri, 2 Aug 2024 17:28:09 +0000 Subject: [PATCH 2/7] [llvm-lit] Combined test files to separate by option for cat Tests for the same cat options were initially in different files, but now these tests are condensed into 3 files that contain all tests for each cat option, which are cat, cat -v, and cat -e. Also made some minor syntax changes and added clarifying comments. --- .../Inputs/shtest-cat/cat-e-allchars.txt | 19 ------- .../tests/Inputs/shtest-cat/cat-e-newline.txt | 12 ----- .../lit/tests/Inputs/shtest-cat/cat-e.txt | 33 +++++++++++++ .../tests/Inputs/shtest-cat/cat-newline.txt | 12 ----- .../Inputs/shtest-cat/cat-v-allchars.txt | 34 ------------- .../lit/tests/Inputs/shtest-cat/cat-v.txt | 49 +++++++++++++++++++ .../utils/lit/tests/Inputs/shtest-cat/cat.txt | 14 ++++++ .../tests/Inputs/shtest-cat/txt-files/newline | 4 +- llvm/utils/lit/tests/shtest-cat.py | 23 ++++----- 9 files changed, 107 insertions(+), 93 deletions(-) delete mode 100644 llvm/utils/lit/tests/Inputs/shtest-cat/cat-e-allchars.txt delete mode 100644 llvm/utils/lit/tests/Inputs/shtest-cat/cat-e-newline.txt create mode 100644 llvm/utils/lit/tests/Inputs/shtest-cat/cat-e.txt delete mode 100644 llvm/utils/lit/tests/Inputs/shtest-cat/cat-newline.txt delete mode 100644 llvm/utils/lit/tests/Inputs/shtest-cat/cat-v-allchars.txt create mode 100644 llvm/utils/lit/tests/Inputs/shtest-cat/cat-v.txt create mode 100644 llvm/utils/lit/tests/Inputs/shtest-cat/cat.txt diff --git a/llvm/utils/lit/tests/Inputs/shtest-cat/cat-e-allchars.txt b/llvm/utils/lit/tests/Inputs/shtest-cat/cat-e-allchars.txt deleted file mode 100644 index 6955b796f695a..0000000000000 --- a/llvm/utils/lit/tests/Inputs/shtest-cat/cat-e-allchars.txt +++ /dev/null @@ -1,19 +0,0 @@ -# RUN: cat -e %S/txt-files/allchars | FileCheck %s - -# CHECK: ^@^A^B^C^D^E^F^G^H $ -# CHECK: ^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z -# CHECK-SAME: ^[^\^]^^^_ !"#$%&'()*+,-./ -# CHECK-SAME: 0123456789 -# CHECK-SAME: :;<=>?@ -# CHECK-SAME: ABCDEFGHIJKLMNOPQRSTUVWXYZ -# CHECK-SAME: [\]^_` -# CHECK-SAME: abcdefghijklmnopqrstuvwxyz -# CHECK-SAME: {|}~^? -# CHECK-SAME: M-^@M-^AM-^BM-^CM-^DM-^EM-^FM-^GM-^HM-^IM-^JM-^KM-^LM-^MM-^NM-^OM-^PM-^QM-^RM-^SM-^TM-^UM-^VM-^WM-^XM-^YM-^Z -# CHECK-SAME: M-^[M-^\M-^]M-^^M-^_M- M-!M-"M-#M-$M-%M-&M-'M-(M-)M-*M-+M-,M--M-.M-/ -# CHECK-SAME: M-0M-1M-2M-3M-4M-5M-6M-7M-8M-9 -# CHECK-SAME: M-:M-;M-M-?M-@ -# CHECK-SAME: M-AM-BM-CM-DM-EM-FM-GM-HM-IM-JM-KM-LM-MM-NM-OM-PM-QM-RM-SM-TM-UM-VM-WM-XM-YM-Z -# CHECK-SAME: M-[M-\M-]M-^M-_M-` -# CHECK-SAME: M-aM-bM-cM-dM-eM-fM-gM-hM-iM-jM-kM-lM-mM-nM-oM-pM-qM-rM-sM-tM-uM-vM-wM-xM-yM-z -# CHECK-SAME: M-{M-|M-}M-~M-^? \ No newline at end of file diff --git a/llvm/utils/lit/tests/Inputs/shtest-cat/cat-e-newline.txt b/llvm/utils/lit/tests/Inputs/shtest-cat/cat-e-newline.txt deleted file mode 100644 index cd97646461376..0000000000000 --- a/llvm/utils/lit/tests/Inputs/shtest-cat/cat-e-newline.txt +++ /dev/null @@ -1,12 +0,0 @@ -# RUN: cat -e %S/txt-files/newline | FileCheck %s - -# CHECK: new -# CHECK: $ -# CHECK: $ -# CHECK: $ -# CHECK: $ -# CHECK: $ -# CHECK: $ -# CHECK: $ -# CHECK: $ -# CHECK: line \ No newline at end of file diff --git a/llvm/utils/lit/tests/Inputs/shtest-cat/cat-e.txt b/llvm/utils/lit/tests/Inputs/shtest-cat/cat-e.txt new file mode 100644 index 0000000000000..49c8d267a2e2c --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/shtest-cat/cat-e.txt @@ -0,0 +1,33 @@ +## Tests to check cat -e output for ASCII characters and newlines + +# RUN: cat -e %S/txt-files/allchars | FileCheck %s --check-prefix=ALLCHARS +# RUN: cat -e %S/txt-files/newline | FileCheck %s --check-prefix=NEWLINE + +# ALLCHARS: ^@^A^B^C^D^E^F^G^H $ +# ALLCHARS: ^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z +# ALLCHARS-SAME: ^[^\^]^^^_ !"#$%&'()*+,-./ +# ALLCHARS-SAME: 0123456789 +# ALLCHARS-SAME: :;<=>?@ +# ALLCHARS-SAME: ABCDEFGHIJKLMNOPQRSTUVWXYZ +# ALLCHARS-SAME: [\]^_` +# ALLCHARS-SAME: abcdefghijklmnopqrstuvwxyz +# ALLCHARS-SAME: {|}~^? +# ALLCHARS-SAME: M-^@M-^AM-^BM-^CM-^DM-^EM-^FM-^GM-^HM-^IM-^JM-^KM-^LM-^MM-^NM-^OM-^PM-^QM-^RM-^SM-^TM-^UM-^VM-^WM-^XM-^YM-^Z +# ALLCHARS-SAME: M-^[M-^\M-^]M-^^M-^_M- M-!M-"M-#M-$M-%M-&M-'M-(M-)M-*M-+M-,M--M-.M-/ +# ALLCHARS-SAME: M-0M-1M-2M-3M-4M-5M-6M-7M-8M-9 +# ALLCHARS-SAME: M-:M-;M-M-?M-@ +# ALLCHARS-SAME: M-AM-BM-CM-DM-EM-FM-GM-HM-IM-JM-KM-LM-MM-NM-OM-PM-QM-RM-SM-TM-UM-VM-WM-XM-YM-Z +# ALLCHARS-SAME: M-[M-\M-]M-^M-_M-` +# ALLCHARS-SAME: M-aM-bM-cM-dM-eM-fM-gM-hM-iM-jM-kM-lM-mM-nM-oM-pM-qM-rM-sM-tM-uM-vM-wM-xM-yM-z +# ALLCHARS-SAME: M-{M-|M-}M-~M-^? + +# NEWLINE: first +# NEWLINE: $ +# NEWLINE: $ +# NEWLINE: $ +# NEWLINE: $ +# NEWLINE: $ +# NEWLINE: $ +# NEWLINE: $ +# NEWLINE: $ +# NEWLINE: last \ No newline at end of file diff --git a/llvm/utils/lit/tests/Inputs/shtest-cat/cat-newline.txt b/llvm/utils/lit/tests/Inputs/shtest-cat/cat-newline.txt deleted file mode 100644 index de762dc1d639f..0000000000000 --- a/llvm/utils/lit/tests/Inputs/shtest-cat/cat-newline.txt +++ /dev/null @@ -1,12 +0,0 @@ -# RUN: cat %S/txt-files/newline | FileCheck %s - -# CHECK: new -# CHECK-EMPTY: -# CHECK-EMPTY: -# CHECK-EMPTY: -# CHECK-EMPTY: -# CHECK-EMPTY: -# CHECK-EMPTY: -# CHECK-EMPTY: -# CHECK-EMPTY: -# CHECK: line \ No newline at end of file diff --git a/llvm/utils/lit/tests/Inputs/shtest-cat/cat-v-allchars.txt b/llvm/utils/lit/tests/Inputs/shtest-cat/cat-v-allchars.txt deleted file mode 100644 index 70643efd3897a..0000000000000 --- a/llvm/utils/lit/tests/Inputs/shtest-cat/cat-v-allchars.txt +++ /dev/null @@ -1,34 +0,0 @@ -# C Program to generate all ASCII characters in allchars.txt -# #include -# int main() { -# FILE *fptr = fopen("allchars.txt", "w"); -# if(fptr == NULL) { -# return 1; -# } -# for(int i = 0; i < 256; i++) { -# fprintf(fptr, "%c", i); -# } -# fclose(fptr); -# return 0; -# } - -# RUN: cat -v %S/txt-files/allchars | FileCheck %s - -# CHECK: ^@^A^B^C^D^E^F^G^H -# CHECK: ^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z -# CHECK-SAME: ^[^\^]^^^_ -# CHECK-SAME: !"#$%&'()*+,-./ -# CHECK-SAME: 0123456789 -# CHECK-SAME: :;<=>?@ -# CHECK-SAME: ABCDEFGHIJKLMNOPQRSTUVWXYZ -# CHECK-SAME: [\]^_` -# CHECK-SAME: abcdefghijklmnopqrstuvwxyz -# CHECK-SAME: {|}~^? -# CHECK-SAME: M-^@M-^AM-^BM-^CM-^DM-^EM-^FM-^GM-^HM-^IM-^JM-^KM-^LM-^MM-^NM-^OM-^PM-^QM-^RM-^SM-^TM-^UM-^VM-^WM-^XM-^YM-^Z -# CHECK-SAME: M-^[M-^\M-^]M-^^M-^_M- M-!M-"M-#M-$M-%M-&M-'M-(M-)M-*M-+M-,M--M-.M-/ -# CHECK-SAME: M-0M-1M-2M-3M-4M-5M-6M-7M-8M-9 -# CHECK-SAME: M-:M-;M-M-?M-@ -# CHECK-SAME: M-AM-BM-CM-DM-EM-FM-GM-HM-IM-JM-KM-LM-MM-NM-OM-PM-QM-RM-SM-TM-UM-VM-WM-XM-YM-Z -# CHECK-SAME: M-[M-\M-]M-^M-_M-` -# CHECK-SAME: M-aM-bM-cM-dM-eM-fM-gM-hM-iM-jM-kM-lM-mM-nM-oM-pM-qM-rM-sM-tM-uM-vM-wM-xM-yM-z -# CHECK-SAME: M-{M-|M-}M-~M-^? \ No newline at end of file diff --git a/llvm/utils/lit/tests/Inputs/shtest-cat/cat-v.txt b/llvm/utils/lit/tests/Inputs/shtest-cat/cat-v.txt new file mode 100644 index 0000000000000..f893d553c8df7 --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/shtest-cat/cat-v.txt @@ -0,0 +1,49 @@ +# C Program to generate all ASCII characters in allchars.txt +# #include +# int main() { +# FILE *fptr = fopen("allchars.txt", "w"); +# if(fptr == NULL) { +# return 1; +# } +# for(int i = 0; i < 256; i++) { +# fprintf(fptr, "%c", i); +# } +# fclose(fptr); +# return 0; +# } + + +## Tests to check cat -e output for ASCII characters and newlines + +# RUN: cat -v %S/txt-files/allchars | FileCheck %s --check-prefix=ALLCHARS +# RUN: cat -v %S/txt-files/newline | FileCheck %s --check-prefix=NEWLINE + +# ALLCHARS: ^@^A^B^C^D^E^F^G^H +# ALLCHARS: ^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z +# ALLCHARS-SAME: ^[^\^]^^^_ +# ALLCHARS-SAME: !"#$%&'()*+,-./ +# ALLCHARS-SAME: 0123456789 +# ALLCHARS-SAME: :;<=>?@ +# ALLCHARS-SAME: ABCDEFGHIJKLMNOPQRSTUVWXYZ +# ALLCHARS-SAME: [\]^_` +# ALLCHARS-SAME: abcdefghijklmnopqrstuvwxyz +# ALLCHARS-SAME: {|}~^? +# ALLCHARS-SAME: M-^@M-^AM-^BM-^CM-^DM-^EM-^FM-^GM-^HM-^IM-^JM-^KM-^LM-^MM-^NM-^OM-^PM-^QM-^RM-^SM-^TM-^UM-^VM-^WM-^XM-^YM-^Z +# ALLCHARS-SAME: M-^[M-^\M-^]M-^^M-^_M- M-!M-"M-#M-$M-%M-&M-'M-(M-)M-*M-+M-,M--M-.M-/ +# ALLCHARS-SAME: M-0M-1M-2M-3M-4M-5M-6M-7M-8M-9 +# ALLCHARS-SAME: M-:M-;M-M-?M-@ +# ALLCHARS-SAME: M-AM-BM-CM-DM-EM-FM-GM-HM-IM-JM-KM-LM-MM-NM-OM-PM-QM-RM-SM-TM-UM-VM-WM-XM-YM-Z +# ALLCHARS-SAME: M-[M-\M-]M-^M-_M-` +# ALLCHARS-SAME: M-aM-bM-cM-dM-eM-fM-gM-hM-iM-jM-kM-lM-mM-nM-oM-pM-qM-rM-sM-tM-uM-vM-wM-xM-yM-z +# ALLCHARS-SAME: M-{M-|M-}M-~M-^? + +# NEWLINE: first +# NEWLINE-EMPTY: +# NEWLINE-EMPTY: +# NEWLINE-EMPTY: +# NEWLINE-EMPTY: +# NEWLINE-EMPTY: +# NEWLINE-EMPTY: +# NEWLINE-EMPTY: +# NEWLINE-EMPTY: +# NEWLINE: last \ No newline at end of file diff --git a/llvm/utils/lit/tests/Inputs/shtest-cat/cat.txt b/llvm/utils/lit/tests/Inputs/shtest-cat/cat.txt new file mode 100644 index 0000000000000..a71f16bae82d0 --- /dev/null +++ b/llvm/utils/lit/tests/Inputs/shtest-cat/cat.txt @@ -0,0 +1,14 @@ +## Tests + +# RUN: cat %S/txt-files/newline | FileCheck %s --check-prefix=NEWLINE + +# NEWLINE: first +# NEWLINE-EMPTY: +# NEWLINE-EMPTY: +# NEWLINE-EMPTY: +# NEWLINE-EMPTY: +# NEWLINE-EMPTY: +# NEWLINE-EMPTY: +# NEWLINE-EMPTY: +# NEWLINE-EMPTY: +# NEWLINE: last \ No newline at end of file diff --git a/llvm/utils/lit/tests/Inputs/shtest-cat/txt-files/newline b/llvm/utils/lit/tests/Inputs/shtest-cat/txt-files/newline index 6702897186ebc..8cf6e6741f192 100644 --- a/llvm/utils/lit/tests/Inputs/shtest-cat/txt-files/newline +++ b/llvm/utils/lit/tests/Inputs/shtest-cat/txt-files/newline @@ -1,4 +1,4 @@ -new +first @@ -7,4 +7,4 @@ new -line \ No newline at end of file +last \ No newline at end of file diff --git a/llvm/utils/lit/tests/shtest-cat.py b/llvm/utils/lit/tests/shtest-cat.py index 412fccd98c5ac..0b2b94e2b0cb7 100644 --- a/llvm/utils/lit/tests/shtest-cat.py +++ b/llvm/utils/lit/tests/shtest-cat.py @@ -1,11 +1,11 @@ -# Check the cat command +## Test the cat command # RUN: not %{lit} -a -v %{inputs}/shtest-cat \ # RUN: | FileCheck -match-full-lines %s # # END. -# CHECK: FAIL: shtest-cat :: cat-e-allchars.txt ({{[^)]*}}) +# CHECK: FAIL: shtest-cat :: cat-e.txt ({{[^)]*}}) # CHECK: cat -e {{.+}}/allchars | FileCheck {{.*}} # CHECK: # executed command: cat -e {{.*}} # CHECK: # | Unsupported: 'cat': option -e not recognized @@ -13,20 +13,15 @@ # CHECK: # executed command: FileCheck {{.*}} # CHECK: # error: command failed with exit status: {{.*}} -# CHECK: FAIL: shtest-cat :: cat-e-newline.txt ({{[^)]*}}) -# CHECK: cat -e {{.+}}/newline | FileCheck {{.*}} -# CHECK: # executed command: cat -e {{.*}} -# CHECK: # | Unsupported: 'cat': option -e not recognized -# CHECK: # error: command failed with exit status: {{.*}} +# CHECK: PASS: shtest-cat :: cat-v.txt ({{[^)]*}}) +# CHECK: cat -v {{.+}}/allchars | FileCheck {{.*}} +# CHECK: # executed command: cat -v {{.*}} +# CHECK: # executed command: FileCheck {{.*}} +# CHECK: cat -v {{.+}}/newline | FileCheck {{.*}} +# CHECK: # executed command: cat -v {{.*}} # CHECK: # executed command: FileCheck {{.*}} -# CHECK: # error: command failed with exit status: {{.*}} -# CHECK: PASS: shtest-cat :: cat-newline.txt ({{[^)]*}}) +# CHECK: PASS: shtest-cat :: cat.txt ({{[^)]*}}) # CHECK: cat {{.+}}/newline | FileCheck {{.*}} # CHECK: # executed command: cat {{.*}} -# CHECK: # executed command: FileCheck {{.*}} - -# CHECK: PASS: shtest-cat :: cat-v-allchars.txt ({{[^)]*}}) -# CHECK: cat -v {{.+}}/allchars | FileCheck {{.*}} -# CHECK: # executed command: cat -v {{.*}} # CHECK: # executed command: FileCheck {{.*}} \ No newline at end of file From 1b7d6a68ad48be906725c13c0fdb524f92828c1f Mon Sep 17 00:00:00 2001 From: Connie Zhu Date: Fri, 2 Aug 2024 20:47:59 +0000 Subject: [PATCH 3/7] [llvm-lit] Added more clarifying comments + minor syntax changes More comments describing the purpose of the tests were added for clarification purposes. Some small syntax changes were also made for better readability. --- llvm/utils/lit/tests/Inputs/shtest-cat/cat-e.txt | 7 +++++-- llvm/utils/lit/tests/Inputs/shtest-cat/cat-v.txt | 7 ++++--- llvm/utils/lit/tests/Inputs/shtest-cat/cat.txt | 2 +- llvm/utils/lit/tests/Inputs/shtest-cat/lit.cfg | 3 +-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/llvm/utils/lit/tests/Inputs/shtest-cat/cat-e.txt b/llvm/utils/lit/tests/Inputs/shtest-cat/cat-e.txt index 49c8d267a2e2c..739e1a37a7f5e 100644 --- a/llvm/utils/lit/tests/Inputs/shtest-cat/cat-e.txt +++ b/llvm/utils/lit/tests/Inputs/shtest-cat/cat-e.txt @@ -1,9 +1,11 @@ -## Tests to check cat -e output for ASCII characters and newlines +## Tests to check cat -e output # RUN: cat -e %S/txt-files/allchars | FileCheck %s --check-prefix=ALLCHARS # RUN: cat -e %S/txt-files/newline | FileCheck %s --check-prefix=NEWLINE -# ALLCHARS: ^@^A^B^C^D^E^F^G^H $ +## Test output of -e for all ASCII characters in ^ and M- notation +# ALLCHARS: ^@^A^B^C^D^E^F^G^H +# ALLCHARS-SAME: $ # ALLCHARS: ^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z # ALLCHARS-SAME: ^[^\^]^^^_ !"#$%&'()*+,-./ # ALLCHARS-SAME: 0123456789 @@ -21,6 +23,7 @@ # ALLCHARS-SAME: M-aM-bM-cM-dM-eM-fM-gM-hM-iM-jM-kM-lM-mM-nM-oM-pM-qM-rM-sM-tM-uM-vM-wM-xM-yM-z # ALLCHARS-SAME: M-{M-|M-}M-~M-^? +## Test output of -e for new lines # NEWLINE: first # NEWLINE: $ # NEWLINE: $ diff --git a/llvm/utils/lit/tests/Inputs/shtest-cat/cat-v.txt b/llvm/utils/lit/tests/Inputs/shtest-cat/cat-v.txt index f893d553c8df7..ac78eb4fd5f4c 100644 --- a/llvm/utils/lit/tests/Inputs/shtest-cat/cat-v.txt +++ b/llvm/utils/lit/tests/Inputs/shtest-cat/cat-v.txt @@ -1,4 +1,4 @@ -# C Program to generate all ASCII characters in allchars.txt +## C Program to generate all ASCII characters in allchars # #include # int main() { # FILE *fptr = fopen("allchars.txt", "w"); @@ -12,12 +12,12 @@ # return 0; # } - -## Tests to check cat -e output for ASCII characters and newlines +## Tests to check cat -v output # RUN: cat -v %S/txt-files/allchars | FileCheck %s --check-prefix=ALLCHARS # RUN: cat -v %S/txt-files/newline | FileCheck %s --check-prefix=NEWLINE +## Test output of -v for all ASCII characters in ^ and M- notation # ALLCHARS: ^@^A^B^C^D^E^F^G^H # ALLCHARS: ^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z # ALLCHARS-SAME: ^[^\^]^^^_ @@ -37,6 +37,7 @@ # ALLCHARS-SAME: M-aM-bM-cM-dM-eM-fM-gM-hM-iM-jM-kM-lM-mM-nM-oM-pM-qM-rM-sM-tM-uM-vM-wM-xM-yM-z # ALLCHARS-SAME: M-{M-|M-}M-~M-^? +## Test output of -v for new lines # NEWLINE: first # NEWLINE-EMPTY: # NEWLINE-EMPTY: diff --git a/llvm/utils/lit/tests/Inputs/shtest-cat/cat.txt b/llvm/utils/lit/tests/Inputs/shtest-cat/cat.txt index a71f16bae82d0..532d54088da52 100644 --- a/llvm/utils/lit/tests/Inputs/shtest-cat/cat.txt +++ b/llvm/utils/lit/tests/Inputs/shtest-cat/cat.txt @@ -1,4 +1,4 @@ -## Tests +## Tests to check cat output # RUN: cat %S/txt-files/newline | FileCheck %s --check-prefix=NEWLINE diff --git a/llvm/utils/lit/tests/Inputs/shtest-cat/lit.cfg b/llvm/utils/lit/tests/Inputs/shtest-cat/lit.cfg index 6b179bf5d4f3b..29246a84d7fab 100644 --- a/llvm/utils/lit/tests/Inputs/shtest-cat/lit.cfg +++ b/llvm/utils/lit/tests/Inputs/shtest-cat/lit.cfg @@ -4,5 +4,4 @@ config.name = "shtest-cat" config.suffixes = [".txt"] config.test_format = lit.formats.ShTest() config.test_source_root = None -config.test_exec_root = None -config.substitutions.append(("%{python}", '"%s"' % (sys.executable))) \ No newline at end of file +config.test_exec_root = None \ No newline at end of file From ff3f7e64492eb28ab3262cf37240dcbafd8f8227 Mon Sep 17 00:00:00 2001 From: Connie Zhu Date: Fri, 2 Aug 2024 20:57:48 +0000 Subject: [PATCH 4/7] [llvm-lit] Added allchars test for cat This patch adds another test to check the cat functionality with the allchars text file that includes special/meta characters. --- llvm/utils/lit/tests/Inputs/shtest-cat/cat.txt | 2 ++ llvm/utils/lit/tests/shtest-cat.py | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/llvm/utils/lit/tests/Inputs/shtest-cat/cat.txt b/llvm/utils/lit/tests/Inputs/shtest-cat/cat.txt index 532d54088da52..c8455d7c5dc3a 100644 --- a/llvm/utils/lit/tests/Inputs/shtest-cat/cat.txt +++ b/llvm/utils/lit/tests/Inputs/shtest-cat/cat.txt @@ -1,6 +1,8 @@ ## Tests to check cat output # RUN: cat %S/txt-files/newline | FileCheck %s --check-prefix=NEWLINE +# RUN: cat %S/txt-files/allchars > %t +# RUN: diff %S/txt-files/allchars %t # NEWLINE: first # NEWLINE-EMPTY: diff --git a/llvm/utils/lit/tests/shtest-cat.py b/llvm/utils/lit/tests/shtest-cat.py index 0b2b94e2b0cb7..e83484b1cb212 100644 --- a/llvm/utils/lit/tests/shtest-cat.py +++ b/llvm/utils/lit/tests/shtest-cat.py @@ -1,7 +1,7 @@ ## Test the cat command # RUN: not %{lit} -a -v %{inputs}/shtest-cat \ -# RUN: | FileCheck -match-full-lines %s +# RUN: | FileCheck -match-full-lines %s --dump-input-context=1000 # # END. @@ -24,4 +24,8 @@ # CHECK: PASS: shtest-cat :: cat.txt ({{[^)]*}}) # CHECK: cat {{.+}}/newline | FileCheck {{.*}} # CHECK: # executed command: cat {{.*}} -# CHECK: # executed command: FileCheck {{.*}} \ No newline at end of file +# CHECK: # executed command: FileCheck {{.*}} +# CHECK: cat {{.+}}/allchars > {{.*}} +# CHECK: # executed command: cat {{.*}} +# CHECK: diff {{.+}}/allchars {{.*}} +# CHECK: # executed command: diff {{.*}} \ No newline at end of file From 08082d1c3248cebb050c2032701abb6711bb625b Mon Sep 17 00:00:00 2001 From: Connie Zhu Date: Fri, 2 Aug 2024 21:29:32 +0000 Subject: [PATCH 5/7] [llvm-lit] Changed CHECK directives for more check precision Made changes to CHECK directives to check output more precisely. --- .../lit/tests/Inputs/shtest-cat/cat-e.txt | 20 ++++++++-------- .../lit/tests/Inputs/shtest-cat/cat-v.txt | 4 ++-- .../utils/lit/tests/Inputs/shtest-cat/cat.txt | 2 +- llvm/utils/lit/tests/shtest-cat.py | 24 +++++++++---------- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/llvm/utils/lit/tests/Inputs/shtest-cat/cat-e.txt b/llvm/utils/lit/tests/Inputs/shtest-cat/cat-e.txt index 739e1a37a7f5e..21c36df3fb81c 100644 --- a/llvm/utils/lit/tests/Inputs/shtest-cat/cat-e.txt +++ b/llvm/utils/lit/tests/Inputs/shtest-cat/cat-e.txt @@ -6,7 +6,7 @@ ## Test output of -e for all ASCII characters in ^ and M- notation # ALLCHARS: ^@^A^B^C^D^E^F^G^H # ALLCHARS-SAME: $ -# ALLCHARS: ^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z +# ALLCHARS-NEXT: ^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z # ALLCHARS-SAME: ^[^\^]^^^_ !"#$%&'()*+,-./ # ALLCHARS-SAME: 0123456789 # ALLCHARS-SAME: :;<=>?@ @@ -25,12 +25,12 @@ ## Test output of -e for new lines # NEWLINE: first -# NEWLINE: $ -# NEWLINE: $ -# NEWLINE: $ -# NEWLINE: $ -# NEWLINE: $ -# NEWLINE: $ -# NEWLINE: $ -# NEWLINE: $ -# NEWLINE: last \ No newline at end of file +# NEWLINE-NEXT: $ +# NEWLINE-NEXT: $ +# NEWLINE-NEXT: $ +# NEWLINE-NEXT: $ +# NEWLINE-NEXT: $ +# NEWLINE-NEXT: $ +# NEWLINE-NEXT: $ +# NEWLINE-NEXT: $ +# NEWLINE-NEXT: last \ No newline at end of file diff --git a/llvm/utils/lit/tests/Inputs/shtest-cat/cat-v.txt b/llvm/utils/lit/tests/Inputs/shtest-cat/cat-v.txt index ac78eb4fd5f4c..47abae7dc5e5d 100644 --- a/llvm/utils/lit/tests/Inputs/shtest-cat/cat-v.txt +++ b/llvm/utils/lit/tests/Inputs/shtest-cat/cat-v.txt @@ -19,7 +19,7 @@ ## Test output of -v for all ASCII characters in ^ and M- notation # ALLCHARS: ^@^A^B^C^D^E^F^G^H -# ALLCHARS: ^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z +# ALLCHARS-NEXT: ^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z # ALLCHARS-SAME: ^[^\^]^^^_ # ALLCHARS-SAME: !"#$%&'()*+,-./ # ALLCHARS-SAME: 0123456789 @@ -47,4 +47,4 @@ # NEWLINE-EMPTY: # NEWLINE-EMPTY: # NEWLINE-EMPTY: -# NEWLINE: last \ No newline at end of file +# NEWLINE-NEXT: last \ No newline at end of file diff --git a/llvm/utils/lit/tests/Inputs/shtest-cat/cat.txt b/llvm/utils/lit/tests/Inputs/shtest-cat/cat.txt index c8455d7c5dc3a..60bacce16df3d 100644 --- a/llvm/utils/lit/tests/Inputs/shtest-cat/cat.txt +++ b/llvm/utils/lit/tests/Inputs/shtest-cat/cat.txt @@ -13,4 +13,4 @@ # NEWLINE-EMPTY: # NEWLINE-EMPTY: # NEWLINE-EMPTY: -# NEWLINE: last \ No newline at end of file +# NEWLINE-NEXT: last \ No newline at end of file diff --git a/llvm/utils/lit/tests/shtest-cat.py b/llvm/utils/lit/tests/shtest-cat.py index e83484b1cb212..b22d2df0505d7 100644 --- a/llvm/utils/lit/tests/shtest-cat.py +++ b/llvm/utils/lit/tests/shtest-cat.py @@ -1,13 +1,13 @@ ## Test the cat command # RUN: not %{lit} -a -v %{inputs}/shtest-cat \ -# RUN: | FileCheck -match-full-lines %s --dump-input-context=1000 +# RUN: | FileCheck -match-full-lines %s # # END. # CHECK: FAIL: shtest-cat :: cat-e.txt ({{[^)]*}}) # CHECK: cat -e {{.+}}/allchars | FileCheck {{.*}} -# CHECK: # executed command: cat -e {{.*}} +# CHECK: # executed command: cat -e {{.+}}/allchars # CHECK: # | Unsupported: 'cat': option -e not recognized # CHECK: # error: command failed with exit status: {{.*}} # CHECK: # executed command: FileCheck {{.*}} @@ -15,17 +15,17 @@ # CHECK: PASS: shtest-cat :: cat-v.txt ({{[^)]*}}) # CHECK: cat -v {{.+}}/allchars | FileCheck {{.*}} -# CHECK: # executed command: cat -v {{.*}} -# CHECK: # executed command: FileCheck {{.*}} +# CHECK-NEXT: # executed command: cat -v {{.+}}/allchars +# CHECK-NEXT: # executed command: FileCheck {{.*}} # CHECK: cat -v {{.+}}/newline | FileCheck {{.*}} -# CHECK: # executed command: cat -v {{.*}} -# CHECK: # executed command: FileCheck {{.*}} +# CHECK-NEXT: # executed command: cat -v {{.+}}/newline +# CHECK-NEXT: # executed command: FileCheck {{.*}} # CHECK: PASS: shtest-cat :: cat.txt ({{[^)]*}}) # CHECK: cat {{.+}}/newline | FileCheck {{.*}} -# CHECK: # executed command: cat {{.*}} -# CHECK: # executed command: FileCheck {{.*}} -# CHECK: cat {{.+}}/allchars > {{.*}} -# CHECK: # executed command: cat {{.*}} -# CHECK: diff {{.+}}/allchars {{.*}} -# CHECK: # executed command: diff {{.*}} \ No newline at end of file +# CHECK-NEXT: # executed command: cat {{.+}}/newline +# CHECK-NEXT: # executed command: FileCheck {{.*}} +# CHECK: cat {{.+}}/allchars > {{.+}} +# CHECK-NEXT: # executed command: cat {{.+}}/allchars +# CHECK: diff {{.+}}/allchars {{.+}} +# CHECK-NEXT: # executed command: diff {{.+}}/allchars {{.+}} \ No newline at end of file From 626882fe78dae3983d99c19246d8a750bea1a46c Mon Sep 17 00:00:00 2001 From: Connie Zhu Date: Fri, 2 Aug 2024 21:44:22 +0000 Subject: [PATCH 6/7] [llvm-lit] Fixed darker formatting issue --- llvm/utils/lit/tests/shtest-cat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/utils/lit/tests/shtest-cat.py b/llvm/utils/lit/tests/shtest-cat.py index b22d2df0505d7..8758a6fcfe7fa 100644 --- a/llvm/utils/lit/tests/shtest-cat.py +++ b/llvm/utils/lit/tests/shtest-cat.py @@ -18,7 +18,7 @@ # CHECK-NEXT: # executed command: cat -v {{.+}}/allchars # CHECK-NEXT: # executed command: FileCheck {{.*}} # CHECK: cat -v {{.+}}/newline | FileCheck {{.*}} -# CHECK-NEXT: # executed command: cat -v {{.+}}/newline +# CHECK-NEXT: # executed command: cat -v {{.+}}/newline # CHECK-NEXT: # executed command: FileCheck {{.*}} # CHECK: PASS: shtest-cat :: cat.txt ({{[^)]*}}) From 5d13daab952c34eef250ebfe0d06a642a9f59a57 Mon Sep 17 00:00:00 2001 From: Connie Zhu Date: Tue, 6 Aug 2024 18:26:15 +0000 Subject: [PATCH 7/7] [llvm-lit][test] Added cat -e tests to existing cat testing file This patch removes cat test files created in previous patches in this PR and adds -e tests to valid-shell.txt, which already has existing cat tests. --- .../lit/tests/Inputs/shtest-cat/cat-e.txt | 36 ------------- .../lit/tests/Inputs/shtest-cat/cat-v.txt | 50 ------------------ .../utils/lit/tests/Inputs/shtest-cat/cat.txt | 16 ------ .../utils/lit/tests/Inputs/shtest-cat/lit.cfg | 7 --- .../Inputs/shtest-cat/txt-files/allchars | Bin 256 -> 0 bytes .../tests/Inputs/shtest-cat/txt-files/newline | 10 ---- .../tests/Inputs/shtest-shell/valid-shell.txt | 20 +++++++ llvm/utils/lit/tests/shtest-cat.py | 31 ----------- llvm/utils/lit/tests/shtest-shell.py | 4 +- 9 files changed, 22 insertions(+), 152 deletions(-) delete mode 100644 llvm/utils/lit/tests/Inputs/shtest-cat/cat-e.txt delete mode 100644 llvm/utils/lit/tests/Inputs/shtest-cat/cat-v.txt delete mode 100644 llvm/utils/lit/tests/Inputs/shtest-cat/cat.txt delete mode 100644 llvm/utils/lit/tests/Inputs/shtest-cat/lit.cfg delete mode 100644 llvm/utils/lit/tests/Inputs/shtest-cat/txt-files/allchars delete mode 100644 llvm/utils/lit/tests/Inputs/shtest-cat/txt-files/newline delete mode 100644 llvm/utils/lit/tests/shtest-cat.py diff --git a/llvm/utils/lit/tests/Inputs/shtest-cat/cat-e.txt b/llvm/utils/lit/tests/Inputs/shtest-cat/cat-e.txt deleted file mode 100644 index 21c36df3fb81c..0000000000000 --- a/llvm/utils/lit/tests/Inputs/shtest-cat/cat-e.txt +++ /dev/null @@ -1,36 +0,0 @@ -## Tests to check cat -e output - -# RUN: cat -e %S/txt-files/allchars | FileCheck %s --check-prefix=ALLCHARS -# RUN: cat -e %S/txt-files/newline | FileCheck %s --check-prefix=NEWLINE - -## Test output of -e for all ASCII characters in ^ and M- notation -# ALLCHARS: ^@^A^B^C^D^E^F^G^H -# ALLCHARS-SAME: $ -# ALLCHARS-NEXT: ^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z -# ALLCHARS-SAME: ^[^\^]^^^_ !"#$%&'()*+,-./ -# ALLCHARS-SAME: 0123456789 -# ALLCHARS-SAME: :;<=>?@ -# ALLCHARS-SAME: ABCDEFGHIJKLMNOPQRSTUVWXYZ -# ALLCHARS-SAME: [\]^_` -# ALLCHARS-SAME: abcdefghijklmnopqrstuvwxyz -# ALLCHARS-SAME: {|}~^? -# ALLCHARS-SAME: M-^@M-^AM-^BM-^CM-^DM-^EM-^FM-^GM-^HM-^IM-^JM-^KM-^LM-^MM-^NM-^OM-^PM-^QM-^RM-^SM-^TM-^UM-^VM-^WM-^XM-^YM-^Z -# ALLCHARS-SAME: M-^[M-^\M-^]M-^^M-^_M- M-!M-"M-#M-$M-%M-&M-'M-(M-)M-*M-+M-,M--M-.M-/ -# ALLCHARS-SAME: M-0M-1M-2M-3M-4M-5M-6M-7M-8M-9 -# ALLCHARS-SAME: M-:M-;M-M-?M-@ -# ALLCHARS-SAME: M-AM-BM-CM-DM-EM-FM-GM-HM-IM-JM-KM-LM-MM-NM-OM-PM-QM-RM-SM-TM-UM-VM-WM-XM-YM-Z -# ALLCHARS-SAME: M-[M-\M-]M-^M-_M-` -# ALLCHARS-SAME: M-aM-bM-cM-dM-eM-fM-gM-hM-iM-jM-kM-lM-mM-nM-oM-pM-qM-rM-sM-tM-uM-vM-wM-xM-yM-z -# ALLCHARS-SAME: M-{M-|M-}M-~M-^? - -## Test output of -e for new lines -# NEWLINE: first -# NEWLINE-NEXT: $ -# NEWLINE-NEXT: $ -# NEWLINE-NEXT: $ -# NEWLINE-NEXT: $ -# NEWLINE-NEXT: $ -# NEWLINE-NEXT: $ -# NEWLINE-NEXT: $ -# NEWLINE-NEXT: $ -# NEWLINE-NEXT: last \ No newline at end of file diff --git a/llvm/utils/lit/tests/Inputs/shtest-cat/cat-v.txt b/llvm/utils/lit/tests/Inputs/shtest-cat/cat-v.txt deleted file mode 100644 index 47abae7dc5e5d..0000000000000 --- a/llvm/utils/lit/tests/Inputs/shtest-cat/cat-v.txt +++ /dev/null @@ -1,50 +0,0 @@ -## C Program to generate all ASCII characters in allchars -# #include -# int main() { -# FILE *fptr = fopen("allchars.txt", "w"); -# if(fptr == NULL) { -# return 1; -# } -# for(int i = 0; i < 256; i++) { -# fprintf(fptr, "%c", i); -# } -# fclose(fptr); -# return 0; -# } - -## Tests to check cat -v output - -# RUN: cat -v %S/txt-files/allchars | FileCheck %s --check-prefix=ALLCHARS -# RUN: cat -v %S/txt-files/newline | FileCheck %s --check-prefix=NEWLINE - -## Test output of -v for all ASCII characters in ^ and M- notation -# ALLCHARS: ^@^A^B^C^D^E^F^G^H -# ALLCHARS-NEXT: ^K^L^M^N^O^P^Q^R^S^T^U^V^W^X^Y^Z -# ALLCHARS-SAME: ^[^\^]^^^_ -# ALLCHARS-SAME: !"#$%&'()*+,-./ -# ALLCHARS-SAME: 0123456789 -# ALLCHARS-SAME: :;<=>?@ -# ALLCHARS-SAME: ABCDEFGHIJKLMNOPQRSTUVWXYZ -# ALLCHARS-SAME: [\]^_` -# ALLCHARS-SAME: abcdefghijklmnopqrstuvwxyz -# ALLCHARS-SAME: {|}~^? -# ALLCHARS-SAME: M-^@M-^AM-^BM-^CM-^DM-^EM-^FM-^GM-^HM-^IM-^JM-^KM-^LM-^MM-^NM-^OM-^PM-^QM-^RM-^SM-^TM-^UM-^VM-^WM-^XM-^YM-^Z -# ALLCHARS-SAME: M-^[M-^\M-^]M-^^M-^_M- M-!M-"M-#M-$M-%M-&M-'M-(M-)M-*M-+M-,M--M-.M-/ -# ALLCHARS-SAME: M-0M-1M-2M-3M-4M-5M-6M-7M-8M-9 -# ALLCHARS-SAME: M-:M-;M-M-?M-@ -# ALLCHARS-SAME: M-AM-BM-CM-DM-EM-FM-GM-HM-IM-JM-KM-LM-MM-NM-OM-PM-QM-RM-SM-TM-UM-VM-WM-XM-YM-Z -# ALLCHARS-SAME: M-[M-\M-]M-^M-_M-` -# ALLCHARS-SAME: M-aM-bM-cM-dM-eM-fM-gM-hM-iM-jM-kM-lM-mM-nM-oM-pM-qM-rM-sM-tM-uM-vM-wM-xM-yM-z -# ALLCHARS-SAME: M-{M-|M-}M-~M-^? - -## Test output of -v for new lines -# NEWLINE: first -# NEWLINE-EMPTY: -# NEWLINE-EMPTY: -# NEWLINE-EMPTY: -# NEWLINE-EMPTY: -# NEWLINE-EMPTY: -# NEWLINE-EMPTY: -# NEWLINE-EMPTY: -# NEWLINE-EMPTY: -# NEWLINE-NEXT: last \ No newline at end of file diff --git a/llvm/utils/lit/tests/Inputs/shtest-cat/cat.txt b/llvm/utils/lit/tests/Inputs/shtest-cat/cat.txt deleted file mode 100644 index 60bacce16df3d..0000000000000 --- a/llvm/utils/lit/tests/Inputs/shtest-cat/cat.txt +++ /dev/null @@ -1,16 +0,0 @@ -## Tests to check cat output - -# RUN: cat %S/txt-files/newline | FileCheck %s --check-prefix=NEWLINE -# RUN: cat %S/txt-files/allchars > %t -# RUN: diff %S/txt-files/allchars %t - -# NEWLINE: first -# NEWLINE-EMPTY: -# NEWLINE-EMPTY: -# NEWLINE-EMPTY: -# NEWLINE-EMPTY: -# NEWLINE-EMPTY: -# NEWLINE-EMPTY: -# NEWLINE-EMPTY: -# NEWLINE-EMPTY: -# NEWLINE-NEXT: last \ No newline at end of file diff --git a/llvm/utils/lit/tests/Inputs/shtest-cat/lit.cfg b/llvm/utils/lit/tests/Inputs/shtest-cat/lit.cfg deleted file mode 100644 index 29246a84d7fab..0000000000000 --- a/llvm/utils/lit/tests/Inputs/shtest-cat/lit.cfg +++ /dev/null @@ -1,7 +0,0 @@ -import lit.formats - -config.name = "shtest-cat" -config.suffixes = [".txt"] -config.test_format = lit.formats.ShTest() -config.test_source_root = None -config.test_exec_root = None \ No newline at end of file diff --git a/llvm/utils/lit/tests/Inputs/shtest-cat/txt-files/allchars b/llvm/utils/lit/tests/Inputs/shtest-cat/txt-files/allchars deleted file mode 100644 index c86626638e0bc8cf47ca49bb1525b40e9737ee64..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 256 zcmV+b0ssC00RjUA1qKHQ2?`4g4Gs?w5fT#=6&4p585$cL9UdPbAtECrB_<~*DJm;0 zEiNxGF)}kWH8wXmIXXK$Jw87`K|(`BMMg(RNlHshO-@fxQBqS>RaRG6Sz23MU0z>c zVPa!sWoBn+X=-b1ZEkOHadLBXb#`}nd3t+%eSUv{fr5jCg@%WSiHeJijgF6yk&=^? zm6n&7nVOrNot~edp`xRtrKYE-sj922t*)=Iv9hzYwYImoxw^Z&y}rM|!NSAD#m2|T z$;!*j&Cbuz(bCh@)z;V8+1lIO-QM5e;o{@u<>u$;>FVq3?e6dJ@$&QZ_4fDp`TG0( G{r>;0_J4r@ diff --git a/llvm/utils/lit/tests/Inputs/shtest-cat/txt-files/newline b/llvm/utils/lit/tests/Inputs/shtest-cat/txt-files/newline deleted file mode 100644 index 8cf6e6741f192..0000000000000 --- a/llvm/utils/lit/tests/Inputs/shtest-cat/txt-files/newline +++ /dev/null @@ -1,10 +0,0 @@ -first - - - - - - - - -last \ No newline at end of file diff --git a/llvm/utils/lit/tests/Inputs/shtest-shell/valid-shell.txt b/llvm/utils/lit/tests/Inputs/shtest-shell/valid-shell.txt index 7267b9b9ef5ab..eea8d379554fe 100644 --- a/llvm/utils/lit/tests/Inputs/shtest-shell/valid-shell.txt +++ b/llvm/utils/lit/tests/Inputs/shtest-shell/valid-shell.txt @@ -169,3 +169,23 @@ # NPLONG-CAT-OUTPUT-NEXT: M-HM-IM-JM-KM-LM-MM-NM-OM-PM-QM-RM-SM-TM-UM-VM-WM-XM-YM-ZM-[ # NPLONG-CAT-OUTPUT-NEXT: M-\M-]M-^M-_M-`M-aM-bM-cM-dM-eM-fM-gM-hM-iM-jM-kM-lM-mM-nM-o # NPLONG-CAT-OUTPUT-NEXT: M-pM-qM-rM-sM-tM-uM-vM-wM-xM-yM-zM-{M-|M-}M-~M-^? +# +## Check cat command with -e option. +## -e will convert text to ^ and M- notation and append a '$' to each new line. +# +# RUN: cat -e %S/cat_nonprinting.bin \ +# RUN: | FileCheck --check-prefix=NPE-CAT-OUTPUT --implicit-check-not={{.}} --match-full-lines --strict-whitespace %s +# NPE-CAT-OUTPUT:^@^A^B^C^D^E^F^G ^H$ +# NPE-CAT-OUTPUT-NEXT:^K^L^M^N^O^P^Q^R^S$ +# NPE-CAT-OUTPUT-NEXT:^T^U^V^W^X^Y^Z^[^\^]^^^_ !"#$%&'$ +# NPE-CAT-OUTPUT-NEXT:()*+,-./0123456789:;$ +# NPE-CAT-OUTPUT-NEXT:<=>?@ABCDEFGHIJKLMNO$ +# NPE-CAT-OUTPUT-NEXT:PQRSTUVWXYZ[\]^_`abc$ +# NPE-CAT-OUTPUT-NEXT:defghijklmnopqrstuvw$ +# NPE-CAT-OUTPUT-NEXT:xyz{|}~^?M-^@M-^AM-^BM-^CM-^DM-^EM-^FM-^GM-^HM-^IM-^JM-^K$ +# NPE-CAT-OUTPUT-NEXT:M-^LM-^MM-^NM-^OM-^PM-^QM-^RM-^SM-^TM-^UM-^VM-^WM-^XM-^YM-^ZM-^[M-^\M-^]M-^^M-^_$ +# NPE-CAT-OUTPUT-NEXT:M- M-!M-"M-#M-$M-%M-&M-'M-(M-)M-*M-+M-,M--M-.M-/M-0M-1M-2M-3$ +# NPE-CAT-OUTPUT-NEXT:M-4M-5M-6M-7M-8M-9M-:M-;M-M-?M-@M-AM-BM-CM-DM-EM-FM-G$ +# NPE-CAT-OUTPUT-NEXT:M-HM-IM-JM-KM-LM-MM-NM-OM-PM-QM-RM-SM-TM-UM-VM-WM-XM-YM-ZM-[$ +# NPE-CAT-OUTPUT-NEXT:M-\M-]M-^M-_M-`M-aM-bM-cM-dM-eM-fM-gM-hM-iM-jM-kM-lM-mM-nM-o$ +# NPE-CAT-OUTPUT-NEXT:M-pM-qM-rM-sM-tM-uM-vM-wM-xM-yM-zM-{M-|M-}M-~M-^?$ diff --git a/llvm/utils/lit/tests/shtest-cat.py b/llvm/utils/lit/tests/shtest-cat.py deleted file mode 100644 index 8758a6fcfe7fa..0000000000000 --- a/llvm/utils/lit/tests/shtest-cat.py +++ /dev/null @@ -1,31 +0,0 @@ -## Test the cat command - -# RUN: not %{lit} -a -v %{inputs}/shtest-cat \ -# RUN: | FileCheck -match-full-lines %s -# -# END. - -# CHECK: FAIL: shtest-cat :: cat-e.txt ({{[^)]*}}) -# CHECK: cat -e {{.+}}/allchars | FileCheck {{.*}} -# CHECK: # executed command: cat -e {{.+}}/allchars -# CHECK: # | Unsupported: 'cat': option -e not recognized -# CHECK: # error: command failed with exit status: {{.*}} -# CHECK: # executed command: FileCheck {{.*}} -# CHECK: # error: command failed with exit status: {{.*}} - -# CHECK: PASS: shtest-cat :: cat-v.txt ({{[^)]*}}) -# CHECK: cat -v {{.+}}/allchars | FileCheck {{.*}} -# CHECK-NEXT: # executed command: cat -v {{.+}}/allchars -# CHECK-NEXT: # executed command: FileCheck {{.*}} -# CHECK: cat -v {{.+}}/newline | FileCheck {{.*}} -# CHECK-NEXT: # executed command: cat -v {{.+}}/newline -# CHECK-NEXT: # executed command: FileCheck {{.*}} - -# CHECK: PASS: shtest-cat :: cat.txt ({{[^)]*}}) -# CHECK: cat {{.+}}/newline | FileCheck {{.*}} -# CHECK-NEXT: # executed command: cat {{.+}}/newline -# CHECK-NEXT: # executed command: FileCheck {{.*}} -# CHECK: cat {{.+}}/allchars > {{.+}} -# CHECK-NEXT: # executed command: cat {{.+}}/allchars -# CHECK: diff {{.+}}/allchars {{.+}} -# CHECK-NEXT: # executed command: diff {{.+}}/allchars {{.+}} \ No newline at end of file diff --git a/llvm/utils/lit/tests/shtest-shell.py b/llvm/utils/lit/tests/shtest-shell.py index 8685119488062..b267258eb063e 100644 --- a/llvm/utils/lit/tests/shtest-shell.py +++ b/llvm/utils/lit/tests/shtest-shell.py @@ -649,6 +649,6 @@ # CHECK: false # CHECK: *** -# CHECK: PASS: shtest-shell :: valid-shell.txt +# CHECK: FAIL: shtest-shell :: valid-shell.txt # CHECK: Unresolved Tests (1) -# CHECK: Failed Tests (38) +# CHECK: Failed Tests (39)