-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[libc] Disable Death Tests While Hermetic #77388
[libc] Disable Death Tests While Hermetic #77388
Conversation
The death test infrastructure seems to depend on operator new, which isn't currently supported in our hermetic tests. This patch just disables the death tests in hermetic mode since they only overlap in the nan tests.
@llvm/pr-subscribers-libc Author: None (michaelrj-google) ChangesThe death test infrastructure seems to depend on operator new, which Full diff: https://github.com/llvm/llvm-project/pull/77388.diff 4 Files Affected:
diff --git a/libc/cmake/modules/LLVMLibCTestRules.cmake b/libc/cmake/modules/LLVMLibCTestRules.cmake
index 24f543f6e4c132..8029500f63e68b 100644
--- a/libc/cmake/modules/LLVMLibCTestRules.cmake
+++ b/libc/cmake/modules/LLVMLibCTestRules.cmake
@@ -605,7 +605,7 @@ function(add_integration_test test_name)
endfunction(add_integration_test)
set(LIBC_HERMETIC_TEST_COMPILE_OPTIONS ${LIBC_COMPILE_OPTIONS_DEFAULT}
- -fpie -ffreestanding -fno-exceptions -fno-rtti)
+ -fpie -ffreestanding -fno-exceptions -fno-rtti -DLIBC_HERMETIC_TEST)
# The GPU build requires overriding the default CMake triple and architecture.
if(LIBC_GPU_TARGET_ARCHITECTURE_IS_AMDGPU)
list(APPEND LIBC_HERMETIC_TEST_COMPILE_OPTIONS
diff --git a/libc/test/src/math/smoke/nan_test.cpp b/libc/test/src/math/smoke/nan_test.cpp
index 81e1400f0bb6b9..f7a05d0f73008f 100644
--- a/libc/test/src/math/smoke/nan_test.cpp
+++ b/libc/test/src/math/smoke/nan_test.cpp
@@ -42,8 +42,8 @@ TEST_F(LlvmLibcNanTest, RandomString) {
run_test("123 ", 0x7ff8000000000000);
}
-#ifndef LIBC_HAVE_ADDRESS_SANITIZER
+#if !defined(LIBC_HAVE_ADDRESS_SANITIZER) && !defined(LIBC_HERMETIC_TEST)
TEST_F(LlvmLibcNanTest, InvalidInput) {
EXPECT_DEATH([] { LIBC_NAMESPACE::nan(nullptr); }, WITH_SIGNAL(SIGSEGV));
}
-#endif // LIBC_HAVE_ADDRESS_SANITIZER
+#endif // !LIBC_HAVE_ADDRESS_SANITIZER && !LIBC_HERMETIC_TEST
diff --git a/libc/test/src/math/smoke/nanf_test.cpp b/libc/test/src/math/smoke/nanf_test.cpp
index 1d337ecf1dcd08..1aa4f00f00c3a1 100644
--- a/libc/test/src/math/smoke/nanf_test.cpp
+++ b/libc/test/src/math/smoke/nanf_test.cpp
@@ -41,8 +41,8 @@ TEST_F(LlvmLibcNanfTest, RandomString) {
run_test("123 ", 0x7fc00000);
}
-#ifndef LIBC_HAVE_ADDRESS_SANITIZER
+#if !defined(LIBC_HAVE_ADDRESS_SANITIZER) && !defined(LIBC_HERMETIC_TEST)
TEST_F(LlvmLibcNanfTest, InvalidInput) {
EXPECT_DEATH([] { LIBC_NAMESPACE::nanf(nullptr); }, WITH_SIGNAL(SIGSEGV));
}
-#endif // LIBC_HAVE_ADDRESS_SANITIZER
+#endif // !LIBC_HAVE_ADDRESS_SANITIZER && !LIBC_HERMETIC_TEST
diff --git a/libc/test/src/math/smoke/nanl_test.cpp b/libc/test/src/math/smoke/nanl_test.cpp
index 009710b49c832e..f3f241e8786e0d 100644
--- a/libc/test/src/math/smoke/nanl_test.cpp
+++ b/libc/test/src/math/smoke/nanl_test.cpp
@@ -67,8 +67,8 @@ TEST_F(LlvmLibcNanlTest, RandomString) {
run_test("123 ", expected);
}
-#ifndef LIBC_HAVE_ADDRESS_SANITIZER
+#if !defined(LIBC_HAVE_ADDRESS_SANITIZER) && !defined(LIBC_HERMETIC_TEST)
TEST_F(LlvmLibcNanlTest, InvalidInput) {
EXPECT_DEATH([] { LIBC_NAMESPACE::nanl(nullptr); }, WITH_SIGNAL(SIGSEGV));
}
-#endif // LIBC_HAVE_ADDRESS_SANITIZER
+#endif // !LIBC_HAVE_ADDRESS_SANITIZER && !LIBC_HERMETIC_TEST
|
I thought we had operator new in hermetic tests? I'm remembering an old issue where we had the regular |
Here's the error if you want to look for yourself:
|
Seems fine to disable for now, but I would prefer:
Folks are probably going to keep hitting this issue as they write more and more death tests. |
My understanding was that death tests are always disabled when doing hermetic tests, so they should always be |
Defining |
New patch is up. After some discussion with @nickdesaulniers I decided to leave the hermetic |
The death test infrastructure seems to depend on operator new, which isn't currently supported in our hermetic tests. This patch just disables the death tests in hermetic mode since they only overlap in the nan tests.
The death test infrastructure seems to depend on operator new, which
isn't currently supported in our hermetic tests. This patch just
disables the death tests in hermetic mode since they only overlap in the
nan tests.