Skip to content

Commit

Permalink
[libc] Disable Death Tests While Hermetic (#77388)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
michaelrj-google committed Jan 9, 2024
1 parent a7262d2 commit b932f03
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libc/test/UnitTest/HermeticTestUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 9 additions & 0 deletions libc/test/src/math/smoke/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -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.
Expand Down

0 comments on commit b932f03

Please sign in to comment.