summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2023-05-17 11:54:38 -0700
committerFangrui Song <i@maskray.me>2023-05-17 11:54:38 -0700
commit0f9f2473613519b18004158835914bc25fcb2b40 (patch)
treeea067b1a3268eb34e180c147bf1fe372ab1684ef
parentda42b2846c82063bd1bce78d6a046f78f218eb72 (diff)
downloadllvm-0f9f2473613519b18004158835914bc25fcb2b40.tar.gz
[gcov][test] Add -dumpdir ./
These tests rely on an unintended behavior that when the driver performs both compilation and linking phases, the .gcno & .gcda files are placed in PWD. The behavior will be fixed to respect -o (match -ftime-trace, -gsplit-dwarf, and GCC). Add -dumpdir ./ so that the tests will work with or without the behavior change, and make it easy to compare the coverage behavior with GCC.
-rw-r--r--compiler-rt/test/profile/Posix/gcov-destructor.c2
-rw-r--r--compiler-rt/test/profile/Posix/gcov-dlopen.c10
-rw-r--r--compiler-rt/test/profile/Posix/gcov-execlp.c4
-rw-r--r--compiler-rt/test/profile/Posix/gcov-fork.c2
-rw-r--r--compiler-rt/test/profile/Posix/gcov-shared-flush.c12
-rw-r--r--compiler-rt/test/profile/Posix/instrprof-gcov-parallel.test4
-rw-r--r--compiler-rt/test/profile/gcov-__gcov_flush-terminate.c2
-rw-r--r--compiler-rt/test/profile/gcov-basic.c10
-rw-r--r--compiler-rt/test/profile/gcov-complex-line.c2
-rw-r--r--compiler-rt/test/profile/gcov-dump-and-remove.c2
-rw-r--r--compiler-rt/test/profile/instrprof-gcov-exceptions.test4
-rw-r--r--compiler-rt/test/profile/instrprof-gcov-multiple-bbs-single-line.test2
-rw-r--r--compiler-rt/test/profile/instrprof-gcov-multithread_fork.test2
-rw-r--r--compiler-rt/test/profile/instrprof-gcov-one-line-function.test2
-rw-r--r--compiler-rt/test/profile/instrprof-gcov-switch.test4
15 files changed, 32 insertions, 32 deletions
diff --git a/compiler-rt/test/profile/Posix/gcov-destructor.c b/compiler-rt/test/profile/Posix/gcov-destructor.c
index c6fa144bcb39..bd1e0d2dde07 100644
--- a/compiler-rt/test/profile/Posix/gcov-destructor.c
+++ b/compiler-rt/test/profile/Posix/gcov-destructor.c
@@ -1,6 +1,6 @@
/// Test that destructors and destructors whose priorities are greater than 100 are tracked.
// RUN: mkdir -p %t.dir && cd %t.dir
-// RUN: %clang --coverage %s -o %t
+// RUN: %clang --coverage %s -o %t -dumpdir ./
// RUN: rm -f gcov-destructor.gcda && %run %t
// RUN: llvm-cov gcov -t gcov-destructor.gcda | FileCheck %s
// UNSUPPORTED: darwin
diff --git a/compiler-rt/test/profile/Posix/gcov-dlopen.c b/compiler-rt/test/profile/Posix/gcov-dlopen.c
index 86b4550139cf..ceac6ac355ee 100644
--- a/compiler-rt/test/profile/Posix/gcov-dlopen.c
+++ b/compiler-rt/test/profile/Posix/gcov-dlopen.c
@@ -6,10 +6,10 @@
// RUN: echo 'void func1(int k) {}' > func1.c
// RUN: echo 'void func2(int k) {}' > func2.c
// RUN: echo 'void func3(int k) {}' > func3.c
-// RUN: %clang --coverage -fPIC -shared func1.c -o func1.so
-// RUN: %clang --coverage -fPIC -shared func2.c -o func2.so
-// RUN: %clang --coverage -fPIC -shared func3.c -o func3.so
-// RUN: %clang --coverage -fPIC -rpath %t.d %s -o %t
+// RUN: %clang --coverage -fPIC -shared func1.c -o func1.so -dumpdir ./
+// RUN: %clang --coverage -fPIC -shared func2.c -o func2.so -dumpdir ./
+// RUN: %clang --coverage -fPIC -shared func3.c -o func3.so -dumpdir ./
+// RUN: %clang --coverage -fPIC -rpath %t.d %s -o %t -dumpdir ./
/// Test with two dlopened libraries.
// RUN: rm -f gcov-dlopen.gcda func1.gcda func2.gcda
@@ -22,7 +22,7 @@
// FUNC2: 1: 1:void func2(int k) {}
/// Test with three dlopened libraries.
-// RUN: %clang -DUSE_LIB3 --coverage -fPIC -rpath %t.d %s -o %t
+// RUN: %clang -DUSE_LIB3 --coverage -fPIC -rpath %t.d %s -o %t -dumpdir ./
// RUN: rm -f gcov-dlopen.gcda func1.gcda func2.gcda func3.gcda
// RUN: %run %t
// RUN: llvm-cov gcov -t gcov-dlopen.gcda | FileCheck %s --check-prefix=LIB3
diff --git a/compiler-rt/test/profile/Posix/gcov-execlp.c b/compiler-rt/test/profile/Posix/gcov-execlp.c
index 362f59516d21..4eba1c114b3c 100644
--- a/compiler-rt/test/profile/Posix/gcov-execlp.c
+++ b/compiler-rt/test/profile/Posix/gcov-execlp.c
@@ -2,12 +2,12 @@
/// fork/exec* so the lines before exec* are counted once while succeeding
/// lines are not counted.
// RUN: mkdir -p %t.d && cd %t.d
-// RUN: %clang --coverage %s -o %t
+// RUN: %clang --coverage %s -o %t -dumpdir ./
// RUN: test -f gcov-execlp.gcno
// RUN: rm -f gcov-execlp.gcda && %run %t
// RUN: llvm-cov gcov -t gcov-execlp.gcda | FileCheck %s --check-prefixes=CHECK,EXECLP
-// RUN: %clang --coverage -DEXECVP %s -o %t
+// RUN: %clang --coverage -DEXECVP %s -o %t -dumpdir ./
// RUN: rm -f gcov-execlp.gcda && %run %t
// RUN: llvm-cov gcov -t gcov-execlp.gcda | FileCheck %s --check-prefixes=CHECK,EXECVP
diff --git a/compiler-rt/test/profile/Posix/gcov-fork.c b/compiler-rt/test/profile/Posix/gcov-fork.c
index e66690a961e2..824f1fdf599f 100644
--- a/compiler-rt/test/profile/Posix/gcov-fork.c
+++ b/compiler-rt/test/profile/Posix/gcov-fork.c
@@ -2,7 +2,7 @@
/// fork/exec* so the lines before fork are counted once while succeeding
/// lines are counted twice.
// RUN: mkdir -p %t.d && cd %t.d
-// RUN: %clang --coverage %s -o %t
+// RUN: %clang --coverage %s -o %t -dumpdir ./
// RUN: test -f gcov-fork.gcno
// RUN: rm -f gcov-fork.gcda && %run %t
diff --git a/compiler-rt/test/profile/Posix/gcov-shared-flush.c b/compiler-rt/test/profile/Posix/gcov-shared-flush.c
index 5604558509f9..40e3159dcb28 100644
--- a/compiler-rt/test/profile/Posix/gcov-shared-flush.c
+++ b/compiler-rt/test/profile/Posix/gcov-shared-flush.c
@@ -3,12 +3,12 @@
// RUN: mkdir -p %t.d && cd %t.d
-// RUN: %clang -E -DSHARED %s -o shared.c
-// RUN: %clang --coverage -fPIC -shared shared.c -o libfunc.so
+// RUN: %clang -E -DSHARED %s -o shared.c -dumpdir ./
+// RUN: %clang --coverage -fPIC -shared shared.c -o libfunc.so -dumpdir ./
// RUN: test -f shared.gcno
/// Test the case where we exit abruptly after calling __gcov_dump, which means we don't write out the counters at exit.
-// RUN: %clang -DEXIT_ABRUPTLY -DSHARED_CALL_BEFORE_FLUSH -DSHARED_CALL_AFTER_FLUSH --coverage %s -L%t.d -rpath %t.d -lfunc -o %t
+// RUN: %clang -DEXIT_ABRUPTLY -DSHARED_CALL_BEFORE_FLUSH -DSHARED_CALL_AFTER_FLUSH --coverage %s -L%t.d -rpath %t.d -lfunc -o %t -dumpdir ./
// RUN: test -f gcov-shared-flush.gcno
// RUN: rm -f gcov-shared-flush.gcda shared.gcda
@@ -22,7 +22,7 @@
// SHARED: 1: {{[[0-9]+}}:void foo(int n)
/// Test the case where we exit normally and we have a call to the shared library function before __gcov_dump.
-// RUN: %clang -DSHARED_CALL_BEFORE_FLUSH --coverage %s -L%t.d -rpath %t.d -lfunc -o %t
+// RUN: %clang -DSHARED_CALL_BEFORE_FLUSH --coverage %s -L%t.d -rpath %t.d -lfunc -o %t -dumpdir ./
// RUN: test -f gcov-shared-flush.gcno
// RUN: rm -f gcov-shared-flush.gcda shared.gcda
@@ -41,7 +41,7 @@
// SHARED_ONCE: 1: {{[0-9]+}}:void foo(int n)
// # Test the case where we exit normally and we have a call to the shared library function after __gcov_dump.
-// RUN: %clang -DSHARED_CALL_AFTER_FLUSH --coverage %s -L%t.d -rpath %t.d -lfunc -o %t
+// RUN: %clang -DSHARED_CALL_AFTER_FLUSH --coverage %s -L%t.d -rpath %t.d -lfunc -o %t -dumpdir ./
// RUN: test -f gcov-shared-flush.gcno
// RUN: rm -f gcov-shared-flush.gcda shared.gcda
@@ -58,7 +58,7 @@
// AFTER: 1: {{[0-9]+}}: bar(5);
// # Test the case where we exit normally and we have calls to the shared library function before and after __gcov_dump.
-// RUN: %clang -DSHARED_CALL_BEFORE_FLUSH -DSHARED_CALL_AFTER_FLUSH --coverage %s -L%t.d -rpath %t.d -lfunc -o %t
+// RUN: %clang -DSHARED_CALL_BEFORE_FLUSH -DSHARED_CALL_AFTER_FLUSH --coverage %s -L%t.d -rpath %t.d -lfunc -o %t -dumpdir ./
// RUN: test -f gcov-shared-flush.gcno
// RUN: rm -f gcov-shared-flush.gcda shared.gcda
diff --git a/compiler-rt/test/profile/Posix/instrprof-gcov-parallel.test b/compiler-rt/test/profile/Posix/instrprof-gcov-parallel.test
index 0c7198e3c4e9..df10f35359a8 100644
--- a/compiler-rt/test/profile/Posix/instrprof-gcov-parallel.test
+++ b/compiler-rt/test/profile/Posix/instrprof-gcov-parallel.test
@@ -1,8 +1,8 @@
RUN: mkdir -p %t.d
RUN: cd %t.d
-RUN: %clang -o %t.driver %S/../Inputs/instrprof-gcov-parallel.driver.c
-RUN: %clang --coverage -o %t.target %S/../Inputs/instrprof-gcov-parallel.target.c
+RUN: %clang -o %t.driver %S/../Inputs/instrprof-gcov-parallel.driver.c -dumpdir ./
+RUN: %clang --coverage -o %t.target %S/../Inputs/instrprof-gcov-parallel.target.c -dumpdir ./
RUN: test -f instrprof-gcov-parallel.target.gcno
RUN: rm -f instrprof-gcov-parallel.target.gcda
diff --git a/compiler-rt/test/profile/gcov-__gcov_flush-terminate.c b/compiler-rt/test/profile/gcov-__gcov_flush-terminate.c
index 649538dc2aaf..ca13a0896a7b 100644
--- a/compiler-rt/test/profile/gcov-__gcov_flush-terminate.c
+++ b/compiler-rt/test/profile/gcov-__gcov_flush-terminate.c
@@ -1,7 +1,7 @@
/// https://bugs.llvm.org/show_bug.cgi?id=38067
/// An abnormal exit does not clear execution counts of subsequent instructions.
// RUN: mkdir -p %t.dir && cd %t.dir
-// RUN: %clang --coverage %s -o %t
+// RUN: %clang --coverage %s -o %t -dumpdir ./
// RUN: test -f gcov-__gcov_flush-terminate.gcno
// RUN: rm -f gcov-__gcov_flush-terminate.gcda && %expect_crash %run %t
diff --git a/compiler-rt/test/profile/gcov-basic.c b/compiler-rt/test/profile/gcov-basic.c
index 0d8be6d7de08..a44ffd7f61fa 100644
--- a/compiler-rt/test/profile/gcov-basic.c
+++ b/compiler-rt/test/profile/gcov-basic.c
@@ -1,27 +1,27 @@
// RUN: mkdir -p %t.dir && cd %t.dir
/// gcov 3.4 redesigned the format and changed the extension from .da to .gcda
-// RUN: %clang --coverage -Xclang -coverage-version='304*' %s -o %t
+// RUN: %clang --coverage -Xclang -coverage-version='304*' %s -o %t -dumpdir ./
// RUN: rm -f gcov-basic.gcda && %run %t && %run %t a
// RUN: llvm-cov gcov -t gcov-basic.gcno | FileCheck %s
/// r173147: split checksum into cfg checksum and line checksum.
-// RUN: %clang --coverage -Xclang -coverage-version='407*' %s -o %t
+// RUN: %clang --coverage -Xclang -coverage-version='407*' %s -o %t -dumpdir ./
// RUN: rm -f gcov-basic.gcda && %run %t && %run %t a
// RUN: llvm-cov gcov -t gcov-basic.gcno | FileCheck %s
/// r189778: the exit block moved from the last to the second.
-// RUN: %clang --coverage -Xclang -coverage-version='408*' %s -o %t
+// RUN: %clang --coverage -Xclang -coverage-version='408*' %s -o %t -dumpdir ./
// RUN: rm -f gcov-basic.gcda && %run %t && %run %t a
// RUN: llvm-cov gcov -t gcov-basic.gcno
/// PR gcov-profile/48463
-// RUN: %clang --coverage -Xclang -coverage-version='800*' %s -o %t
+// RUN: %clang --coverage -Xclang -coverage-version='800*' %s -o %t -dumpdir ./
// RUN: rm -f gcov-basic.gcda && %run %t && %run %t a
// RUN: llvm-cov gcov -t gcov-basic.gcno
/// PR gcov-profile/84846, r269678
-// RUN: %clang --coverage -Xclang -coverage-version='900*' %s -o %t
+// RUN: %clang --coverage -Xclang -coverage-version='900*' %s -o %t -dumpdir ./
// RUN: rm -f gcov-basic.gcda && %run %t && %run %t a
// RUN: llvm-cov gcov -t gcov-basic.gcno
diff --git a/compiler-rt/test/profile/gcov-complex-line.c b/compiler-rt/test/profile/gcov-complex-line.c
index 86286c4a93a5..12384ae79725 100644
--- a/compiler-rt/test/profile/gcov-complex-line.c
+++ b/compiler-rt/test/profile/gcov-complex-line.c
@@ -2,7 +2,7 @@
// handle complex block graphs by skipping zero count cycles.
//
// RUN: mkdir -p %t.dir && cd %t.dir
-// RUN: %clang --coverage %s -o %t
+// RUN: %clang --coverage %s -o %t -dumpdir ./
// RUN: rm -f gcov-complex-line.gcda && %run %t
// RUN: llvm-cov gcov -t gcov-complex-line.c | FileCheck %s
diff --git a/compiler-rt/test/profile/gcov-dump-and-remove.c b/compiler-rt/test/profile/gcov-dump-and-remove.c
index c35640f93b3d..f0e1af3f22a1 100644
--- a/compiler-rt/test/profile/gcov-dump-and-remove.c
+++ b/compiler-rt/test/profile/gcov-dump-and-remove.c
@@ -2,7 +2,7 @@
/// Windows while the process is still running. In addition, test we create
/// a new .gcda on flush, so there is a file when the process exists.
// RUN: mkdir -p %t.d && cd %t.d
-// RUN: %clang --coverage -o %t %s
+// RUN: %clang --coverage -o %t %s -dumpdir ./
// RUN: test -f gcov-dump-and-remove.gcno
// RUN: rm -f gcov-dump-and-remove.gcda && %run %t
diff --git a/compiler-rt/test/profile/instrprof-gcov-exceptions.test b/compiler-rt/test/profile/instrprof-gcov-exceptions.test
index a3dcc55aaf5b..528ba70d657a 100644
--- a/compiler-rt/test/profile/instrprof-gcov-exceptions.test
+++ b/compiler-rt/test/profile/instrprof-gcov-exceptions.test
@@ -2,7 +2,7 @@ RUN: mkdir -p %t.d
RUN: cd %t.d
# Test with exceptions disabled.
-RUN: %clangxx --coverage -o %t %S/Inputs/instrprof-gcov-exceptions.cpp -fno-exceptions
+RUN: %clangxx --coverage -o %t %S/Inputs/instrprof-gcov-exceptions.cpp -fno-exceptions -dumpdir ./
RUN: test -f instrprof-gcov-exceptions.gcno
RUN: rm -f instrprof-gcov-exceptions.gcda
@@ -11,7 +11,7 @@ RUN: llvm-cov gcov instrprof-gcov-exceptions.gcda
RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-gcov-exceptions.cpp.gcov %S/Inputs/instrprof-gcov-exceptions.cpp.gcov
# Test with exceptions enabled, the result in terms of line counts should be the same.
-RUN: %clangxx --coverage -o %t %S/Inputs/instrprof-gcov-exceptions.cpp
+RUN: %clangxx --coverage -o %t %S/Inputs/instrprof-gcov-exceptions.cpp -dumpdir ./
RUN: test -f instrprof-gcov-exceptions.gcno
RUN: rm -f instrprof-gcov-exceptions.gcda
diff --git a/compiler-rt/test/profile/instrprof-gcov-multiple-bbs-single-line.test b/compiler-rt/test/profile/instrprof-gcov-multiple-bbs-single-line.test
index 66b6429208a0..db0dd14be76b 100644
--- a/compiler-rt/test/profile/instrprof-gcov-multiple-bbs-single-line.test
+++ b/compiler-rt/test/profile/instrprof-gcov-multiple-bbs-single-line.test
@@ -1,7 +1,7 @@
RUN: mkdir -p %t.d
RUN: cd %t.d
-RUN: %clang --coverage -o %t %S/Inputs/instrprof-gcov-multiple-bbs-single-line.c
+RUN: %clang --coverage -o %t %S/Inputs/instrprof-gcov-multiple-bbs-single-line.c -dumpdir ./
RUN: test -f instrprof-gcov-multiple-bbs-single-line.gcno
RUN: rm -f instrprof-gcov-multiple-bbs-single-line.gcda
diff --git a/compiler-rt/test/profile/instrprof-gcov-multithread_fork.test b/compiler-rt/test/profile/instrprof-gcov-multithread_fork.test
index e416a3077b19..24dfccf39aa0 100644
--- a/compiler-rt/test/profile/instrprof-gcov-multithread_fork.test
+++ b/compiler-rt/test/profile/instrprof-gcov-multithread_fork.test
@@ -3,7 +3,7 @@ UNSUPPORTED: target={{.*windows.*}}
RUN: mkdir -p %t.d
RUN: cd %t.d
-RUN: %clangxx --coverage -lpthread -o %t %S/Inputs/instrprof-gcov-multithread_fork.cpp
+RUN: %clangxx --coverage -lpthread -o %t %S/Inputs/instrprof-gcov-multithread_fork.cpp -dumpdir ./
RUN: test -f instrprof-gcov-multithread_fork.gcno
RUN: rm -f instrprof-gcov-multithread_fork.gcda
diff --git a/compiler-rt/test/profile/instrprof-gcov-one-line-function.test b/compiler-rt/test/profile/instrprof-gcov-one-line-function.test
index d67c21a863bf..fc3bde56720b 100644
--- a/compiler-rt/test/profile/instrprof-gcov-one-line-function.test
+++ b/compiler-rt/test/profile/instrprof-gcov-one-line-function.test
@@ -1,7 +1,7 @@
RUN: mkdir -p %t.d
RUN: cd %t.d
-RUN: %clang --coverage -o %t %S/Inputs/instrprof-gcov-one-line-function.c
+RUN: %clang --coverage -o %t %S/Inputs/instrprof-gcov-one-line-function.c -dumpdir ./
RUN: test -f instrprof-gcov-one-line-function.gcno
RUN: rm -f instrprof-gcov-one-line-function.gcda
RUN: %run %t
diff --git a/compiler-rt/test/profile/instrprof-gcov-switch.test b/compiler-rt/test/profile/instrprof-gcov-switch.test
index 9c43a93dc646..736d737d9fbb 100644
--- a/compiler-rt/test/profile/instrprof-gcov-switch.test
+++ b/compiler-rt/test/profile/instrprof-gcov-switch.test
@@ -1,14 +1,14 @@
RUN: mkdir -p %t.d
RUN: cd %t.d
-RUN: %clang --coverage -o %t %S/Inputs/instrprof-gcov-switch1.c
+RUN: %clang --coverage -o %t %S/Inputs/instrprof-gcov-switch1.c -dumpdir ./
RUN: test -f instrprof-gcov-switch1.gcno
RUN: rm -f instrprof-gcov-switch1.gcda
RUN: %run %t
RUN: llvm-cov gcov instrprof-gcov-switch1.gcda
RUN: FileCheck --match-full-lines --strict-whitespace --input-file instrprof-gcov-switch1.c.gcov %S/Inputs/instrprof-gcov-switch1.c.gcov
-RUN: %clang --coverage -o %t %S/Inputs/instrprof-gcov-switch2.c
+RUN: %clang --coverage -o %t %S/Inputs/instrprof-gcov-switch2.c -dumpdir ./
RUN: test -f instrprof-gcov-switch2.gcno
RUN: rm -f instrprof-gcov-switch2.gcda
RUN: %run %t