Skip to content

[compiler-rt] Fix coverage-reset.cpp#160620

Merged
boomanaiden154 merged 1 commit into
llvm:mainfrom
boomanaiden154:fix-compiler-rt-coverage-reset
Sep 25, 2025
Merged

[compiler-rt] Fix coverage-reset.cpp#160620
boomanaiden154 merged 1 commit into
llvm:mainfrom
boomanaiden154:fix-compiler-rt-coverage-reset

Conversation

@boomanaiden154

Copy link
Copy Markdown
Contributor

When relanding a previous patch I had accidentally left this patched to tee output into a file rather than run FileCheck. This patch fixes that so the test actually tests what it is supposed to.

When relanding a previous patch I had accidentally left this patched to tee
output into a file rather than run FileCheck. This patch fixes that so
the test actually tests what it is supposed to.
@llvmbot

llvmbot commented Sep 25, 2025

Copy link
Copy Markdown
Member

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Aiden Grossman (boomanaiden154)

Changes

When relanding a previous patch I had accidentally left this patched to tee output into a file rather than run FileCheck. This patch fixes that so the test actually tests what it is supposed to.


Full diff: https://github.com/llvm/llvm-project/pull/160620.diff

1 Files Affected:

  • (modified) compiler-rt/test/asan/TestCases/Posix/coverage-reset.cpp (+5-5)
diff --git a/compiler-rt/test/asan/TestCases/Posix/coverage-reset.cpp b/compiler-rt/test/asan/TestCases/Posix/coverage-reset.cpp
index e3524fced6b4e..48319906a99f1 100644
--- a/compiler-rt/test/asan/TestCases/Posix/coverage-reset.cpp
+++ b/compiler-rt/test/asan/TestCases/Posix/coverage-reset.cpp
@@ -1,7 +1,7 @@
 // RUN: rm -rf %t.dir && mkdir -p %t.dir && cd %t.dir
 // RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard -DSHARED %s -shared -o %dynamiclib -fPIC %ld_flags_rpath_so
-// RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s %ld_flags_rpath_exe -o %t.dir/EXE
-// RUN: %env_asan_opts=coverage=1:verbosity=1 %run %t.dir/EXE 2>&1 | tee /tmp/test
+// RUN: %clangxx_asan -fsanitize-coverage=func,trace-pc-guard %s %ld_flags_rpath_exe -o %t.dir/coverage-reset
+// RUN: %env_asan_opts=coverage=1:verbosity=1 %run %t.dir/coverage-reset 2>&1 | FileCheck %s
 //
 // UNSUPPORTED: ios
 
@@ -27,7 +27,7 @@ int main(int argc, char **argv) {
   bar2();
   __sanitizer_cov_dump();
 // CHECK: RESET
-// CHECK-DAG: SanitizerCoverage: ./coverage-reset.cpp{{.*}}.sancov: 2 PCs written
+// CHECK-DAG: SanitizerCoverage: ./coverage-reset{{.*}}.sancov: 2 PCs written
 // CHECK-DAG: SanitizerCoverage: ./libcoverage-reset.cpp{{.*}}.sancov: 2 PCs written
 
   fprintf(stderr, "RESET\n");
@@ -36,7 +36,7 @@ int main(int argc, char **argv) {
   bar1();
   __sanitizer_cov_dump();
 // CHECK: RESET
-// CHECK-DAG: SanitizerCoverage: ./coverage-reset.cpp{{.*}}.sancov: 1 PCs written
+// CHECK-DAG: SanitizerCoverage: ./coverage-reset{{.*}}.sancov: 1 PCs written
 // CHECK-DAG: SanitizerCoverage: ./libcoverage-reset.cpp{{.*}}.sancov: 1 PCs written
 
   fprintf(stderr, "RESET\n");
@@ -45,7 +45,7 @@ int main(int argc, char **argv) {
   foo2();
   __sanitizer_cov_dump();
 // CHECK: RESET
-// CHECK: SanitizerCoverage: ./coverage-reset.cpp{{.*}}.sancov: 2 PCs written
+// CHECK: SanitizerCoverage: ./coverage-reset{{.*}}.sancov: 2 PCs written
 
   fprintf(stderr, "RESET\n");
   __sanitizer_cov_reset();

@github-actions

Copy link
Copy Markdown

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff origin/main HEAD --extensions cpp -- compiler-rt/test/asan/TestCases/Posix/coverage-reset.cpp

⚠️
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing origin/main to the base branch/commit you want to compare against.
⚠️

View the diff from clang-format here.
diff --git a/compiler-rt/test/asan/TestCases/Posix/coverage-reset.cpp b/compiler-rt/test/asan/TestCases/Posix/coverage-reset.cpp
index 48319906a..2cf6022a8 100644
--- a/compiler-rt/test/asan/TestCases/Posix/coverage-reset.cpp
+++ b/compiler-rt/test/asan/TestCases/Posix/coverage-reset.cpp
@@ -27,8 +27,8 @@ int main(int argc, char **argv) {
   bar2();
   __sanitizer_cov_dump();
 // CHECK: RESET
-// CHECK-DAG: SanitizerCoverage: ./coverage-reset{{.*}}.sancov: 2 PCs written
-// CHECK-DAG: SanitizerCoverage: ./libcoverage-reset.cpp{{.*}}.sancov: 2 PCs written
+  // CHECK-DAG: SanitizerCoverage: ./coverage-reset{{.*}}.sancov: 2 PCs written
+  // CHECK-DAG: SanitizerCoverage: ./libcoverage-reset.cpp{{.*}}.sancov: 2 PCs written
 
   fprintf(stderr, "RESET\n");
   __sanitizer_cov_reset();
@@ -36,8 +36,8 @@ int main(int argc, char **argv) {
   bar1();
   __sanitizer_cov_dump();
 // CHECK: RESET
-// CHECK-DAG: SanitizerCoverage: ./coverage-reset{{.*}}.sancov: 1 PCs written
-// CHECK-DAG: SanitizerCoverage: ./libcoverage-reset.cpp{{.*}}.sancov: 1 PCs written
+  // CHECK-DAG: SanitizerCoverage: ./coverage-reset{{.*}}.sancov: 1 PCs written
+  // CHECK-DAG: SanitizerCoverage: ./libcoverage-reset.cpp{{.*}}.sancov: 1 PCs written
 
   fprintf(stderr, "RESET\n");
   __sanitizer_cov_reset();
@@ -45,7 +45,7 @@ int main(int argc, char **argv) {
   foo2();
   __sanitizer_cov_dump();
 // CHECK: RESET
-// CHECK: SanitizerCoverage: ./coverage-reset{{.*}}.sancov: 2 PCs written
+  // CHECK: SanitizerCoverage: ./coverage-reset{{.*}}.sancov: 2 PCs written
 
   fprintf(stderr, "RESET\n");
   __sanitizer_cov_reset();

@boomanaiden154 boomanaiden154 merged commit ba24b3e into llvm:main Sep 25, 2025
13 of 14 checks passed
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Oct 3, 2025
When relanding a previous patch I had accidentally left this patched to
tee output into a file rather than run FileCheck. This patch fixes that
so the test actually tests what it is supposed to.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler-rt:asan Address sanitizer compiler-rt:sanitizer compiler-rt skip-precommit-approval PR for CI feedback, not intended for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants