xref: /llvm-project/llvm/test/tools/llvm-cov/directory_coverage.linux.test (revision bea39c5443612b638aa1cc56d36e3b1fd06f6e96)
1*bea39c54SYuhao Gu# REQUIRES: system-linux
2*bea39c54SYuhao Gu# RUN: mkdir -p %t
3*bea39c54SYuhao Gu
4*bea39c54SYuhao Gu# RUN: llvm-cov show %S/Inputs/directory_coverage/main.covmapping \
5*bea39c54SYuhao Gu# RUN:   --instr-profile %S/Inputs/directory_coverage/main.profdata \
6*bea39c54SYuhao Gu# RUN:   --path-equivalence=/tmp/directory_coverage,%S/Inputs/directory_coverage \
7*bea39c54SYuhao Gu# RUN:   --format=text --show-directory-coverage -o %t/report-text
8*bea39c54SYuhao Gu
9*bea39c54SYuhao Gu# RUN: llvm-cov show %S/Inputs/directory_coverage/main.covmapping \
10*bea39c54SYuhao Gu# RUN:   --instr-profile %S/Inputs/directory_coverage/main.profdata \
11*bea39c54SYuhao Gu# RUN:   --path-equivalence=/tmp/directory_coverage,%S/Inputs/directory_coverage \
12*bea39c54SYuhao Gu# RUN:   --format=html --show-directory-coverage -o %t/report-html
13*bea39c54SYuhao Gu
14*bea39c54SYuhao Gu# RUN: FileCheck --input-file %t/report-text/index.txt %s --check-prefix=ROOT
15*bea39c54SYuhao Gu# RUN: FileCheck --input-file %t/report-text/coverage/tmp/directory_coverage/index.txt %s --check-prefix=ROOT
16*bea39c54SYuhao Gu# RUN: FileCheck --input-file %t/report-text/coverage/tmp/directory_coverage/b0/index.txt %s --check-prefix=B0
17*bea39c54SYuhao Gu# RUN: FileCheck --input-file %t/report-text/coverage/tmp/directory_coverage/c0/c1/index.txt %s --check-prefix=C1
18*bea39c54SYuhao Gu
19*bea39c54SYuhao Gu# RUN: FileCheck --input-file %t/report-html/index.html %s --check-prefix=HTML-TOP --allow-empty
20*bea39c54SYuhao Gu# RUN: FileCheck --input-file %t/report-html/coverage/tmp/directory_coverage/index.html %s --check-prefix=ROOT
21*bea39c54SYuhao Gu# RUN: FileCheck --input-file %t/report-html/coverage/tmp/directory_coverage/b0/index.html %s --check-prefix=B0
22*bea39c54SYuhao Gu# RUN: FileCheck --input-file %t/report-html/coverage/tmp/directory_coverage/c0/c1/index.html %s --check-prefix=C1
23*bea39c54SYuhao Gu
24*bea39c54SYuhao Gu
25*bea39c54SYuhao Gu
26*bea39c54SYuhao Gu# HTML-TOP: coverage/index.html
27*bea39c54SYuhao Gu
28*bea39c54SYuhao Gu# ROOT: a0/a1/a2.cc
29*bea39c54SYuhao Gu# ROOT: b0/
30*bea39c54SYuhao Gu# ROOT-NOT: b1_1.cc
31*bea39c54SYuhao Gu# ROOT-NOT: b1_2.cc
32*bea39c54SYuhao Gu# ROOT: c0/c1/
33*bea39c54SYuhao Gu# ROOT-NOT: c2_1.cc
34*bea39c54SYuhao Gu# ROOT-NOT: b2_2.cc
35*bea39c54SYuhao Gu# ROOT: main.cc
36*bea39c54SYuhao Gu
37*bea39c54SYuhao Gu# B0: b1_1.cc
38*bea39c54SYuhao Gu# B0: b1_2.cc
39*bea39c54SYuhao Gu
40*bea39c54SYuhao Gu# C1: c2.h
41*bea39c54SYuhao Gu# C1: c2_1.cc
42*bea39c54SYuhao Gu
43*bea39c54SYuhao Gu
44*bea39c54SYuhao GuFor regenerating the test:
45*bea39c54SYuhao Gu
46*bea39c54SYuhao Gucp -r %S/Inputs/directory_coverage /tmp
47*bea39c54SYuhao Gucd /tmp/directory_coverage
48*bea39c54SYuhao Guclang -fprofile-instr-generate -fcoverage-mapping -mllvm -enable-name-compression=false \
49*bea39c54SYuhao Gu  -o main main.cc a0/a1/a2.cc b0/b1_1.cc b0/b1_2.cc c0/c1/c2_1.cc c0/c1/c2_2.cc
50*bea39c54SYuhao Gu./main
51*bea39c54SYuhao Gullvm-cov convert-for-testing main -o main.covmapping
52*bea39c54SYuhao Gullvm-profdata merge default.profraw -o main.profdata
53*bea39c54SYuhao Gurm main default.profraw
54