1 // RUN: rm -rf %t.dir
2 // RUN: rm -rf %t.cdb
3 // RUN: rm -rf %t_clangcl.cdb
4 // RUN: mkdir -p %t.dir
5 // RUN: cp %s %t.dir/regular_cdb_input.cpp
6 // RUN: cp %s %t.dir/regular_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: sed -e "s|DIR|%/t.dir|g" %S/Inputs/regular_cdb.json > %t.cdb
11 // RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/regular_cdb_clangcl.json > %t_clangcl.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,CHECK3 %s
15 // RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 1 -mode preprocess-minimized-sources | \
16 // RUN:   FileCheck --check-prefixes=CHECK1,CHECK2,CHECK2NO,CHECK3 %s
17 
18 // RUN: clang-scan-deps -compilation-database %t.cdb -j 1 -mode preprocess | \
19 // RUN:   FileCheck --check-prefixes=CHECK1,CHECK2,CHECK2NO,CHECK3 %s
20 // RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 1 -mode preprocess | \
21 // RUN:   FileCheck --check-prefixes=CHECK1,CHECK2,CHECK2NO,CHECK3 %s
22 
23 // RUN: clang-scan-deps -compilation-database %t.cdb -j 1 -mode preprocess-minimized-sources \
24 // RUN:   -skip-excluded-pp-ranges=0 | FileCheck --check-prefixes=CHECK1,CHECK2,CHECK2NO,CHECK3 %s
25 // RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 1 -mode preprocess-minimized-sources \
26 // RUN:   -skip-excluded-pp-ranges=0 | FileCheck --check-prefixes=CHECK1,CHECK2,CHECK2NO,CHECK3 %s
27 //
28 // Make sure we didn't produce any dependency files!
29 // RUN: not cat %t.dir/regular_cdb.d
30 // RUN: not cat %t.dir/regular_cdb_clangcl.d
31 // RUN: not cat %t.dir/regular_cdb2.d
32 // RUN: not cat %t.dir/regular_cdb2_clangcl.d
33 //
34 // The output order is non-deterministic when using more than one thread,
35 // so check the output using two runs. Note that the 'NOT' check is not used
36 // as it might fail if the results for `regular_cdb_input.cpp` are reported before
37 // `regular_cdb_input2.cpp`.
38 //
39 // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 -mode preprocess-minimized-sources | \
40 // RUN:   FileCheck --check-prefix=CHECK1 %s
41 // RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 2 -mode preprocess-minimized-sources | \
42 // RUN:   FileCheck --check-prefix=CHECK1 %s
43 
44 // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 -mode preprocess | \
45 // RUN:   FileCheck --check-prefix=CHECK1 %s
46 // RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 2 -mode preprocess | \
47 // RUN:   FileCheck --check-prefix=CHECK1 %s
48 
49 // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 -mode preprocess-minimized-sources | \
50 // RUN:   FileCheck --check-prefix=CHECK2 %s
51 // RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 2 -mode preprocess-minimized-sources | \
52 // RUN:   FileCheck --check-prefix=CHECK2 %s
53 
54 // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 -mode preprocess | \
55 // RUN:   FileCheck --check-prefix=CHECK2 %s
56 // RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 2 -mode preprocess | \
57 // RUN:   FileCheck --check-prefix=CHECK2 %s
58 
59 #include "header.h"
60 
61 // CHECK1: regular_cdb_input2.o:
62 // CHECK1-NEXT: regular_cdb_input2.cpp
63 // CHECK1-NEXT: Inputs{{/|\\}}header.h
64 // CHECK1-NEXT: Inputs{{/|\\}}header2.h
65 
66 // CHECK2: regular_cdb_input.o:
67 // CHECK2-NEXT: regular_cdb_input.cpp
68 // CHECK2-NEXT: Inputs{{/|\\}}header.h
69 // CHECK2NO-NOT: header2
70 
71 // CHECK3: adena.o:
72