From f025968bccde3c10b1245a9619b01c13b7e2caf9 Mon Sep 17 00:00:00 2001 From: James Y Knight Date: Wed, 28 Aug 2019 20:35:50 +0000 Subject: Ignore object files that lack coverage information. Before this change, if multiple binary files were presented, all of them must have been instrumented or the load would fail with coverage_map_error::no_data_found. Patch by Dean Sturtevant. Differential Revision: https://reviews.llvm.org/D66763 llvm-svn: 370257 --- .../multiple_objects_not_all_instrumented/instrumented | Bin 0 -> 66216 bytes .../instrumented.cc | 5 +++++ .../instrumented.profdata | Bin 0 -> 640 bytes .../instrumented.raw | Bin 0 -> 192 bytes .../not_instrumented | Bin 0 -> 16224 bytes .../not_instrumented.cc | 1 + .../llvm-cov/multiple-objects-not-all-instrumented.test | 12 ++++++++++++ 7 files changed, 18 insertions(+) create mode 100755 llvm/test/tools/llvm-cov/Inputs/multiple_objects_not_all_instrumented/instrumented create mode 100644 llvm/test/tools/llvm-cov/Inputs/multiple_objects_not_all_instrumented/instrumented.cc create mode 100644 llvm/test/tools/llvm-cov/Inputs/multiple_objects_not_all_instrumented/instrumented.profdata create mode 100644 llvm/test/tools/llvm-cov/Inputs/multiple_objects_not_all_instrumented/instrumented.raw create mode 100755 llvm/test/tools/llvm-cov/Inputs/multiple_objects_not_all_instrumented/not_instrumented create mode 100644 llvm/test/tools/llvm-cov/Inputs/multiple_objects_not_all_instrumented/not_instrumented.cc create mode 100644 llvm/test/tools/llvm-cov/multiple-objects-not-all-instrumented.test (limited to 'llvm/test/tools') diff --git a/llvm/test/tools/llvm-cov/Inputs/multiple_objects_not_all_instrumented/instrumented b/llvm/test/tools/llvm-cov/Inputs/multiple_objects_not_all_instrumented/instrumented new file mode 100755 index 00000000000..1a8f9b2b209 Binary files /dev/null and b/llvm/test/tools/llvm-cov/Inputs/multiple_objects_not_all_instrumented/instrumented differ diff --git a/llvm/test/tools/llvm-cov/Inputs/multiple_objects_not_all_instrumented/instrumented.cc b/llvm/test/tools/llvm-cov/Inputs/multiple_objects_not_all_instrumented/instrumented.cc new file mode 100644 index 00000000000..5c61d716ca1 --- /dev/null +++ b/llvm/test/tools/llvm-cov/Inputs/multiple_objects_not_all_instrumented/instrumented.cc @@ -0,0 +1,5 @@ +void f1() {} + +int main(int argc, char** argv) { + f1(); +} diff --git a/llvm/test/tools/llvm-cov/Inputs/multiple_objects_not_all_instrumented/instrumented.profdata b/llvm/test/tools/llvm-cov/Inputs/multiple_objects_not_all_instrumented/instrumented.profdata new file mode 100644 index 00000000000..3b8a60dd720 Binary files /dev/null and b/llvm/test/tools/llvm-cov/Inputs/multiple_objects_not_all_instrumented/instrumented.profdata differ diff --git a/llvm/test/tools/llvm-cov/Inputs/multiple_objects_not_all_instrumented/instrumented.raw b/llvm/test/tools/llvm-cov/Inputs/multiple_objects_not_all_instrumented/instrumented.raw new file mode 100644 index 00000000000..650ea7ed3a4 Binary files /dev/null and b/llvm/test/tools/llvm-cov/Inputs/multiple_objects_not_all_instrumented/instrumented.raw differ diff --git a/llvm/test/tools/llvm-cov/Inputs/multiple_objects_not_all_instrumented/not_instrumented b/llvm/test/tools/llvm-cov/Inputs/multiple_objects_not_all_instrumented/not_instrumented new file mode 100755 index 00000000000..2f9f3f2737a Binary files /dev/null and b/llvm/test/tools/llvm-cov/Inputs/multiple_objects_not_all_instrumented/not_instrumented differ diff --git a/llvm/test/tools/llvm-cov/Inputs/multiple_objects_not_all_instrumented/not_instrumented.cc b/llvm/test/tools/llvm-cov/Inputs/multiple_objects_not_all_instrumented/not_instrumented.cc new file mode 100644 index 00000000000..4b10444b174 --- /dev/null +++ b/llvm/test/tools/llvm-cov/Inputs/multiple_objects_not_all_instrumented/not_instrumented.cc @@ -0,0 +1 @@ +int main(int argc, char** argv) {} diff --git a/llvm/test/tools/llvm-cov/multiple-objects-not-all-instrumented.test b/llvm/test/tools/llvm-cov/multiple-objects-not-all-instrumented.test new file mode 100644 index 00000000000..c3a0e846bc6 --- /dev/null +++ b/llvm/test/tools/llvm-cov/multiple-objects-not-all-instrumented.test @@ -0,0 +1,12 @@ +RUN: llvm-cov export --format=lcov --instr-profile=%S/Inputs/multiple_objects_not_all_instrumented/instrumented.profdata \ +RUN: -object %S/Inputs/multiple_objects_not_all_instrumented/not_instrumented \ +RUN: -object %S/Inputs/multiple_objects_not_all_instrumented/instrumented | FileCheck -check-prefix=FN %s + +FN:1,_Z2f1v + +Instructions for regenerating the test: + +clang -std=c++11 not_instrumented.cc -o not_instrumented +clang -std=c++11 -mllvm -enable-name-compression=false -fprofile-instr-generate -fcoverage-mapping instrumented.cc -o instrumented +LLVM_PROFILE_FILE="instrumented.raw" ./instrumented +llvm-profdata merge instrumented.raw -o instrumented.profdata -- cgit v1.2.3