[cfe-commits] r85199 - in /cfe/trunk/test/Preprocessor: c99-6_10_3_4_p5.c c99-6_10_3_4_p6.c c99-6_10_3_4_p7.c c99-6_10_3_4_p9.c comment_save.c comment_save_macro.c macro_paste_mscomment.c macro_rescan_varargs.c output_paste_avoid.c stringize_misc.c

Edward O'Callaghan eocallaghan at auroraux.org
Mon Oct 26 19:36:33 PDT 2009


Author: evocallaghan
Date: Mon Oct 26 21:36:32 2009
New Revision: 85199

URL: http://llvm.org/viewvc/llvm-project?rev=85199&view=rev
Log:
Convert Preprocessor Clang tests to FileCheck in regards to PR5307.

Modified:
    cfe/trunk/test/Preprocessor/c99-6_10_3_4_p5.c
    cfe/trunk/test/Preprocessor/c99-6_10_3_4_p6.c
    cfe/trunk/test/Preprocessor/c99-6_10_3_4_p7.c
    cfe/trunk/test/Preprocessor/c99-6_10_3_4_p9.c
    cfe/trunk/test/Preprocessor/comment_save.c
    cfe/trunk/test/Preprocessor/comment_save_macro.c
    cfe/trunk/test/Preprocessor/macro_paste_mscomment.c
    cfe/trunk/test/Preprocessor/macro_rescan_varargs.c
    cfe/trunk/test/Preprocessor/output_paste_avoid.c
    cfe/trunk/test/Preprocessor/stringize_misc.c

Modified: cfe/trunk/test/Preprocessor/c99-6_10_3_4_p5.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/c99-6_10_3_4_p5.c?rev=85199&r1=85198&r2=85199&view=diff

==============================================================================
--- cfe/trunk/test/Preprocessor/c99-6_10_3_4_p5.c (original)
+++ cfe/trunk/test/Preprocessor/c99-6_10_3_4_p5.c Mon Oct 26 21:36:32 2009
@@ -1,10 +1,5 @@
 // Example from C99 6.10.3.4p5
-
-// RUN: clang-cc -E %s | grep -F 'f(2 * (y+1)) + f(2 * (f(2 * (z[0])))) % f(2 * (0)) + t(1);' &&
-// RUN: clang-cc -E %s | grep -F 'f(2 * (2 +(3,4)-0,1)) | f(2 * (~ 5)) & f(2 * (0,1))^m(0,1);' &&
-// RUN: clang-cc -E %s | grep -F 'int i[] = { 1, 23, 4, 5, };' &&
-// RUN: clang-cc -E %s | grep -F 'char c[2][6] = { "hello", "" };'
-
+// RUN: clang-cc -E %s | FileCheck -strict-whitespace %s
 
 #define x 3 
 #define f(a) f(x * (a)) 
@@ -26,4 +21,8 @@
 p() i[q()] = { q(1), r(2,3), r(4,), r(,5), r(,) }; 
 char c[2][6] = { str(hello), str() }; 
 
+// CHECK: f(2 * (y+1)) + f(2 * (f(2 * (z[0])))) % f(2 * (0)) + t(1);
+// CHECK: f(2 * (2 +(3,4)-0,1)) | f(2 * (~ 5)) & f(2 * (0,1))^m(0,1);
+// CHECK: int i[] = { 1, 23, 4, 5, };
+// CHECK: char c[2][6] = { "hello", "" };
 

Modified: cfe/trunk/test/Preprocessor/c99-6_10_3_4_p6.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/c99-6_10_3_4_p6.c?rev=85199&r1=85198&r2=85199&view=diff

==============================================================================
--- cfe/trunk/test/Preprocessor/c99-6_10_3_4_p6.c (original)
+++ cfe/trunk/test/Preprocessor/c99-6_10_3_4_p6.c Mon Oct 26 21:36:32 2009
@@ -1,10 +1,6 @@
 // Example from C99 6.10.3.4p6
 
-// RUN: clang-cc -E %s | grep -F 'printf("x" "1" "= %d, x" "2" "= s" x1, x2);' &&
-// RUN: clang-cc -E %s | grep 'fputs("strncmp(\\"abc\\\\0d\\" \\"abc\\", .\\\\4.) == 0" ": @\\n", s);' &&
-// RUN: clang-cc -E %s | grep -F 'include "vers2.h"' &&
-// RUN: clang-cc -E %s | grep -F '"hello";' &&
-// RUN: clang-cc -E %s | grep -F '"hello" ", world"'
+// RUN: clang-cc -E %s | FileCheck -strict-whitespace %s
 
 #define str(s) # s 
 #define xstr(s) str(s) 
@@ -22,3 +18,10 @@
 glue(HIGH, LOW); 
 xglue(HIGH, LOW) 
 
+
+// CHECK: printf("x" "1" "= %d, x" "2" "= s" x1, x2);
+// CHECK: fputs("strncmp(\"abc\\0d\" \"abc\", '\\4') == 0" ": @\n", s);
+// CHECK: include "vers2.h"
+// CHECK: "hello";
+// CHECK: "hello" ", world"
+

Modified: cfe/trunk/test/Preprocessor/c99-6_10_3_4_p7.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/c99-6_10_3_4_p7.c?rev=85199&r1=85198&r2=85199&view=diff

==============================================================================
--- cfe/trunk/test/Preprocessor/c99-6_10_3_4_p7.c (original)
+++ cfe/trunk/test/Preprocessor/c99-6_10_3_4_p7.c Mon Oct 26 21:36:32 2009
@@ -1,9 +1,10 @@
 // Example from C99 6.10.3.4p7
 
-// RUN: clang-cc -E %s | grep -F 'int j[] = { 123, 45, 67, 89,' &&
-// RUN: clang-cc -E %s | grep -F '10, 11, 12, };'
+// RUN: clang-cc -E %s | FileCheck -strict-whitespace %s
 
 #define t(x,y,z) x ## y ## z 
 int j[] = { t(1,2,3), t(,4,5), t(6,,7), t(8,9,), 
 t(10,,), t(,11,), t(,,12), t(,,) }; 
 
+// CHECK: int j[] = { 123, 45, 67, 89,
+// CHECK: 10, 11, 12, };

Modified: cfe/trunk/test/Preprocessor/c99-6_10_3_4_p9.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/c99-6_10_3_4_p9.c?rev=85199&r1=85198&r2=85199&view=diff

==============================================================================
--- cfe/trunk/test/Preprocessor/c99-6_10_3_4_p9.c (original)
+++ cfe/trunk/test/Preprocessor/c99-6_10_3_4_p9.c Mon Oct 26 21:36:32 2009
@@ -1,16 +1,20 @@
 // Example from C99 6.10.3.4p9
 
-// RUN: clang-cc -E %s | grep -F 'fprintf(stderr, "Flag");' &&
-// RUN: clang-cc -E %s | grep -F 'fprintf(stderr, "X = %d\n", x);' &&
-// RUN: clang-cc -E %s | grep -F 'puts("The first, second, and third items.");' &&
-// RUN: clang-cc -E %s | grep -F '((x>y)?puts("x>y"): printf("x is %d but y is %d", x, y));'
+// RUN: clang-cc -E %s | FileCheck -strict-whitespace %s
 
 #define debug(...) fprintf(stderr, __VA_ARGS__) 
 #define showlist(...) puts(#__VA_ARGS__) 
 #define report(test, ...) ((test)?puts(#test):\
                            printf(__VA_ARGS__)) 
-debug("Flag"); 
-debug("X = %d\n", x); 
-showlist(The first, second, and third items.); 
-report(x>y, "x is %d but y is %d", x, y); 
+debug("Flag");
+// CHECK: fprintf(stderr, "Flag");
+
+debug("X = %d\n", x);
+// CHECK: fprintf(stderr, "X = %d\n", x);
+
+showlist(The first, second, and third items.);
+// CHECK: puts("The first, second, and third items.");
+
+report(x>y, "x is %d but y is %d", x, y);
+// CHECK: ((x>y)?puts("x>y"): printf("x is %d but y is %d", x, y));
 

Modified: cfe/trunk/test/Preprocessor/comment_save.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/comment_save.c?rev=85199&r1=85198&r2=85199&view=diff

==============================================================================
--- cfe/trunk/test/Preprocessor/comment_save.c (original)
+++ cfe/trunk/test/Preprocessor/comment_save.c Mon Oct 26 21:36:32 2009
@@ -1,7 +1,8 @@
-// RUN: clang-cc -E -C %s | grep '^// foo$' &&
-// RUN: clang-cc -E -C %s | grep -F '^/* bar */$'
+// RUN: clang-cc -E -C %s | FileCheck -strict-whitespace %s
 
 // foo
-/* bar */
+// CHECK: // foo
 
+/* bar */
+// CHECK: /* bar */
 

Modified: cfe/trunk/test/Preprocessor/comment_save_macro.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/comment_save_macro.c?rev=85199&r1=85198&r2=85199&view=diff

==============================================================================
--- cfe/trunk/test/Preprocessor/comment_save_macro.c (original)
+++ cfe/trunk/test/Preprocessor/comment_save_macro.c Mon Oct 26 21:36:32 2009
@@ -1,6 +1,11 @@
-// RUN: clang-cc -E -C %s | grep '^boo bork bar // zot$' &&
-// RUN: clang-cc -E -CC %s | grep -F '^boo bork /* blah*/ bar // zot$' &&
-// RUN: clang-cc -E %s | grep '^boo bork bar$'
+// RUN: clang-cc -E -C %s | FileCheck -strict-whitespace %s
+// CHECK: boo bork bar // zot
+
+// RUN: clang-cc -E -CC %s | FileCheck -strict-whitespace %s
+// CHECK: boo bork /* blah*/ bar // zot
+
+// RUN: clang-cc -E %s | FileCheck -strict-whitespace %s
+// CHECK: boo bork bar
 
 
 #define FOO bork // blah

Modified: cfe/trunk/test/Preprocessor/macro_paste_mscomment.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/macro_paste_mscomment.c?rev=85199&r1=85198&r2=85199&view=diff

==============================================================================
--- cfe/trunk/test/Preprocessor/macro_paste_mscomment.c (original)
+++ cfe/trunk/test/Preprocessor/macro_paste_mscomment.c Mon Oct 26 21:36:32 2009
@@ -1,5 +1,4 @@
-// RUN: clang-cc -P -E -fms-extensions %s | sed '/^#.\+/d' | tr -d '\n' > %t &&
-// RUN: grep '^int foo;int bar;int baz;$' %t | count 1
+// RUN: clang-cc -P -E -fms-extensions %s | FileCheck -strict-whitespace %s
 // This horrible stuff should preprocess into (other than whitespace):
 //   int foo;
 //   int bar;
@@ -7,14 +6,21 @@
 
 int foo;
 
+// CHECK: int foo;
+
 #define comment /##/  dead tokens live here
 comment This is stupidity
 
 int bar;
 
+// CHECK: int bar;
+
 #define nested(x) int x comment cute little dead tokens...
 
 nested(baz)  rise of the dead tokens
 
 ;
 
+// CHECK: int baz
+// CHECK: ;
+

Modified: cfe/trunk/test/Preprocessor/macro_rescan_varargs.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/macro_rescan_varargs.c?rev=85199&r1=85198&r2=85199&view=diff

==============================================================================
--- cfe/trunk/test/Preprocessor/macro_rescan_varargs.c (original)
+++ cfe/trunk/test/Preprocessor/macro_rescan_varargs.c Mon Oct 26 21:36:32 2009
@@ -1,5 +1,5 @@
-// RUN: clang-cc -E %s | grep -F "1: F, (, 'a', 'b', );" &&
-// RUN: clang-cc -E %s | grep -F "2: 'a' + 'b';"
+// RUN: clang-cc -E %s | FileCheck -strict-whitespace %s
+
 #define LPAREN ( 
 #define RPAREN ) 
 #define F(x, y) x + y 
@@ -8,3 +8,6 @@
 1: ELLIP_FUNC(F, LPAREN, 'a', 'b', RPAREN); /* 1st invocation */ 
 2: ELLIP_FUNC(F LPAREN 'a', 'b' RPAREN); /* 2nd invocation */ 
 
+// CHECK: 1: F, (, 'a', 'b', );
+// CHECK: 2: 'a' + 'b';
+

Modified: cfe/trunk/test/Preprocessor/output_paste_avoid.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/output_paste_avoid.c?rev=85199&r1=85198&r2=85199&view=diff

==============================================================================
--- cfe/trunk/test/Preprocessor/output_paste_avoid.c (original)
+++ cfe/trunk/test/Preprocessor/output_paste_avoid.c Mon Oct 26 21:36:32 2009
@@ -1,23 +1,26 @@
-// RUN: clang-cc -E %s -o %t &&
-// This should print as ".. ." to avoid turning into ...
-// RUN: grep -F 'A: . . .' %t &&
+// RUN: clang-cc -E %s -o %t | FileCheck -strict-whitespace %s
+
+
 #define y(a) ..a
 A: y(.)
+// This should print as ".. ." to avoid turning into ...
+// CHECK: A: . . .
+
 
-// RUN: grep -F 'C: .. .' %t &&
 #define DOT .
 C: ..DOT
+// CHECK: C: .. .
 
 
-// RUN: grep -F 'D: + + - - + + = = =' %t &&
 #define PLUS +
 #define EMPTY
 #define f(x) =x=
 D: +PLUS -EMPTY- PLUS+ f(=)
+// CHECK: D: + + - - + + = = =
 
-// RUN: grep -F 'E: L "str"' %t
 
-// Should expand to L "str" not L"str"
 #define test(x) L#x
 E: test(str)
+// Should expand to L "str" not L"str"
+// CHECK: E: L "str"
 

Modified: cfe/trunk/test/Preprocessor/stringize_misc.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/stringize_misc.c?rev=85199&r1=85198&r2=85199&view=diff

==============================================================================
--- cfe/trunk/test/Preprocessor/stringize_misc.c (original)
+++ cfe/trunk/test/Preprocessor/stringize_misc.c Mon Oct 26 21:36:32 2009
@@ -1,20 +1,23 @@
-// RUN: clang-cc -E %s | grep -F '"f(1, 2)" "g((x=y++, y))"' &&
-// RUN: clang-cc -E %s | grep -F '"{a=1" "b=2;}"' &&
-// RUN: clang-cc -E %s | grep -F '"<" "["' &&
-// RUN: clang-cc -E %s | grep -F '"(,)" "(...)"' &&
-// RUN: clang-cc -E %s | grep -F '{a=1 c=3; b=2;}' &&
-// RUN: clang-cc -E %s | grep -F '"a COMMA b" "(a, b)"'
+// RUN: clang-cc -E %s | FileCheck -strict-whitespace %s
 
 #define M(x, y) #x #y
 
 M( f(1, 2), g((x=y++, y))) 
+// CHECK: "f(1, 2)" "g((x=y++, y))"
+
 M( {a=1 , b=2;} ) /* A semicolon is not a comma */ 
+// CHECK: "{a=1" "b=2;}"
+
 M( <, [ ) /* Passes the arguments < and [ */ 
+// CHECK: "<" "["
+
 M( (,), (...) ) /* Passes the arguments (,) and (...) */ 
+// CHECK: "(,)" "(...)"
 
 #define START_END(start, end) start c=3; end 
 
 START_END( {a=1 , b=2;} ) /* braces are not parentheses */ 
+// CHECK: {a=1 c=3; b=2;}
 
 /* 
  * To pass a comma token as an argument it is 
@@ -23,4 +26,5 @@
 #define COMMA , 
  
 M(a COMMA b, (a, b)) 
+// CHECK: "a COMMA b" "(a, b)"
 





More information about the cfe-commits mailing list