1 // RUN: rm -rf %t.dir
2 // RUN: rm -rf %t.cdb
3 // RUN: rm -rf %t.module-cache
4 // RUN: mkdir -p %t.dir
5 // RUN: cp %s %t.dir/modules_cdb_input.cpp
6 // RUN: cp %s %t.dir/modules_cdb_input2.cpp
7 // RUN: mkdir %t.dir/Inputs
8 // RUN: cp %S/Inputs/header.h %t.dir/Inputs/header.h
9 // RUN: cp %S/Inputs/header2.h %t.dir/Inputs/header2.h
10 // RUN: cp %S/Inputs/module.modulemap %t.dir/Inputs/module.modulemap
11 // RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/modules_cdb.json > %t.cdb
12 //
13 // RUN: clang-scan-deps -compilation-database %t.cdb -j 1 -mode preprocess-minimized-sources | \
14 // RUN:   FileCheck --check-prefixes=CHECK1,CHECK2,CHECK2NO %s
15 //
16 // The output order is non-deterministic when using more than one thread,
17 // so check the output using two runs. Note that the 'NOT' check is not used
18 // as it might fail if the results for `modules_cdb_input.cpp` are reported before
19 // `modules_cdb_input2.cpp`.
20 //
21 // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 -mode preprocess-minimized-sources | \
22 // RUN:   FileCheck --check-prefix=CHECK1 %s
23 // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 -mode preprocess | \
24 // RUN:   FileCheck --check-prefix=CHECK1 %s
25 // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 -mode preprocess-minimized-sources | \
26 // RUN:   FileCheck --check-prefix=CHECK2 %s
27 // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 -mode preprocess | \
28 // RUN:   FileCheck --check-prefix=CHECK2 %s
29 
30 #include "header.h"
31 
32 // CHECK1: modules_cdb_input2.cpp
33 // CHECK1-NEXT: modules_cdb_input2.cpp
34 // CHECK1-NEXT: Inputs{{/|\\}}module.modulemap
35 // CHECK1-NEXT: Inputs{{/|\\}}header2.h
36 // CHECK1: Inputs{{/|\\}}header.h
37 
38 // CHECK2: modules_cdb_input.cpp
39 // CHECK2-NEXT: Inputs{{/|\\}}module.modulemap
40 // CHECK2-NEXT: Inputs{{/|\\}}header.h
41 // CHECK2NO-NOT: header2
42