forked from OSchip/llvm-project
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. llvm-svn: 163009
This commit is contained in:
parent
6bbe48967a
commit
efae14e96c
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue