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