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.cpp
5 // RUN: cp %s %t.dir/regular_cdb2.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 | \
12 // RUN:   FileCheck --check-prefixes=CHECK1,CHECK2,CHECK2NO %s
13 //
14 // Make sure we didn't produce any dependency files!
15 // RUN: not cat %t.dir/regular_cdb.d
16 // RUN: not cat %t.dir/regular_cdb2.d
17 //
18 // The output order is non-deterministic when using more than one thread,
19 // so check the output using two runs. Note that the 'NOT' check is not used
20 // as it might fail if the results for `regular_cdb.cpp` are reported before
21 // `regular_cdb2.cpp`.
22 //
23 // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 | \
24 // RUN:   FileCheck --check-prefix=CHECK1 %s
25 // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 | \
26 // RUN:   FileCheck --check-prefix=CHECK2 %s
27 
28 #include "header.h"
29 
30 // CHECK1: regular_cdb2.cpp
31 // CHECK1-NEXT: Inputs{{/|\\}}header.h
32 // CHECK1-NEXT: Inputs{{/|\\}}header2.h
33 
34 // CHECK2: regular_cdb.cpp
35 // CHECK2-NEXT: Inputs{{/|\\}}header.h
36 // CHECK2NO-NOT: header2
37