[compiler-rt] 1d77906 - [UBSan] Increase robustness of tests
Julian Lettner via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 3 15:27:04 PDT 2020
Author: Julian Lettner
Date: 2020-08-03T15:26:58-07:00
New Revision: 1d7790604c0c4e189bf8d91583cae8f1e027b1fb
URL: https://github.com/llvm/llvm-project/commit/1d7790604c0c4e189bf8d91583cae8f1e027b1fb
DIFF: https://github.com/llvm/llvm-project/commit/1d7790604c0c4e189bf8d91583cae8f1e027b1fb.diff
LOG: [UBSan] Increase robustness of tests
These UBSan tests assert the absence of runtime errors via `count 0`,
which means "expect no output". This fails the test unnecessarily in
some environments (e.g., iOS simulator in our case). Alter the test to
be a bit more specific and "expect no error" instead of "expect no
output".
rdar://65503408
Differential Revision: https://reviews.llvm.org/D85155
Added:
Modified:
compiler-rt/test/ubsan/TestCases/Misc/nonnull.cpp
compiler-rt/test/ubsan/TestCases/Misc/nullability.c
Removed:
################################################################################
diff --git a/compiler-rt/test/ubsan/TestCases/Misc/nonnull.cpp b/compiler-rt/test/ubsan/TestCases/Misc/nonnull.cpp
index d5cd2bf763b7..c612cd824715 100644
--- a/compiler-rt/test/ubsan/TestCases/Misc/nonnull.cpp
+++ b/compiler-rt/test/ubsan/TestCases/Misc/nonnull.cpp
@@ -1,5 +1,5 @@
// RUN: %clangxx -fsanitize=returns-nonnull-attribute -w %s -O3 -o %t
-// RUN: %run %t foo 2>&1 | count 0
+// RUN: %run %t foo 2>&1 | FileCheck %s --check-prefix=NOERROR --allow-empty --implicit-check-not='runtime error'
// RUN: %run %t 2>&1 | FileCheck %s
// RUN: %clangxx -fsanitize=returns-nonnull-attribute -fno-sanitize-recover=returns-nonnull-attribute -w %s -O3 -o %t.abort
// RUN: not %run %t.abort &> /dev/null
@@ -40,3 +40,5 @@ int main(int argc, char **argv) {
return 0;
}
+
+// NOERROR-NOT: runtime error
diff --git a/compiler-rt/test/ubsan/TestCases/Misc/nullability.c b/compiler-rt/test/ubsan/TestCases/Misc/nullability.c
index a68d0f8ea362..42837983865d 100644
--- a/compiler-rt/test/ubsan/TestCases/Misc/nullability.c
+++ b/compiler-rt/test/ubsan/TestCases/Misc/nullability.c
@@ -1,6 +1,6 @@
// UNSUPPORTED: android
// RUN: %clang -w -fsanitize=nullability-arg,nullability-assign,nullability-return %s -O3 -o %t
-// RUN: %run %t foo 2>&1 | count 0
+// RUN: %run %t foo 2>&1 | FileCheck %s --check-prefix=NOERROR --allow-empty --implicit-check-not='runtime error'
// RUN: %run %t 2>&1 | FileCheck %s
// RUN: echo "nullability-arg:nullability.c" > %t.supp
@@ -67,3 +67,5 @@ int main(int argc, char **argv) {
nonnull_init2(p);
return 0;
}
+
+// NOERROR-NOT: runtime error
More information about the llvm-commits
mailing list