1 RUN: llvm-cov report -instr-profile %S/Inputs/sources_specified/main.profdata \ 2 RUN: -path-equivalence=/tmp,%S/Inputs \ 3 RUN: %S/Inputs/sources_specified/main.covmapping \ 4 RUN: %S/Inputs/sources_specified/main.cc %S/Inputs/sources_specified/extra \ 5 RUN: | FileCheck -check-prefix=REPORT %s 6 7 RUN: llvm-cov show -instr-profile %S/Inputs/sources_specified/main.profdata \ 8 RUN: -path-equivalence=/tmp,%S/Inputs \ 9 RUN: %S/Inputs/sources_specified/main.covmapping \ 10 RUN: %S/Inputs/sources_specified/main.cc %S/Inputs/sources_specified/extra \ 11 RUN: | FileCheck -check-prefix=SHOW %s 12 13 # Order of files may differ, check the total values calculated. 14 REPORT-NOT: {{.*}}abs.h{{.*}} 15 REPORT: {{^}}TOTAL 3{{.*}}72.73% 16 17 # Order of files may differ, check that there are 3 files and not abs.h. 18 SHOW-NOT: {{.*}}abs.h{{.*}} 19 SHOW: {{.*}}sources_specified{{.*}} 20 SHOW: {{.*}}sources_specified{{.*}} 21 SHOW: {{.*}}sources_specified{{.*}} 22 23 24 # Test "export" command. Use a temp .json file as output is a single line. 25 RUN: llvm-cov export -instr-profile %S/Inputs/sources_specified/main.profdata \ 26 RUN: -path-equivalence=/tmp,%S/Inputs \ 27 RUN: %S/Inputs/sources_specified/main.covmapping \ 28 RUN: %S/Inputs/sources_specified/main.cc %S/Inputs/sources_specified/extra \ 29 RUN: > %t.export.json 30 31 RUN: FileCheck -check-prefix=NO-EXPORT %s < %t.export.json 32 RUN: FileCheck -check-prefix=EXPORT %s < %t.export.json 33 34 NO-EXPORT-NOT: {{"filename":"(/|\\\\)tmp(/|\\\\)sources_specified(/|\\\\)abs.h"}} 35 EXPORT-DAG: {{"filename":"(/|\\\\)tmp(/|\\\\)sources_specified(/|\\\\)main.cc"}} 36 EXPORT-DAG: {{"filename":"(/|\\\\)tmp(/|\\\\)sources_specified(/|\\\\)extra(/|\\\\)dec.h"}} 37 EXPORT-DAG: {{"filename":"(/|\\\\)tmp(/|\\\\)sources_specified(/|\\\\)extra(/|\\\\)inc.h"}} 38 39 Instructions for regenerating the test: 40 41 # cd %S/Inputs/sources_specified 42 cp -r . /tmp/sources_specified 43 44 clang -mllvm -enable-name-compression=false -fprofile-instr-generate \ 45 -fcoverage-mapping /tmp/sources_specified/main.cc -o main 46 47 LLVM_PROFILE_FILE="main.raw" ./main 48 llvm-profdata merge main.raw -o main.profdata 49 llvm-cov convert-for-testing ./main -o ./main.covmapping 50 rm main main.raw 51