-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[llvm-lit][test][NFC] Moved cat command tests into separate lit test file #102366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
946a035
[llvm-lit][test][NFC] Moved cat command tests into separate lit test
connieyzhu 712515e
[llvm-lit][test][NFC] Moved check_path.py to be used by multiple
connieyzhu 0910b5b
[llvm-lit][test][NFC] Added pass/fail summary to cat testing
connieyzhu 8898b99
[llvm-lit] Made syntax changes
connieyzhu 1d23cf6
Modified CHECK directive syntax
connieyzhu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
## 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 | ||
# FILE-EXISTS: True | ||
# 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 | ||
# MULTI-FILE-EXISTS: True | ||
# 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 | ||
# | ||
## Test cat command with multiple files and glob expressions. | ||
# | ||
# RUN: rm -rf %T/testCat | ||
# RUN: mkdir -p %T/testCat | ||
# RUN: echo "cvbnm" > %T/testCat/temp1.write | ||
# RUN: echo "qwerty" > %T/testCat/temp2.write | ||
# RUN: cat %T/testCat/*.write | FileCheck --check-prefix=GLOB-CAT-OUTPUT %s | ||
# GLOB-CAT-OUTPUT: cvbnm | ||
# GLOB-CAT-OUTPUT-NEXT: qwerty | ||
# | ||
## Test cat command with -v option | ||
# | ||
# RUN: cat -v %S/cat_nonprinting.bin | FileCheck --check-prefix=NP-CAT-OUTPUT %s | ||
# NP-CAT-OUTPUT: ^@^A^B^C^D^E^F^G ^H | ||
# NP-CAT-OUTPUT-NEXT: ^K^L^M^N^O^P^Q^R^S | ||
# NP-CAT-OUTPUT-NEXT: ^T^U^V^W^X^Y^Z^[^\^]^^^_ !"#$%&' | ||
# NP-CAT-OUTPUT-NEXT: ()*+,-./0123456789:; | ||
# NP-CAT-OUTPUT-NEXT: <=>?@ABCDEFGHIJKLMNO | ||
# NP-CAT-OUTPUT-NEXT: PQRSTUVWXYZ[\]^_`abc | ||
# NP-CAT-OUTPUT-NEXT: defghijklmnopqrstuvw | ||
# NP-CAT-OUTPUT-NEXT: xyz{|}~^?M-^@M-^AM-^BM-^CM-^DM-^EM-^FM-^GM-^HM-^IM-^JM-^K | ||
# NP-CAT-OUTPUT-NEXT: M-^LM-^MM-^NM-^OM-^PM-^QM-^RM-^SM-^TM-^UM-^VM-^WM-^XM-^YM-^ZM-^[M-^\M-^]M-^^M-^_ | ||
# NP-CAT-OUTPUT-NEXT: M- M-!M-"M-#M-$M-%M-&M-'M-(M-)M-*M-+M-,M--M-.M-/M-0M-1M-2M-3 | ||
# NP-CAT-OUTPUT-NEXT: M-4M-5M-6M-7M-8M-9M-:M-;M-<M-=M->M-?M-@M-AM-BM-CM-DM-EM-FM-G | ||
# NP-CAT-OUTPUT-NEXT: M-HM-IM-JM-KM-LM-MM-NM-OM-PM-QM-RM-SM-TM-UM-VM-WM-XM-YM-ZM-[ | ||
# NP-CAT-OUTPUT-NEXT: M-\M-]M-^M-_M-`M-aM-bM-cM-dM-eM-fM-gM-hM-iM-jM-kM-lM-mM-nM-o | ||
# NP-CAT-OUTPUT-NEXT: M-pM-qM-rM-sM-tM-uM-vM-wM-xM-yM-zM-{M-|M-}M-~M-^? | ||
# | ||
## Test cat command with -show-nonprinting option | ||
# | ||
# RUN: cat --show-nonprinting %S/cat_nonprinting.bin | FileCheck --check-prefix=NPLONG-CAT-OUTPUT %s | ||
# NPLONG-CAT-OUTPUT: ^@^A^B^C^D^E^F^G ^H | ||
# NPLONG-CAT-OUTPUT-NEXT: ^K^L^M^N^O^P^Q^R^S | ||
# NPLONG-CAT-OUTPUT-NEXT: ^T^U^V^W^X^Y^Z^[^\^]^^^_ !"#$%&' | ||
# NPLONG-CAT-OUTPUT-NEXT: ()*+,-./0123456789:; | ||
# NPLONG-CAT-OUTPUT-NEXT: <=>?@ABCDEFGHIJKLMNO | ||
# NPLONG-CAT-OUTPUT-NEXT: PQRSTUVWXYZ[\]^_`abc | ||
# NPLONG-CAT-OUTPUT-NEXT: defghijklmnopqrstuvw | ||
# NPLONG-CAT-OUTPUT-NEXT: xyz{|}~^?M-^@M-^AM-^BM-^CM-^DM-^EM-^FM-^GM-^HM-^IM-^JM-^K | ||
# NPLONG-CAT-OUTPUT-NEXT: M-^LM-^MM-^NM-^OM-^PM-^QM-^RM-^SM-^TM-^UM-^VM-^WM-^XM-^YM-^ZM-^[M-^\M-^]M-^^M-^_ | ||
# NPLONG-CAT-OUTPUT-NEXT: M- M-!M-"M-#M-$M-%M-&M-'M-(M-)M-*M-+M-,M--M-.M-/M-0M-1M-2M-3 | ||
# NPLONG-CAT-OUTPUT-NEXT: M-4M-5M-6M-7M-8M-9M-:M-;M-<M-=M->M-?M-@M-AM-BM-CM-DM-EM-FM-G | ||
# 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-^? |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
## Test the cat command. | ||
# | ||
# RUN: not %{lit} -a -v %{inputs}/shtest-cat \ | ||
# RUN: | FileCheck -match-full-lines %s | ||
# END. | ||
|
||
# CHECK: FAIL: shtest-cat :: cat-error-0.txt ({{[^)]*}}) | ||
# CHECK: cat -b temp1.txt | ||
# CHECK: # .---command stderr{{-*}} | ||
# CHECK-NEXT: # | Unsupported: 'cat': option -b not recognized | ||
# CHECK: # error: command failed with exit status: 1 | ||
|
||
# CHECK: FAIL: shtest-cat :: cat-error-1.txt ({{[^)]*}}) | ||
# CHECK: cat temp1.txt | ||
# CHECK: # .---command stderr{{-*}} | ||
# CHECK-NEXT: # | [Errno 2] No such file or directory: 'temp1.txt' | ||
# CHECK: # error: command failed with exit status: 1 | ||
|
||
# CHECK: PASS: shtest-cat :: cat.txt ({{[^)]*}}) | ||
|
||
# CHECK: Total Discovered Tests: 3 | ||
# CHECK-NEXT: Passed: 1 {{\([0-9]*\.[0-9]*%\)}} | ||
# CHECK-NEXT: Failed: 2 {{\([0-9]*\.[0-9]*%\)}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.