summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/llvm-strings/stdin.test
diff options
context:
space:
mode:
authorJames Henderson <jh7370@my.bristol.ac.uk>2019-08-12 11:36:11 +0000
committerJames Henderson <jh7370@my.bristol.ac.uk>2019-08-12 11:36:11 +0000
commitf23ce128fd614d5ed7b5c70038c5db8b257c5127 (patch)
treed3ab7548147936d4d4057564f569c0fc47426948 /llvm/test/tools/llvm-strings/stdin.test
parentccdad6ef486a00ed815ead642d2f62d87d86ee90 (diff)
downloadbcm5719-llvm-f23ce128fd614d5ed7b5c70038c5db8b257c5127.tar.gz
bcm5719-llvm-f23ce128fd614d5ed7b5c70038c5db8b257c5127.zip
[llvm-strings] Improve testing of llvm-strings
This patch tidies up the llvm-strings testing by: 1. Adding comments to every test. 2. Getting rid of canned input files, and having the tests generate them on the fly (this makes the tests self-contained). 3. Adding missing test coverage. 4. Renaming some tests that weren't clear as to their purpose. 5. Adding extra checking of various cases, formatting etc. 6. Removing a test that didn't seem to have any useful purpose for testing llvm-strings. Reviewed by: rupprecht, grimar, MaskRay Differential Revision: https://reviews.llvm.org/D66015 llvm-svn: 368555
Diffstat (limited to 'llvm/test/tools/llvm-strings/stdin.test')
-rw-r--r--llvm/test/tools/llvm-strings/stdin.test22
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-strings/stdin.test b/llvm/test/tools/llvm-strings/stdin.test
new file mode 100644
index 00000000000..b8ccc12e52f
--- /dev/null
+++ b/llvm/test/tools/llvm-strings/stdin.test
@@ -0,0 +1,22 @@
+## Show that llvm-strings can handle stdin input properly.
+
+## Case 1: output with single string.
+RUN: echo -n "abcdefg" | llvm-strings - | FileCheck %s --check-prefix=CASE1 --implicit-check-not={{.}}
+CASE1: abcdefg
+
+## Case 2: output too short for string.
+RUN: echo -n "abc" | llvm-strings - | FileCheck %s --implicit-check-not={{.}} --allow-empty
+
+## Case 3: output with new line.
+RUN: echo -e "abcd\nefgh" | llvm-strings - | FileCheck %s --check-prefix=CASE3 --implicit-check-not={{.}}
+CASE3: abcd
+CASE3-NEXT: efgh
+
+## Case 4: output containing unprintable characters.
+RUN: echo -e "abcd\x00ef\x1fghij\x7fklmn" | llvm-strings - | FileCheck %s --check-prefix=CASE4 --implicit-check-not={{.}}
+CASE4: abcd
+CASE4-NEXT: ghij
+CASE4-NEXT: klmn
+
+## Case 5: no file name specified is equivalent to explicitly requesting stdin.
+RUN: echo -n "abcdefg" | llvm-strings | FileCheck %s --check-prefix=CASE1 --implicit-check-not={{.}}
OpenPOWER on IntegriCloud