Skip to content

Commit 5d88ff6

Browse files
naveen-sethrlavaee
authored andcommitted
[clang-scan-deps] Enable test P1689.cppm on Windows (llvm#145857)
The test `test/ClangScanDeps/P1689.cppm` was previously not supported on Windows due to the differences in path separators between Windows and Linux. This normalizes the paths, allowing this test to run on Windows as well. This is motivated by the review feedback for llvm#145221, where the same change was suggested for a test derived from this one.
1 parent f1054a2 commit 5d88ff6

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

clang/test/ClangScanDeps/P1689.cppm

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,65 @@
11
// UNSUPPORTED: target={{.*}}-aix{{.*}}
22
//
3-
// The slash direction in linux and windows are different.
4-
// UNSUPPORTED: system-windows
5-
//
63
// RUN: rm -fr %t
74
// RUN: mkdir -p %t
85
// RUN: split-file %s %t
96
//
107
// RUN: sed "s|DIR|%/t|g" %t/P1689.json.in > %t/P1689.json
118
// RUN: clang-scan-deps -compilation-database %t/P1689.json -format=p1689 | FileCheck %t/Checks.cpp -DPREFIX=%/t
12-
// RUN: clang-scan-deps --mode=preprocess-dependency-directives -compilation-database %t/P1689.json -format=p1689 | FileCheck %t/Checks.cpp -DPREFIX=%/t
9+
// RUN: clang-scan-deps --mode=preprocess-dependency-directives -compilation-database %t/P1689.json -format=p1689 \
10+
// RUN: | sed 's:\\\\\?:/:g' \
11+
// RUN: | FileCheck %t/Checks.cpp -DPREFIX=%/t
1312
//
1413
// Check the separated dependency format. This is required by CMake for the case
1514
// that we have non-exist files in a fresh build and potentially out-of-date after that.
1615
// So the build system need to wrtie a compilation database just for scanning purposes,
1716
// which is not so good. So here is the per file mode for P1689.
1817
// RUN: clang-scan-deps -format=p1689 \
1918
// RUN: -- %clang++ -std=c++20 -c -fprebuilt-module-path=%t %t/M.cppm -o %t/M.o \
19+
// RUN: | sed 's:\\\\\?:/:g' \
2020
// RUN: | FileCheck %t/M.cppm -DPREFIX=%/t
2121
// RUN: clang-scan-deps -format=p1689 \
2222
// RUN: -- %clang++ -std=c++20 -c -fprebuilt-module-path=%t %t/Impl.cpp -o %t/Impl.o \
23+
// RUN: | sed 's:\\\\\?:/:g' \
2324
// RUN: | FileCheck %t/Impl.cpp -DPREFIX=%/t
2425
// RUN: clang-scan-deps -format=p1689 \
2526
// RUN: -- %clang++ -std=c++20 -c -fprebuilt-module-path=%t %t/impl_part.cppm -o %t/impl_part.o \
27+
// RUN: | sed 's:\\\\\?:/:g' \
2628
// RUN: | FileCheck %t/impl_part.cppm -DPREFIX=%/t
2729
// RUN: clang-scan-deps -format=p1689 \
2830
// RUN: -- %clang++ -std=c++20 -c -fprebuilt-module-path=%t %t/interface_part.cppm -o %t/interface_part.o \
31+
// RUN: | sed 's:\\\\\?:/:g' \
2932
// RUN: | FileCheck %t/interface_part.cppm -DPREFIX=%/t
3033
// RUN: clang-scan-deps -format=p1689 \
3134
// RUN: -- %clang++ -std=c++20 -c -fprebuilt-module-path=%t %t/User.cpp -o %t/User.o \
35+
// RUN: | sed 's:\\\\\?:/:g' \
3236
// RUN: | FileCheck %t/User.cpp -DPREFIX=%/t
3337
//
3438
// Check we can generate the make-style dependencies as expected.
3539
// RUN: clang-scan-deps -format=p1689 \
3640
// RUN: -- %clang++ -std=c++20 -c -fprebuilt-module-path=%t %t/impl_part.cppm -o %t/impl_part.o \
3741
// RUN: -MT %t/impl_part.o.ddi -MD -MF %t/impl_part.dep
38-
// RUN: cat %t/impl_part.dep | FileCheck %t/impl_part.cppm -DPREFIX=%/t --check-prefix=CHECK-MAKE
42+
// RUN: cat %t/impl_part.dep \
43+
// RUN: | sed 's:\\\\\?:/:g' \
44+
// RUN: | FileCheck %t/impl_part.cppm -DPREFIX=%/t --check-prefix=CHECK-MAKE
3945
//
4046
// Check that we can generate multiple make-style dependency information with compilation database.
4147
// RUN: cat %t/P1689.dep | FileCheck %t/Checks.cpp -DPREFIX=%/t --check-prefix=CHECK-MAKE
4248
//
4349
// Check that we can mix the use of -format=p1689 and -fmodules.
4450
// RUN: clang-scan-deps -format=p1689 \
4551
// RUN: -- %clang++ -std=c++20 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache -c %t/impl_part.cppm -o %t/impl_part.o \
52+
// RUN: | sed 's:\\\\\?:/:g' \
4653
// RUN: | FileCheck %t/impl_part.cppm -DPREFIX=%/t
4754
//
4855
// Check the path in the make style dependencies are generated in relative path form
4956
// RUN: cd %t
5057
// RUN: clang-scan-deps -format=p1689 \
5158
// RUN: -- %clang++ -std=c++20 -c -fprebuilt-module-path=%t impl_part.cppm -o impl_part.o \
5259
// RUN: -MT impl_part.o.ddi -MD -MF impl_part.dep
53-
// RUN: cat impl_part.dep | FileCheck impl_part.cppm -DPREFIX=%/t --check-prefix=CHECK-MAKE-RELATIVE
60+
// RUN: cat impl_part.dep \
61+
// RUN: | sed 's:\\\\\?:/:g' \
62+
// RUN: | FileCheck impl_part.cppm -DPREFIX=%/t --check-prefix=CHECK-MAKE-RELATIVE
5463

5564

5665
//--- P1689.json.in

0 commit comments

Comments
 (0)