[libc-commits] [libc] b932f03 - [libc] Disable Death Tests While Hermetic (#77388)

via libc-commits libc-commits at lists.llvm.org
Tue Jan 9 15:04:25 PST 2024


Author: michaelrj-google
Date: 2024-01-09T15:04:22-08:00
New Revision: b932f03bda5a88f699d33d118ca2735da3c66677

URL: https://github.com/llvm/llvm-project/commit/b932f03bda5a88f699d33d118ca2735da3c66677
DIFF: https://github.com/llvm/llvm-project/commit/b932f03bda5a88f699d33d118ca2735da3c66677.diff

LOG: [libc] Disable Death Tests While Hermetic (#77388)

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.

Added: 
    

Modified: 
    libc/test/UnitTest/HermeticTestUtils.cpp
    libc/test/src/math/smoke/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libc/test/UnitTest/HermeticTestUtils.cpp b/libc/test/UnitTest/HermeticTestUtils.cpp
index 73d54b9eeb5ecc..68e31f478d79ab 100644
--- a/libc/test/UnitTest/HermeticTestUtils.cpp
+++ b/libc/test/UnitTest/HermeticTestUtils.cpp
@@ -104,6 +104,10 @@ void *__dso_handle = nullptr;
 
 } // extern "C"
 
+void *operator new(size_t size) { return malloc(size); }
+
+void *operator new[](size_t size) { return malloc(size); }
+
 void operator delete(void *) {
   // The libc runtime should not use the global delete operator. Hence,
   // we just trap here to catch any such accidental usages.

diff  --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt
index 65dc80c2a882a5..87b72e2a8eca2e 100644
--- a/libc/test/src/math/smoke/CMakeLists.txt
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -1214,6 +1214,9 @@ add_fp_unittest(
     libc.include.signal
     libc.src.math.nanf
     libc.src.__support.FPUtil.fp_bits
+  # FIXME: The nan tests currently have death tests, which aren't supported for
+  # hermetic tests.
+  UNIT_TEST_ONLY
 )
 
 add_fp_unittest(
@@ -1227,6 +1230,9 @@ add_fp_unittest(
     libc.include.signal
     libc.src.math.nan
     libc.src.__support.FPUtil.fp_bits
+  # FIXME: The nan tests currently have death tests, which aren't supported for
+  # hermetic tests.
+  UNIT_TEST_ONLY
 )
 
 add_fp_unittest(
@@ -1240,6 +1246,9 @@ add_fp_unittest(
     libc.include.signal
     libc.src.math.nanl
     libc.src.__support.FPUtil.fp_bits
+  # FIXME: The nan tests currently have death tests, which aren't supported for
+  # hermetic tests.
+  UNIT_TEST_ONLY
 )
 
 # FIXME: These tests are currently spurious for NVPTX.


        


More information about the libc-commits mailing list