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,CHECK3 %s
13 // RUN: clang-scan-deps -compilation-database %t.cdb -j 1 -mode preprocess | \
14 // RUN:   FileCheck --check-prefixes=CHECK1,CHECK2,CHECK2NO,CHECK3 %s
15 // RUN: clang-scan-deps -compilation-database %t.cdb -j 1 -mode preprocess-minimized-sources \
16 // RUN:   -skip-excluded-pp-ranges=0 | FileCheck --check-prefixes=CHECK1,CHECK2,CHECK2NO,CHECK3 %s
17 //
18 // Make sure we didn't produce any dependency files!
19 // RUN: not cat %t.dir/regular_cdb.d
20 // RUN: not cat %t.dir/regular_cdb2.d
21 //
22 // The output order is non-deterministic when using more than one thread,
23 // so check the output using two runs. Note that the 'NOT' check is not used
24 // as it might fail if the results for `regular_cdb_input.cpp` are reported before
25 // `regular_cdb_input2.cpp`.
26 //
27 // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 -mode preprocess-minimized-sources | \
28 // RUN:   FileCheck --check-prefix=CHECK1 %s
29 // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 -mode preprocess | \
30 // RUN:   FileCheck --check-prefix=CHECK1 %s
31 // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 -mode preprocess-minimized-sources | \
32 // RUN:   FileCheck --check-prefix=CHECK2 %s
33 // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 -mode preprocess | \
34 // RUN:   FileCheck --check-prefix=CHECK2 %s
35 
36 #include "header.h"
37 
38 // CHECK1: regular_cdb_input2.cpp
39 // CHECK1-NEXT: regular_cdb_input2.cpp
40 // CHECK1-NEXT: Inputs{{/|\\}}header.h
41 // CHECK1-NEXT: Inputs{{/|\\}}header2.h
42 
43 // CHECK3: regular_cdb_input.o
44 // CHECK2: regular_cdb_input.cpp
45 // CHECK2-NEXT: Inputs{{/|\\}}header.h
46 // CHECK2NO-NOT: header2
47 
48 // CHECK3: adena.o
49