[clang] 59a57ca - [clang][deps] NFC: Convert test to split-file

Jan Svoboda via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 1 12:27:20 PDT 2023


Author: Jan Svoboda
Date: 2023-08-01T12:27:14-07:00
New Revision: 59a57ca6d3e801a90dcef7b4216f6baca6ca99b8

URL: https://github.com/llvm/llvm-project/commit/59a57ca6d3e801a90dcef7b4216f6baca6ca99b8
DIFF: https://github.com/llvm/llvm-project/commit/59a57ca6d3e801a90dcef7b4216f6baca6ca99b8.diff

LOG: [clang][deps] NFC: Convert test to split-file

Added: 
    

Modified: 
    clang/test/ClangScanDeps/has_include_if_elif.cpp

Removed: 
    clang/test/ClangScanDeps/Inputs/has_include_if_elif.json


################################################################################
diff  --git a/clang/test/ClangScanDeps/Inputs/has_include_if_elif.json b/clang/test/ClangScanDeps/Inputs/has_include_if_elif.json
deleted file mode 100644
index 8fcc7ea34a9bce..00000000000000
--- a/clang/test/ClangScanDeps/Inputs/has_include_if_elif.json
+++ /dev/null
@@ -1,12 +0,0 @@
-[
-{
-  "directory": "DIR",
-  "command": "clang -E DIR/has_include_if_elif2.cpp -IInputs",
-  "file": "DIR/has_include_if_elif2.cpp"
-},
-{
-  "directory": "DIR",
-  "command": "clang-cl /E /IInputs -- DIR/has_include_if_elif2_clangcl.cpp",
-  "file": "DIR/has_include_if_elif2_clangcl.cpp"
-}
-]

diff  --git a/clang/test/ClangScanDeps/has_include_if_elif.cpp b/clang/test/ClangScanDeps/has_include_if_elif.cpp
index 5813bf08482ece..b8b5bb8b6bf09f 100644
--- a/clang/test/ClangScanDeps/has_include_if_elif.cpp
+++ b/clang/test/ClangScanDeps/has_include_if_elif.cpp
@@ -1,21 +1,18 @@
-// RUN: rm -rf %t.dir
-// RUN: rm -rf %t.cdb
-// RUN: mkdir -p %t.dir
-// RUN: cp %s %t.dir/has_include_if_elif2.cpp
-// RUN: cp %s %t.dir/has_include_if_elif2_clangcl.cpp
-// RUN: mkdir %t.dir/Inputs
-// RUN: cp %S/Inputs/header.h %t.dir/Inputs/header.h
-// RUN: cp %S/Inputs/header.h %t.dir/Inputs/header2.h
-// RUN: cp %S/Inputs/header.h %t.dir/Inputs/header3.h
-// RUN: cp %S/Inputs/header.h %t.dir/Inputs/header4.h
-// RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/has_include_if_elif.json > %t.cdb
-//
-// RUN: clang-scan-deps -compilation-database %t.cdb -j 1 -mode preprocess-dependency-directives | \
-// RUN:   FileCheck %s
-// RUN: clang-scan-deps -compilation-database %t.cdb -j 1 -mode preprocess | \
-// RUN:   FileCheck %s
+// RUN: rm -rf %t
+// RUN: split-file %s %t
 
-#if __has_include("header.h")
+//--- cdb.json.in
+[{
+  "directory": "DIR",
+  "command": "clang -c DIR/tu.c -o DIR/tu.o -IDIR/include",
+  "file": "DIR/tu.c"
+}]
+//--- include/header1.h
+//--- include/header2.h
+//--- include/header3.h
+//--- include/header4.h
+//--- tu.c
+#if __has_include("header1.h")
 #endif
 
 #if 0
@@ -27,19 +24,16 @@
 #endif
 
 #define H4 __has_include("header4.h")
-
 #if 0
 #elif H4
 #endif
 
-// CHECK: has_include_if_elif2.cpp
-// CHECK-NEXT: Inputs{{/|\\}}header.h
-// CHECK-NEXT: Inputs{{/|\\}}header2.h
-// CHECK-NEXT: Inputs{{/|\\}}header3.h
-// CHECK-NEXT: Inputs{{/|\\}}header4.h
+// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.in > %t/cdb.json
+// RUN: clang-scan-deps -compilation-database %t/cdb.json -mode preprocess-dependency-directives | FileCheck %s
+// RUN: clang-scan-deps -compilation-database %t/cdb.json -mode preprocess | FileCheck %s
 
-// CHECK: has_include_if_elif2_clangcl.cpp
-// CHECK-NEXT: Inputs{{/|\\}}header.h
-// CHECK-NEXT: Inputs{{/|\\}}header2.h
-// CHECK-NEXT: Inputs{{/|\\}}header3.h
-// CHECK-NEXT: Inputs{{/|\\}}header4.h
+// CHECK: tu.c
+// CHECK-NEXT: header1.h
+// CHECK-NEXT: header2.h
+// CHECK-NEXT: header3.h
+// CHECK-NEXT: header4.h


        


More information about the cfe-commits mailing list