1f36d8373SAlex Lorenz // RUN: rm -rf %t.dir
2f36d8373SAlex Lorenz // RUN: rm -rf %t.cdb
36bb836afSGulfem Savrun Yeniceri // RUN: rm -rf %t_clangcl.cdb
4f36d8373SAlex Lorenz // RUN: mkdir -p %t.dir
59607f5d8SJan Korous // RUN: cp %s %t.dir/regular_cdb_input.cpp
69607f5d8SJan Korous // RUN: cp %s %t.dir/regular_cdb_input2.cpp
7f36d8373SAlex Lorenz // RUN: mkdir %t.dir/Inputs
8f36d8373SAlex Lorenz // RUN: cp %S/Inputs/header.h %t.dir/Inputs/header.h
9f36d8373SAlex Lorenz // RUN: cp %S/Inputs/header2.h %t.dir/Inputs/header2.h
10f36d8373SAlex Lorenz // RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/regular_cdb.json > %t.cdb
116bb836afSGulfem Savrun Yeniceri // RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/regular_cdb_clangcl.json > %t_clangcl.cdb
12f36d8373SAlex Lorenz //
13*b58a420fSArgyrios Kyrtzidis // RUN: clang-scan-deps -compilation-database %t.cdb -j 1 -mode preprocess-dependency-directives | \
14d816d9bdSMichael Spencer // RUN:   FileCheck --check-prefixes=CHECK1,CHECK2,CHECK2NO,CHECK3 %s
15*b58a420fSArgyrios Kyrtzidis // RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 1 -mode preprocess-dependency-directives | \
166bb836afSGulfem Savrun Yeniceri // RUN:   FileCheck --check-prefixes=CHECK1,CHECK2,CHECK2NO,CHECK3 %s
178c16c8b7SSylvain Audi 
18e1f4c4aaSAlex Lorenz // RUN: clang-scan-deps -compilation-database %t.cdb -j 1 -mode preprocess | \
19d816d9bdSMichael Spencer // RUN:   FileCheck --check-prefixes=CHECK1,CHECK2,CHECK2NO,CHECK3 %s
206bb836afSGulfem Savrun Yeniceri // RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 1 -mode preprocess | \
216bb836afSGulfem Savrun Yeniceri // RUN:   FileCheck --check-prefixes=CHECK1,CHECK2,CHECK2NO,CHECK3 %s
228c16c8b7SSylvain Audi 
23459f733eSAlex Lorenz // Make sure we didn't produce any dependency files!
24459f733eSAlex Lorenz // RUN: not cat %t.dir/regular_cdb.d
256bb836afSGulfem Savrun Yeniceri // RUN: not cat %t.dir/regular_cdb_clangcl.d
26459f733eSAlex Lorenz // RUN: not cat %t.dir/regular_cdb2.d
276bb836afSGulfem Savrun Yeniceri // RUN: not cat %t.dir/regular_cdb2_clangcl.d
28459f733eSAlex Lorenz //
29459f733eSAlex Lorenz // The output order is non-deterministic when using more than one thread,
30459f733eSAlex Lorenz // so check the output using two runs. Note that the 'NOT' check is not used
319607f5d8SJan Korous // as it might fail if the results for `regular_cdb_input.cpp` are reported before
329607f5d8SJan Korous // `regular_cdb_input2.cpp`.
33459f733eSAlex Lorenz //
34*b58a420fSArgyrios Kyrtzidis // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 -mode preprocess-dependency-directives | \
35459f733eSAlex Lorenz // RUN:   FileCheck --check-prefix=CHECK1 %s
36*b58a420fSArgyrios Kyrtzidis // RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 2 -mode preprocess-dependency-directives | \
376bb836afSGulfem Savrun Yeniceri // RUN:   FileCheck --check-prefix=CHECK1 %s
388c16c8b7SSylvain Audi 
39e1f4c4aaSAlex Lorenz // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 -mode preprocess | \
40e1f4c4aaSAlex Lorenz // RUN:   FileCheck --check-prefix=CHECK1 %s
416bb836afSGulfem Savrun Yeniceri // RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 2 -mode preprocess | \
426bb836afSGulfem Savrun Yeniceri // RUN:   FileCheck --check-prefix=CHECK1 %s
438c16c8b7SSylvain Audi 
44*b58a420fSArgyrios Kyrtzidis // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 -mode preprocess-dependency-directives | \
45e1f4c4aaSAlex Lorenz // RUN:   FileCheck --check-prefix=CHECK2 %s
46*b58a420fSArgyrios Kyrtzidis // RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 2 -mode preprocess-dependency-directives | \
476bb836afSGulfem Savrun Yeniceri // RUN:   FileCheck --check-prefix=CHECK2 %s
488c16c8b7SSylvain Audi 
49e1f4c4aaSAlex Lorenz // RUN: clang-scan-deps -compilation-database %t.cdb -j 2 -mode preprocess | \
50459f733eSAlex Lorenz // RUN:   FileCheck --check-prefix=CHECK2 %s
516bb836afSGulfem Savrun Yeniceri // RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 2 -mode preprocess | \
526bb836afSGulfem Savrun Yeniceri // RUN:   FileCheck --check-prefix=CHECK2 %s
53f36d8373SAlex Lorenz 
54f36d8373SAlex Lorenz #include "header.h"
55f36d8373SAlex Lorenz 
56d8bab69eSJan Svoboda // CHECK1: regular_cdb_input2.o:
57b51a285cSJan Korous // CHECK1-NEXT: regular_cdb_input2.cpp
58459f733eSAlex Lorenz // CHECK1-NEXT: Inputs{{/|\\}}header.h
59459f733eSAlex Lorenz // CHECK1-NEXT: Inputs{{/|\\}}header2.h
60f36d8373SAlex Lorenz 
61d8bab69eSJan Svoboda // CHECK2: regular_cdb_input.o:
62d8bab69eSJan Svoboda // CHECK2-NEXT: regular_cdb_input.cpp
63f36d8373SAlex Lorenz // CHECK2-NEXT: Inputs{{/|\\}}header.h
64459f733eSAlex Lorenz // CHECK2NO-NOT: header2
65d816d9bdSMichael Spencer 
66d8bab69eSJan Svoboda // CHECK3: adena.o:
67