1# Test "report" command with and without multiple threads.
2
3RUN: llvm-cov report -num-threads=1 \
4RUN:   -path-equivalence=/tmp,%S/Inputs \
5RUN:   -instr-profile %S/Inputs/multithreaded_report/main.profdata \
6RUN:   %S/Inputs/multithreaded_report/main.covmapping > %t.1.report
7
8RUN: llvm-cov report -num-threads=10 \
9RUN:   -path-equivalence=/tmp,%S/Inputs \
10RUN:   -instr-profile %S/Inputs/multithreaded_report/main.profdata \
11RUN:   %S/Inputs/multithreaded_report/main.covmapping > %t.2.report
12
13RUN: diff %t.1.report %t.2.report
14
15# Test "export" command with and without multiple threads.
16RUN: llvm-cov export -num-threads=1 \
17RUN:   -path-equivalence=/tmp,%S/Inputs \
18RUN:   -instr-profile %S/Inputs/multithreaded_report/main.profdata \
19RUN:   %S/Inputs/multithreaded_report/main.covmapping > %t.1.json
20
21RUN: llvm-cov export -num-threads=10 \
22RUN:   -path-equivalence=/tmp,%S/Inputs \
23RUN:   -instr-profile %S/Inputs/multithreaded_report/main.profdata \
24RUN:   %S/Inputs/multithreaded_report/main.covmapping > %t.2.json
25
26RUN: diff %t.1.json %t.2.json
27
28# Test "show" command with and without multiple threads, single text file.
29RUN: llvm-cov show -format=text -num-threads=1 \
30RUN:   -path-equivalence=/tmp,%S/Inputs \
31RUN:   -instr-profile %S/Inputs/multithreaded_report/main.profdata \
32RUN:   %S/Inputs/multithreaded_report/main.covmapping > %t.1.text
33
34RUN: llvm-cov show -format=text -num-threads=10 \
35RUN:   -path-equivalence=/tmp,%S/Inputs \
36RUN:   -instr-profile %S/Inputs/multithreaded_report/main.profdata \
37RUN:   %S/Inputs/multithreaded_report/main.covmapping > %t.2.text
38
39RUN: diff %t.1.text %t.2.text
40
41# Test "show" command with and without multiple threads, single HTML file.
42RUN: llvm-cov show -format=html -num-threads=1 \
43RUN:   -path-equivalence=/tmp,%S/Inputs \
44RUN:   -instr-profile %S/Inputs/multithreaded_report/main.profdata \
45RUN:   %S/Inputs/multithreaded_report/main.covmapping > %t.1.html
46
47RUN: llvm-cov show -format=html -num-threads=10 \
48RUN:   -path-equivalence=/tmp,%S/Inputs \
49RUN:   -instr-profile %S/Inputs/multithreaded_report/main.profdata \
50RUN:   %S/Inputs/multithreaded_report/main.covmapping > %t.2.html
51
52RUN: diff %t.1.html %t.2.html
53
54# Test "show" command with and without multiple threads, text directory.
55RUN: llvm-cov show -format=text -num-threads=1 \
56RUN:   -path-equivalence=/tmp,%S/Inputs \
57RUN:   -instr-profile %S/Inputs/multithreaded_report/main.profdata \
58RUN:   %S/Inputs/multithreaded_report/main.covmapping -o %t.1.text_dir
59
60RUN: llvm-cov show -format=text -num-threads=10 \
61RUN:   -path-equivalence=/tmp,%S/Inputs \
62RUN:   -instr-profile %S/Inputs/multithreaded_report/main.profdata \
63RUN:   %S/Inputs/multithreaded_report/main.covmapping -o %t.2.text_dir
64
65RUN: diff -r %t.1.text_dir %t.2.text_dir
66
67# Test "show" command with and without multiple threads, HTML directory.
68RUN: llvm-cov show -format=html -num-threads=1 \
69RUN:   -path-equivalence=/tmp,%S/Inputs \
70RUN:   -instr-profile %S/Inputs/multithreaded_report/main.profdata \
71RUN:   %S/Inputs/multithreaded_report/main.covmapping -o %t.1.html_dir
72
73RUN: llvm-cov show -format=html -num-threads=10 \
74RUN:   -path-equivalence=/tmp,%S/Inputs \
75RUN:   -instr-profile %S/Inputs/multithreaded_report/main.profdata \
76RUN:   %S/Inputs/multithreaded_report/main.covmapping -o %t.2.html_dir
77
78RUN: diff -r %t.1.html_dir %t.2.html_dir
79
80
81Instructions for regenerating the test:
82
83# cd %S/Inputs/multithreaded_report
84
85cp -r . /tmp/multithreaded_report
86
87clang++ -std=c++11 -mllvm -enable-name-compression=false \
88    -fprofile-instr-generate -fcoverage-mapping \
89    /tmp/multithreaded_report/*.cc -o main
90
91LLVM_PROFILE_FILE="main.profraw" ./main
92llvm-profdata merge main.profraw -o main.profdata
93llvm-cov convert-for-testing ./main -o ./main.covmapping
94rm main main.profraw
95