[PATCH] D53732: [compiler-rt] [llvm-cov] Test for "Don't remap existing paths"

David Greene via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 25 14:07:15 PDT 2018


greened created this revision.
greened added reviewers: vsk, Dor1s, seaneveson.
Herald added subscribers: Sanitizers, llvm-commits, dberris.
greened added a comment.

Corresponding differential is here:

https://reviews.llvm.org/D53729


This is a test for the llvm-cov change to not remap paths for source files that exist.  It lives in compiler-rt because it uses clang to generate the profiled binary.  It doesn't seem possible to create a static binary for a test within llvm because such a static binary will necessarily encode  a fixed source path which may not even exist in the developers workarea.  A test using clang to generate the binary makes it "relocatable" to whatever build setup the developer has.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D53732

Files:
  test/profile/coverage-path-test.cpp


Index: test/profile/coverage-path-test.cpp
===================================================================
--- /dev/null
+++ test/profile/coverage-path-test.cpp
@@ -0,0 +1,10 @@
+// REQUIRES: shell
+// RUN: mkdir -p %t/a/b
+// RUN: cp %s %t/a/b/coverage-path-test.cpp
+// RUN: %clang_profgen -fuse-ld=gold -O2 -fdata-sections -ffunction-sections -fcoverage-mapping -Wl,--gc-sections -o %t/a/b/coverage-path-test.exe %t/a/b/coverage-path-test.cpp
+// RUN: env LLVM_PROFILE_FILE=%t/a/b/coverage-path-test.exe.profraw %run %t/a/b/coverage-path-test.exe
+// RUN: llvm-profdata merge -o %t/a/b/coverage-path-test.exe.profdata %t/a/b/coverage-path-test.exe.profraw
+// RUN: llvm-cov show %t/a/b/coverage-path-test.exe -instr-profile %t/a/b/coverage-path-test.exe.profdata -path-equivalence=%t/a,%t/a/b 2>&1 | FileCheck %s
+
+// CHECK: [[@LINE+1]]| 1|int main
+int main(int argc, const char *argv[]) {}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53732.171193.patch
Type: text/x-patch
Size: 900 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181025/94508250/attachment.bin>


More information about the llvm-commits mailing list