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