[compiler-rt] Fix coverage-reset.cpp#160620
Merged
boomanaiden154 merged 1 commit intoSep 25, 2025
Merged
Conversation
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.
Member
|
@llvm/pr-subscribers-compiler-rt-sanitizer Author: Aiden Grossman (boomanaiden154) ChangesWhen 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:
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();
|
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
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();
|
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.