diff options
author | David Blaikie <dblaikie@gmail.com> | 2012-08-31 17:49:33 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2012-08-31 17:49:33 +0000 |
commit | 3f0b705d08c7d83aed7b2e381c1c0362f80874b3 (patch) | |
tree | b123ba23b26597af87a6984c7c634c70c752ba27 /test | |
parent | 34cbca9ee05a44a7c975cb3d63518b55193b321f (diff) |
Fix tests to be more robust (to older versions of grep, lesser lit-like test runners, etc)
Seems I had a problem with my version of grep, when run by lit, not supporting
the \s escape. This seems to fix it for me & I'll be getting the buildbots to
run these tests too to keep an eye on them (actually loop-convert tests still
fail when run via a make build, so that'll be addressed in a future commit). I
could use [[:space:]] to generalize over other whitespace but that seemed
unnecessarily verbose when the flexibility wasn't actually required by the
current text of the tests.
Also I just simplified a lot of the loop-convert tests (removing the
unecessary temp file deletion at the start, removing the unnecessary && for
FileCheck, etc).
The remove-cstr-calls/basic.cpp changes were necessitated by an out of tree
lit-like test runner that's a bit less fantastic about escaping. They were
modeled on existing tooling test cases in Clang, with thanks to Manuel Klimek
for the pointers.
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@163009 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/loop-convert/array.cpp | 15 | ||||
-rw-r--r-- | test/loop-convert/confidence.cpp | 11 | ||||
-rw-r--r-- | test/loop-convert/dependency.cpp | 3 | ||||
-rw-r--r-- | test/loop-convert/iterator.cpp | 9 | ||||
-rw-r--r-- | test/loop-convert/naming.cpp | 7 | ||||
-rw-r--r-- | test/loop-convert/negative-iterator.cpp | 7 | ||||
-rw-r--r-- | test/loop-convert/negative-multi-end-call.cpp | 7 | ||||
-rw-r--r-- | test/loop-convert/negative-pseudoarray-extra.cpp | 7 | ||||
-rw-r--r-- | test/loop-convert/negative-pseudoarray.cpp | 7 | ||||
-rw-r--r-- | test/loop-convert/negative.cpp | 12 | ||||
-rw-r--r-- | test/loop-convert/nesting.cpp | 7 | ||||
-rw-r--r-- | test/loop-convert/nocompile.cpp | 8 | ||||
-rw-r--r-- | test/loop-convert/pseudoarray.cpp | 8 | ||||
-rw-r--r-- | test/loop-convert/single-iterator.cpp | 9 | ||||
-rw-r--r-- | test/remove-cstr-calls/basic.cpp | 10 |
15 files changed, 54 insertions, 73 deletions
diff --git a/test/loop-convert/array.cpp b/test/loop-convert/array.cpp index 8853dd6f..330ed809 100644 --- a/test/loop-convert/array.cpp +++ b/test/loop-convert/array.cpp @@ -1,12 +1,11 @@ -// RUN: rm -rf %t.cpp -// RUN: grep -Ev "//\s*[A-Z-]+:" %s > %t.cpp -// RUN: loop-convert . %t.cpp -- -I %S/Inputs \ -// RUN: && FileCheck -input-file=%t.cpp %s -// RUN: grep -Ev "//\s*[A-Z-]+:" %s > %t.cpp +// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp // RUN: cp %t.cpp %t.base -// RUN: loop-convert -count-only . %t.cpp -- -I %S/Inputs > %T/out \ -// RUN: && FileCheck -check-prefix=COUNTONLY -input-file=%T/out %s \ -// RUN: && diff %t.cpp %t.base +// RUN: loop-convert . %t.cpp -- -I %S/Inputs +// RUN: FileCheck -input-file=%t.cpp %s +// RUN: cp %t.base %t.cpp +// RUN: loop-convert -count-only . %t.cpp -- -I %S/Inputs > %T/out +// RUN: FileCheck -check-prefix=COUNTONLY -input-file=%T/out %s +// RUN: diff %t.cpp %t.base #include "structures.h" diff --git a/test/loop-convert/confidence.cpp b/test/loop-convert/confidence.cpp index 61f6ebe0..6542ff32 100644 --- a/test/loop-convert/confidence.cpp +++ b/test/loop-convert/confidence.cpp @@ -1,9 +1,8 @@ -// RUN: rm -rf %t.cpp -// RUN: grep -Ev "//\s*[A-Z-]+:" %s > %t.cpp -// RUN: loop-convert . %t.cpp -- -I %S/Inputs \ -// RUN: && FileCheck -input-file=%t.cpp %s -// RUN: loop-convert . %t.cpp -A2 -- -I %S/Inputs \ -// RUN: && FileCheck -check-prefix=RISKY -input-file=%t.cpp %s +// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp +// RUN: loop-convert . %t.cpp -- -I %S/Inputs +// RUN: FileCheck -input-file=%t.cpp %s +// RUN: loop-convert . %t.cpp -A2 -- -I %S/Inputs +// RUN: FileCheck -check-prefix=RISKY -input-file=%t.cpp %s #include "structures.h" diff --git a/test/loop-convert/dependency.cpp b/test/loop-convert/dependency.cpp index 2f960052..d3c6690d 100644 --- a/test/loop-convert/dependency.cpp +++ b/test/loop-convert/dependency.cpp @@ -1,5 +1,4 @@ -// RUN: rm -rf %t.cpp -// RUN: grep -Ev "//\s*[A-Z-]+:" %s > %t.cpp +// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp // RUN: loop-convert . %t.cpp -- && FileCheck -input-file=%t.cpp %s void f() { diff --git a/test/loop-convert/iterator.cpp b/test/loop-convert/iterator.cpp index 8f410200..83776420 100644 --- a/test/loop-convert/iterator.cpp +++ b/test/loop-convert/iterator.cpp @@ -1,9 +1,6 @@ -// RUN: rm -rf %t.cpp -// RUN: grep -Ev "//\s*[A-Z-]+:" %s > %t.cpp -// RUN: loop-convert . %t.cpp -- -I %S/Inputs \ -// RUN: && FileCheck -input-file=%t.cpp %s -// RUN: grep -Ev "//\s*[A-Z-]+:" %s > %t.cpp -// RUN: rm -rf %t.cpp +// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp +// RUN: loop-convert . %t.cpp -- -I %S/Inputs +// RUN: FileCheck -input-file=%t.cpp %s #include "structures.h" diff --git a/test/loop-convert/naming.cpp b/test/loop-convert/naming.cpp index 0bfef339..da270d4f 100644 --- a/test/loop-convert/naming.cpp +++ b/test/loop-convert/naming.cpp @@ -1,7 +1,6 @@ -// RUN: rm -rf %t.cpp -// RUN: grep -Ev "//\s*[A-Z-]+:" %s > %t.cpp -// RUN: loop-convert . %t.cpp -- -I %S/Inputs \ -// RUN: && FileCheck -input-file=%t.cpp %s +// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp +// RUN: loop-convert . %t.cpp -- -I %S/Inputs +// RUN: FileCheck -input-file=%t.cpp %s #include "structures.h" diff --git a/test/loop-convert/negative-iterator.cpp b/test/loop-convert/negative-iterator.cpp index 041bbee4..b48a1ee4 100644 --- a/test/loop-convert/negative-iterator.cpp +++ b/test/loop-convert/negative-iterator.cpp @@ -1,7 +1,6 @@ -// RUN: rm -rf %t.cpp -// RUN: grep -Ev "//\s*[A-Z-]+:" %s > %t.cpp -// RUN: loop-convert . %t.cpp -- -I %S/Inputs \ -// RUN: && FileCheck -input-file=%t.cpp %s +// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp +// RUN: loop-convert . %t.cpp -- -I %S/Inputs +// RUN: FileCheck -input-file=%t.cpp %s #include "structures.h" diff --git a/test/loop-convert/negative-multi-end-call.cpp b/test/loop-convert/negative-multi-end-call.cpp index cc15ce56..c634fab9 100644 --- a/test/loop-convert/negative-multi-end-call.cpp +++ b/test/loop-convert/negative-multi-end-call.cpp @@ -1,7 +1,6 @@ -// RUN: rm -rf %t.cpp -// RUN: grep -Ev "//\s*[A-Z-]+:" %s > %t.cpp -// RUN: loop-convert -A0 . %t.cpp -- -I %S/Inputs \ -// RUN: && FileCheck -input-file=%t.cpp %s +// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp +// RUN: loop-convert -A0 . %t.cpp -- -I %S/Inputs +// RUN: FileCheck -input-file=%t.cpp %s #include "structures.h" diff --git a/test/loop-convert/negative-pseudoarray-extra.cpp b/test/loop-convert/negative-pseudoarray-extra.cpp index 224a87bf..0222af56 100644 --- a/test/loop-convert/negative-pseudoarray-extra.cpp +++ b/test/loop-convert/negative-pseudoarray-extra.cpp @@ -1,7 +1,6 @@ -// RUN: rm -rf %t.cpp -// RUN: grep -Ev "//\s*[A-Z-]+:" %s > %t.cpp -// RUN: loop-convert -A1 . %t.cpp -- -I %S/Inputs \ -// RUN: && FileCheck -input-file=%t.cpp %s +// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp +// RUN: loop-convert -A1 . %t.cpp -- -I %S/Inputs +// RUN: FileCheck -input-file=%t.cpp %s #include "structures.h" diff --git a/test/loop-convert/negative-pseudoarray.cpp b/test/loop-convert/negative-pseudoarray.cpp index e5b3a1d4..af184f7d 100644 --- a/test/loop-convert/negative-pseudoarray.cpp +++ b/test/loop-convert/negative-pseudoarray.cpp @@ -1,7 +1,6 @@ -// RUN: rm -rf %t.cpp -// RUN: grep -Ev "//\s*[A-Z-]+:" %s > %t.cpp -// RUN: loop-convert -A1 . %t.cpp -- -I %S/Inputs \ -// RUN: && FileCheck -input-file=%t.cpp %s +// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp +// RUN: loop-convert -A1 . %t.cpp -- -I %S/Inputs +// RUN: FileCheck -input-file=%t.cpp %s #include "structures.h" diff --git a/test/loop-convert/negative.cpp b/test/loop-convert/negative.cpp index 55975572..9b284b45 100644 --- a/test/loop-convert/negative.cpp +++ b/test/loop-convert/negative.cpp @@ -1,11 +1,9 @@ -// RUN: rm -rf %t.cpp -// RUN: grep -Ev "//\s*[A-Z-]+:" %s > %t.cpp -// RUN: grep -Ev "//\s*[A-Z-]+:" %S/Inputs/negative-header.h > \ +// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp +// RUN: grep -Ev "// *[A-Z-]+:" %S/Inputs/negative-header.h > \ // RUN: %T/negative-header.h -// RUN: loop-convert . %t.cpp -- -I %S/Inputs/ \ -// RUN: && FileCheck -input-file=%t.cpp %s \ -// RUN: && FileCheck -input-file=%T/negative-header.h \ -// RUN: %S/Inputs/negative-header.h +// RUN: loop-convert . %t.cpp -- -I %S/Inputs/ +// RUN: FileCheck -input-file=%t.cpp %s +// RUN: FileCheck -input-file=%T/negative-header.h %S/Inputs/negative-header.h #include "negative-header.h" #include "structures.h" diff --git a/test/loop-convert/nesting.cpp b/test/loop-convert/nesting.cpp index 8e960a89..73f8173b 100644 --- a/test/loop-convert/nesting.cpp +++ b/test/loop-convert/nesting.cpp @@ -1,7 +1,6 @@ -// RUN: rm -rf %t.cpp -// RUN: grep -Ev "//\s*[A-Z-]+:" %s > %t.cpp -// RUN: loop-convert . %t.cpp -- -I %S/Inputs \ -// RUN: && FileCheck -input-file=%t.cpp %s +// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp +// RUN: loop-convert . %t.cpp -- -I %S/Inputs +// RUN: FileCheck -input-file=%t.cpp %s #include "structures.h" diff --git a/test/loop-convert/nocompile.cpp b/test/loop-convert/nocompile.cpp index 32390102..e39cf896 100644 --- a/test/loop-convert/nocompile.cpp +++ b/test/loop-convert/nocompile.cpp @@ -1,8 +1,6 @@ -// RUN: rm -rf %t.cpp -// RUN: grep -Ev "//\s*[A-Z-]+:" %s > %t.cpp -// RUN: loop-convert . %t.cpp -- -I %S/Inputs \ -// RUN: || FileCheck -input-file=%t.cpp %s -// Note that this test expects the compilation to fail! +// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp +// RUN: not loop-convert . %t.cpp -- -I %S/Inputs +// RUN: FileCheck -input-file=%t.cpp %s void valid() { const int arr[5]; diff --git a/test/loop-convert/pseudoarray.cpp b/test/loop-convert/pseudoarray.cpp index b47616d0..13c19333 100644 --- a/test/loop-convert/pseudoarray.cpp +++ b/test/loop-convert/pseudoarray.cpp @@ -1,8 +1,6 @@ -// RUN: rm -rf %t.cpp -// RUN: grep -Ev "//\s*[A-Z-]+:" %s > %t.cpp -// RUN: loop-convert . %t.cpp -- -I %S/Inputs \ -// RUN: && FileCheck -input-file=%t.cpp %s -// RUN: rm -rf %t.cpp +// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp +// RUN: loop-convert . %t.cpp -- -I %S/Inputs +// RUN: FileCheck -input-file=%t.cpp %s #include "structures.h" const int N = 6; diff --git a/test/loop-convert/single-iterator.cpp b/test/loop-convert/single-iterator.cpp index 2359a3ac..9922225a 100644 --- a/test/loop-convert/single-iterator.cpp +++ b/test/loop-convert/single-iterator.cpp @@ -1,9 +1,6 @@ -// RUN: rm -rf %t.cpp -// RUN: grep -Ev "//\s*[A-Z-]+:" %s > %t.cpp -// RUN: loop-convert . %t.cpp -- -I %S/Inputs \ -// RUN: && FileCheck -input-file=%t.cpp %s -// RUN: grep -Ev "//\s*[A-Z-]+:" %s > %t.cpp -// RUN: rm -rf %t.cpp +// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp +// RUN: loop-convert . %t.cpp -- -I %S/Inputs +// RUN: FileCheck -input-file=%t.cpp %s #include "structures.h" diff --git a/test/remove-cstr-calls/basic.cpp b/test/remove-cstr-calls/basic.cpp index f0f5ed5b..d15746a0 100644 --- a/test/remove-cstr-calls/basic.cpp +++ b/test/remove-cstr-calls/basic.cpp @@ -1,7 +1,9 @@ -// RUN: echo '[{"directory":".","command":"clang++ -c %T/test.cpp","file":"%T/test.cpp"}]' > %T/compile_commands.json -// RUN: cp "%s" "%T/test.cpp" -// RUN: remove-cstr-calls "%T" "%T/test.cpp" -// RUN: cat "%T/test.cpp" | FileCheck %s +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: echo "[{\"directory\":\".\",\"command\":\"clang++ -c %t/test.cpp\",\"file\":\"%t/test.cpp\"}]" | sed -e 's/\\/\//g' > %t/compile_commands.json +// RUN: cp "%s" "%t/test.cpp" +// RUN: remove-cstr-calls "%t" "%t/test.cpp" +// RUN: cat "%t/test.cpp" | FileCheck %s // REQUIRES: shell // FIXME: implement a mode for refactoring tools that takes input from stdin // and writes output to stdout for easier testing of tools. |