1 // REQUIRES: linux || windows 2 // Default 3 // RUN: %clang -o %t.normal -fprofile-instr-generate -fcoverage-mapping %S/Inputs/instrprof-debug-info-correlate-main.cpp %S/Inputs/instrprof-debug-info-correlate-foo.cpp 4 // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t.normal 5 // RUN: llvm-profdata merge -o %t.normal.profdata %t.profraw 6 // RUN: llvm-cov report --instr-profile=%t.normal.profdata %t.normal > %t.normal.report 7 // RUN: llvm-cov show --instr-profile=%t.normal.profdata %t.normal > %t.normal.show 8 9 // With -profile-correlate=binary flag 10 // RUN: %clang -o %t-1.exe -fprofile-instr-generate -fcoverage-mapping -mllvm -profile-correlate=binary %S/Inputs/instrprof-debug-info-correlate-main.cpp %S/Inputs/instrprof-debug-info-correlate-foo.cpp 11 // RUN: env LLVM_PROFILE_FILE=%t-1.profraw %run %t-1.exe 12 // RUN: llvm-profdata merge -o %t-1.profdata --binary-file=%t-1.exe %t-1.profraw 13 // RUN: llvm-cov report --instr-profile=%t-1.profdata %t-1.exe > %t-1.report 14 // RUN: llvm-cov show --instr-profile=%t-1.profdata %t-1.exe > %t-1.show 15 // RUN: llvm-profdata show --all-functions --counts %t.normal.profdata > %t.normal.profdata.show 16 // RUN: llvm-profdata show --all-functions --counts %t-1.profdata > %t-1.profdata.show 17 // RUN: diff %t.normal.profdata.show %t-1.profdata.show 18 // RUN: diff %t.normal.report %t-1.report 19 // RUN: diff %t.normal.show %t-1.show 20 21 // Strip above binary and run 22 // RUN: llvm-strip %t-1.exe -o %t-2.exe 23 // RUN: env LLVM_PROFILE_FILE=%t-2.profraw %run %t-2.exe 24 // RUN: llvm-profdata merge -o %t-2.profdata --binary-file=%t-1.exe %t-2.profraw 25 // RUN: llvm-cov report --instr-profile=%t-2.profdata %t-1.exe > %t-2.report 26 // RUN: llvm-cov show --instr-profile=%t-2.profdata %t-1.exe > %t-2.show 27 // RUN: llvm-profdata show --all-functions --counts %t-2.profdata > %t-2.profdata.show 28 // RUN: diff %t.normal.profdata.show %t-2.profdata.show 29 // RUN: diff %t.normal.report %t-2.report 30 // RUN: diff %t.normal.show %t-2.show 31 32 // Online merging. 33 // RUN: env LLVM_PROFILE_FILE=%t-3.profraw %run %t.normal 34 // RUN: env LLVM_PROFILE_FILE=%t-4.profraw %run %t.normal 35 // RUN: llvm-profdata merge -o %t.normal.merged.profdata %t-3.profraw %t-4.profraw 36 // RUN: llvm-cov report --instr-profile=%t.normal.merged.profdata %t.normal > %t.normal.merged.report 37 // RUN: llvm-cov show --instr-profile=%t.normal.merged.profdata %t.normal > %t.normal.merged.show 38 39 // RUN: rm -rf %t.profdir && mkdir %t.profdir 40 // RUN: env LLVM_PROFILE_FILE=%t.profdir/%m-4.profraw %run %t-2.exe 41 // RUN: env LLVM_PROFILE_FILE=%t.profdir/%m-4.profraw %run %t-2.exe 42 // RUN: llvm-profdata merge -o %t-4.profdata --binary-file=%t-1.exe %t.profdir 43 // RUN: llvm-cov report --instr-profile=%t-4.profdata %t-1.exe > %t-4.report 44 // RUN: llvm-cov show --instr-profile=%t-4.profdata %t-1.exe > %t-4.show 45 // RUN: llvm-profdata show --all-functions --counts %t.normal.merged.profdata > %t.normal.merged.profdata.show 46 // RUN: llvm-profdata show --all-functions --counts %t-4.profdata > %t-4.profdata.show 47 // RUN: diff %t.normal.merged.profdata.show %t-4.profdata.show 48 // RUN: diff %t.normal.merged.report %t-4.report 49 // RUN: diff %t.normal.merged.show %t-4.show 50 51 // TODO: After adding support for binary ID, test binaries with different binary IDs. 52