r250706 - clang-format: Use pipes instead of temporary files for most lit tests.

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 19 09:21:29 PDT 2015


Author: nico
Date: Mon Oct 19 11:21:29 2015
New Revision: 250706

URL: http://llvm.org/viewvc/llvm-project?rev=250706&view=rev
Log:
clang-format: Use pipes instead of temporary files for most lit tests.

This makes the format tests look more like most other FileCheck tests in clang.

The multiple-inputs tests still use temp files, to make sure that the file
input code in clang-format stays tested.

Stop stripping out the comment lines in style-on-command-line.cpp as they don't
get in the way and it makes the test simpler. Also remove 2>&1s on the tests in
that file that don't need it.

http://reviews.llvm.org/D13852

Modified:
    cfe/trunk/test/Format/basic.cpp
    cfe/trunk/test/Format/cursor.cpp
    cfe/trunk/test/Format/disable-format.cpp
    cfe/trunk/test/Format/incomplete.cpp
    cfe/trunk/test/Format/language-detection.cpp
    cfe/trunk/test/Format/line-ranges.cpp
    cfe/trunk/test/Format/ranges.cpp
    cfe/trunk/test/Format/style-on-command-line.cpp
    cfe/trunk/test/Format/xmloutput.cpp

Modified: cfe/trunk/test/Format/basic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Format/basic.cpp?rev=250706&r1=250705&r2=250706&view=diff
==============================================================================
--- cfe/trunk/test/Format/basic.cpp (original)
+++ cfe/trunk/test/Format/basic.cpp Mon Oct 19 11:21:29 2015
@@ -1,6 +1,5 @@
-// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
-// RUN: clang-format -style=LLVM -i %t.cpp
-// RUN: FileCheck -strict-whitespace -input-file=%t.cpp %s
+// RUN: grep -Ev "// *[A-Z-]+:" %s | clang-format -style=LLVM \
+// RUN:   | FileCheck -strict-whitespace %s
 
 // CHECK: {{^int\ \*i;}}
  int   *  i  ;

Modified: cfe/trunk/test/Format/cursor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Format/cursor.cpp?rev=250706&r1=250705&r2=250706&view=diff
==============================================================================
--- cfe/trunk/test/Format/cursor.cpp (original)
+++ cfe/trunk/test/Format/cursor.cpp Mon Oct 19 11:21:29 2015
@@ -1,6 +1,5 @@
-// RUN: grep -Ev "// *[A-Z-]+:" %s > %t2.cpp
-// RUN: clang-format -style=LLVM %t2.cpp -cursor=6 > %t.cpp
-// RUN: FileCheck -strict-whitespace -input-file=%t.cpp %s
+// RUN: grep -Ev "// *[A-Z-]+:" %s | clang-format -style=LLVM -cursor=6 \
+// RUN:   | FileCheck -strict-whitespace %s
 // CHECK: {{^\{ "Cursor": 4, }}
 // CHECK: {{^int\ \i;$}}
  int    i;

Modified: cfe/trunk/test/Format/disable-format.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Format/disable-format.cpp?rev=250706&r1=250705&r2=250706&view=diff
==============================================================================
--- cfe/trunk/test/Format/disable-format.cpp (original)
+++ cfe/trunk/test/Format/disable-format.cpp Mon Oct 19 11:21:29 2015
@@ -1,6 +1,5 @@
-// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
-// RUN: clang-format -style=none -i %t.cpp
-// RUN: FileCheck -strict-whitespace -input-file=%t.cpp %s
+// RUN: grep -Ev "// *[A-Z-]+:" %s | clang-format -style=none \
+// RUN:   | FileCheck -strict-whitespace %s
 
 // CHECK: int   i;
 int   i;

Modified: cfe/trunk/test/Format/incomplete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Format/incomplete.cpp?rev=250706&r1=250705&r2=250706&view=diff
==============================================================================
--- cfe/trunk/test/Format/incomplete.cpp (original)
+++ cfe/trunk/test/Format/incomplete.cpp Mon Oct 19 11:21:29 2015
@@ -1,6 +1,5 @@
-// RUN: grep -Ev "// *[A-Z-]+:" %s > %t2.cpp
-// RUN: clang-format -style=LLVM %t2.cpp -cursor=0 > %t.cpp
-// RUN: FileCheck -strict-whitespace -input-file=%t.cpp %s
+// RUN: grep -Ev "// *[A-Z-]+:" %s | clang-format -style=LLVM -cursor=0 \
+// RUN:   | FileCheck -strict-whitespace %s
 // CHECK: {{"IncompleteFormat": true}}
 // CHECK: {{^int\ \i;$}}
  int    i;

Modified: cfe/trunk/test/Format/language-detection.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Format/language-detection.cpp?rev=250706&r1=250705&r2=250706&view=diff
==============================================================================
--- cfe/trunk/test/Format/language-detection.cpp (original)
+++ cfe/trunk/test/Format/language-detection.cpp Mon Oct 19 11:21:29 2015
@@ -1,7 +1,9 @@
-// RUN: grep -Ev "// *[A-Z0-9_]+:" %s > %t.js
-// RUN: grep -Ev "// *[A-Z0-9_]+:" %s > %t.cpp
-// RUN: clang-format -style=llvm %t.js | FileCheck -strict-whitespace -check-prefix=CHECK1 %s
-// RUN: clang-format -style=llvm %t.cpp | FileCheck -strict-whitespace -check-prefix=CHECK2 %s
+// RUN: grep -Ev "// *[A-Z0-9_]+:" %s \
+// RUN:   | clang-format -style=llvm -assume-filename=foo.js \
+// RUN:   | FileCheck -strict-whitespace -check-prefix=CHECK1 %s
+// RUN: grep -Ev "// *[A-Z0-9_]+:" %s \
+// RUN:   | clang-format -style=llvm -assume-filename=foo.cpp \
+// RUN:   | FileCheck -strict-whitespace -check-prefix=CHECK2 %s
 // CHECK1: {{^a >>>= b;$}}
 // CHECK2: {{^a >> >= b;$}}
 a >>>= b;

Modified: cfe/trunk/test/Format/line-ranges.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Format/line-ranges.cpp?rev=250706&r1=250705&r2=250706&view=diff
==============================================================================
--- cfe/trunk/test/Format/line-ranges.cpp (original)
+++ cfe/trunk/test/Format/line-ranges.cpp Mon Oct 19 11:21:29 2015
@@ -1,6 +1,6 @@
-// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
-// RUN: clang-format -style=LLVM -lines=1:1 -lines=5:5 -i %t.cpp
-// RUN: FileCheck -strict-whitespace -input-file=%t.cpp %s
+// RUN: grep -Ev "// *[A-Z-]+:" %s \
+// RUN:   | clang-format -style=LLVM -lines=1:1 -lines=5:5 \
+// RUN:   | FileCheck -strict-whitespace %s
 // CHECK: {{^int\ \*i;$}}
   int*i;
 

Modified: cfe/trunk/test/Format/ranges.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Format/ranges.cpp?rev=250706&r1=250705&r2=250706&view=diff
==============================================================================
--- cfe/trunk/test/Format/ranges.cpp (original)
+++ cfe/trunk/test/Format/ranges.cpp Mon Oct 19 11:21:29 2015
@@ -1,6 +1,6 @@
-// RUN: grep -Ev "// *[A-Z-]+:" %s > %t.cpp
-// RUN: clang-format -style=LLVM -offset=2 -length=0 -offset=28 -length=0 -i %t.cpp
-// RUN: FileCheck -strict-whitespace -input-file=%t.cpp %s
+// RUN: grep -Ev "// *[A-Z-]+:" %s \
+// RUN:   | clang-format -style=LLVM -offset=2 -length=0 -offset=28 -length=0 \
+// RUN:   | FileCheck -strict-whitespace %s
 // CHECK: {{^int\ \*i;$}}
   int*i;
 

Modified: cfe/trunk/test/Format/style-on-command-line.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Format/style-on-command-line.cpp?rev=250706&r1=250705&r2=250706&view=diff
==============================================================================
--- cfe/trunk/test/Format/style-on-command-line.cpp (original)
+++ cfe/trunk/test/Format/style-on-command-line.cpp Mon Oct 19 11:21:29 2015
@@ -1,17 +1,16 @@
-// RUN: grep -Ev "// *[A-Z0-9_]+:" %s > %t.cpp
-// RUN: clang-format -style="{BasedOnStyle: Google, IndentWidth: 8}" %t.cpp | FileCheck -strict-whitespace -check-prefix=CHECK1 %s
-// RUN: clang-format -style="{BasedOnStyle: LLVM, IndentWidth: 7}" %t.cpp | FileCheck -strict-whitespace -check-prefix=CHECK2 %s
-// RUN: clang-format -style="{BasedOnStyle: invalid, IndentWidth: 7}" -fallback-style=LLVM %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK3 %s
-// RUN: clang-format -style="{lsjd}" %t.cpp -fallback-style=LLVM 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK4 %s
+// RUN: clang-format -style="{BasedOnStyle: Google, IndentWidth: 8}" %s | FileCheck -strict-whitespace -check-prefix=CHECK1 %s
+// RUN: clang-format -style="{BasedOnStyle: LLVM, IndentWidth: 7}" %s | FileCheck -strict-whitespace -check-prefix=CHECK2 %s
+// RUN: clang-format -style="{BasedOnStyle: invalid, IndentWidth: 7}" -fallback-style=LLVM %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK3 %s
+// RUN: clang-format -style="{lsjd}" %s -fallback-style=LLVM 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK4 %s
 // RUN: printf "BasedOnStyle: google\nIndentWidth: 5\n" > %T/.clang-format
-// RUN: clang-format -style=file %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK5 %s
+// RUN: clang-format -style=file -assume-filename=%T/foo.cpp < %s | FileCheck -strict-whitespace -check-prefix=CHECK5 %s
 // RUN: printf "\n" > %T/.clang-format
-// RUN: clang-format -style=file -fallback-style=webkit %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK6 %s
+// RUN: clang-format -style=file -fallback-style=webkit -assume-filename=%T/foo.cpp < %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK6 %s
 // RUN: rm %T/.clang-format
 // RUN: printf "BasedOnStyle: google\nIndentWidth: 6\n" > %T/_clang-format
-// RUN: clang-format -style=file %t.cpp 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK7 %s
-// RUN: clang-format -style="{BasedOnStyle: LLVM, PointerBindsToType: true}" %t.cpp | FileCheck -strict-whitespace -check-prefix=CHECK8 %s
-// RUN: clang-format -style="{BasedOnStyle: WebKit, PointerBindsToType: false}" %t.cpp | FileCheck -strict-whitespace -check-prefix=CHECK9 %s
+// RUN: clang-format -style=file -assume-filename=%T/foo.cpp < %s | FileCheck -strict-whitespace -check-prefix=CHECK7 %s
+// RUN: clang-format -style="{BasedOnStyle: LLVM, PointerBindsToType: true}" %s | FileCheck -strict-whitespace -check-prefix=CHECK8 %s
+// RUN: clang-format -style="{BasedOnStyle: WebKit, PointerBindsToType: false}" %s | FileCheck -strict-whitespace -check-prefix=CHECK9 %s
 void f() {
 // CHECK1: {{^        int\* i;$}}
 // CHECK2: {{^       int \*i;$}}

Modified: cfe/trunk/test/Format/xmloutput.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Format/xmloutput.cpp?rev=250706&r1=250705&r2=250706&view=diff
==============================================================================
--- cfe/trunk/test/Format/xmloutput.cpp (original)
+++ cfe/trunk/test/Format/xmloutput.cpp Mon Oct 19 11:21:29 2015
@@ -1,5 +1,5 @@
-// RUN: clang-format -output-replacements-xml -sort-includes %s > %t.xml
-// RUN: FileCheck -strict-whitespace -input-file=%t.xml %s
+// RUN: clang-format -output-replacements-xml -sort-includes %s \
+// RUN:   | FileCheck -strict-whitespace %s
 
 // CHECK: <?xml
 // CHECK-NEXT: {{<replacements.*incomplete_format='false'}}




More information about the cfe-commits mailing list