[RISCV] Add shrinkwrap test cases showing gaps in current impl
[llvm-project.git] / clang / test / ClangScanDeps / modules.cpp
blob32b0dac64f93c7fd3c17d1a8e6673e10e23c822e
1 // RUN: rm -rf %t.dir
2 // RUN: rm -rf %t.cdb
3 // RUN: rm -rf %t_clangcl.cdb
4 // RUN: rm -rf %t.module-cache
5 // RUN: rm -rf %t.module-cache_clangcl
6 // RUN: mkdir -p %t.dir
7 // RUN: cp %s %t.dir/modules_cdb_input.cpp
8 // RUN: cp %s %t.dir/modules_cdb_input2.cpp
9 // RUN: mkdir %t.dir/Inputs
10 // RUN: cp %S/Inputs/header.h %t.dir/Inputs/header.h
11 // RUN: cp %S/Inputs/header2.h %t.dir/Inputs/header2.h
12 // RUN: cp %S/Inputs/module.modulemap %t.dir/Inputs/module.modulemap
13 // RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/modules_cdb.json > %t.cdb
14 // RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/modules_cdb_clangcl.json > %t_clangcl.cdb
16 // RUN: clang-scan-deps -compilation-database %t.cdb -j 1 -mode preprocess-dependency-directives | \
17 // RUN: FileCheck --check-prefixes=CHECK1,CHECK2,CHECK2NO %s
18 // RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 1 -mode preprocess-dependency-directives | \
19 // RUN: FileCheck --check-prefixes=CHECK1,CHECK2,CHECK2NO %s
21 // The output order is non-deterministic when using more than one thread,
22 // so check the output using two runs. Note that the 'NOT' check is not used
23 // as it might fail if the results for `modules_cdb_input.cpp` are reported before
24 // `modules_cdb_input2.cpp`.
26 // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 -mode preprocess-dependency-directives | \
27 // RUN: FileCheck --check-prefix=CHECK1 %s
28 // RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 2 -mode preprocess-dependency-directives | \
29 // RUN: FileCheck --check-prefix=CHECK1 %s
30 // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 -mode preprocess | \
31 // RUN: FileCheck --check-prefix=CHECK1 %s
32 // RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 2 -mode preprocess | \
33 // RUN: FileCheck --check-prefix=CHECK1 %s
34 // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 -mode preprocess-dependency-directives | \
35 // RUN: FileCheck --check-prefix=CHECK2 %s
36 // RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 2 -mode preprocess-dependency-directives | \
37 // RUN: FileCheck --check-prefix=CHECK2 %s
38 // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 -mode preprocess | \
39 // RUN: FileCheck --check-prefix=CHECK2 %s
40 // RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 2 -mode preprocess | \
41 // RUN: FileCheck --check-prefix=CHECK2 %s
43 #include "header.h"
45 // CHECK1: modules_cdb_input2.o:
46 // CHECK1-NEXT: modules_cdb_input2.cpp
47 // CHECK1-NEXT: Inputs{{/|\\}}module.modulemap
48 // CHECK1-NEXT: Inputs{{/|\\}}header2.h
49 // CHECK1: Inputs{{/|\\}}header.h
51 // CHECK2: {{(modules_cdb_input)|(a)|(b)}}.o:
52 // CHECK2-NEXT: modules_cdb_input.cpp
53 // CHECK2-NEXT: Inputs{{/|\\}}module.modulemap
54 // CHECK2-NEXT: Inputs{{/|\\}}header.h
55 // CHECK2NO-NOT: header2