summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2019-10-10 18:01:20 +0000
committerReid Kleckner <rnk@google.com>2019-10-10 18:01:20 +0000
commita2a3b137f8656b07a18fc58778552c803b746a91 (patch)
treec5cdf94462eef76b8a3be759001bf50d9b6c4ab2 /test
parentb97b530ceab5c60f9617a42e1e514098540f2f13 (diff)
downloadclang-a2a3b137f8656b07a18fc58778552c803b746a91.tar.gz
Re-land "Use -fdebug-compilation-dir to form absolute paths in coverage mappings"
This reverts r374324 (git commit 62808631acceaa8b78f8ab9b407eb6b943ff5f77) I changed the test to not rely on finding the sequence "clang, test, CoverageMapping" in the CWD used to run the test. Instead it makes its own internal directory hierarchy of foo/bar/baz and looks for that. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374403 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CoverageMapping/debug-dir.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/CoverageMapping/debug-dir.cpp b/test/CoverageMapping/debug-dir.cpp
new file mode 100644
index 0000000000..657c9f2813
--- /dev/null
+++ b/test/CoverageMapping/debug-dir.cpp
@@ -0,0 +1,16 @@
+// %s expands to an absolute path, so to test relative paths we need to create a
+// clean directory, put the source there, and cd into it.
+// RUN: rm -rf %t
+// RUN: mkdir -p %t/foo/bar/baz
+// RUN: cp %s %t/foo/bar/baz/debug-dir.cpp
+// RUN: cd %t/foo/bar
+
+// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -emit-llvm -main-file-name debug-dir.cpp baz/debug-dir.cpp -o - | FileCheck -check-prefix=ABSOLUTE %s
+//
+// ABSOLUTE: @__llvm_coverage_mapping = {{.*"\\01.*foo.*bar.*baz.*debug-dir\.cpp}}
+
+// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -emit-llvm -main-file-name debug-dir.cpp baz/debug-dir.cpp -fdebug-compilation-dir . -o - | FileCheck -check-prefix=RELATIVE %s
+//
+// RELATIVE: @__llvm_coverage_mapping = {{.*"\\01[^/]*baz.*debug-dir\.cpp}}
+
+void f1() {}