| 1 | // REQUIRES: linux || windows |
| 2 | // REQUIRES: curl |
| 3 | |
| 4 | // Default instrumented build with no profile correlation. |
| 5 | // RUN: %clang_profgen -o %t.default.exe -Wl,--build-id=0x12345678 -fprofile-instr-generate -fcoverage-mapping %S/Inputs/instrprof-debug-info-correlate-main.cpp %S/Inputs/instrprof-debug-info-correlate-foo.cpp |
| 6 | // RUN: env LLVM_PROFILE_FILE=%t.default.profraw %run %t.default.exe |
| 7 | // RUN: llvm-profdata merge -o %t.default.profdata %t.default.profraw |
| 8 | // RUN: llvm-profdata show --all-functions --counts %t.default.profdata > %t.default.profdata.show |
| 9 | |
| 10 | // Build with profile binary correlation. |
| 11 | // RUN: %clang_profgen -o %t.correlate.exe -Wl,--build-id=0x12345678 -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 |
| 12 | // Strip above binary and run |
| 13 | // RUN: llvm-strip %t.correlate.exe -o %t.stripped.exe |
| 14 | // RUN: env LLVM_PROFILE_FILE=%t.correlate.profraw %run %t.stripped.exe |
| 15 | |
| 16 | // Test llvm-profdata merge profile correlation with --debuginfod option. |
| 17 | // RUN: mkdir -p %t/buildid/12345678 |
| 18 | // RUN: cp %t.correlate.exe %t/buildid/12345678/debuginfo |
| 19 | // RUN: mkdir -p %t/debuginfod-cache |
| 20 | // RUN: env DEBUGINFOD_CACHE_PATH=%t/debuginfod-cache DEBUGINFOD_URLS=file://%t llvm-profdata merge -o %t.correlate-debuginfod.profdata --debuginfod --correlate=binary %t.correlate.profraw |
| 21 | // RUN: llvm-profdata show --all-functions --counts %t.correlate-debuginfod.profdata > %t.correlate-debuginfod.profdata.show |
| 22 | // RUN: diff %t.default.profdata.show %t.correlate-debuginfod.profdata.show |
| 23 | |
| 24 | // Test llvm-profdata merge profile correlation with --debug-file-directory option. |
| 25 | // RUN: mkdir -p %t/.build-id/12 |
| 26 | // RUN: cp %t.correlate.exe %t/.build-id/12/345678.debug |
| 27 | // RUN: llvm-profdata merge -o %t.correlate-debug-file-dir.profdata --debug-file-directory %t --correlate=binary %t.correlate.profraw |
| 28 | // RUN: llvm-profdata show --all-functions --counts %t.correlate-debug-file-dir.profdata > %t.correlate-debug-file-dir.profdata.show |
| 29 | // RUN: diff %t.default.profdata.show %t.correlate-debug-file-dir.profdata.show |
| 30 | |
| 31 | // Test error for llvm-profdata merge profile correlation with only --correlate=binary option. |
| 32 | // RUN: not llvm-profdata merge -o %t.correlate-error.profdata --correlate=binary %t.correlate.profraw 2>&1 | FileCheck %s --check-prefix=MISSING-FLAG |
| 33 | // MISSING-FLAG: error: Expected --debuginfod or --debug-file-directory when --correlate is provided |
| 34 | |
| 35 | // Test error for llvm-profdata merge profile correlation when a proper --correlate option is not provided. |
| 36 | // RUN: not llvm-profdata merge -o %t.correlate-error.profdata --debug-file-directory %t --correlate="" %t.correlate.profraw 2>&1 | FileCheck %s --check-prefix=MISSING-CORRELATION-KIND |
| 37 | // MISSING-CORRELATION-KIND: error: Expected --correlate when --debug-file-directory is provided |
| 38 | |
| 39 | // Test error for llvm-profdata merge profile correlation with mixing correlation options. |
| 40 | // RUN: not llvm-profdata merge -o %t.error.profdata --binary-file=%t.correlate.exe --debug-file-directory %t --correlate=binary %t.correlate.profraw 2>&1 | FileCheck %s --check-prefix=MIXING-FLAGS |
| 41 | // MIXING-FLAGS: error: Expected only one of -binary-file, -debuginfod or -debug-file-directory |
| 42 | |