[libc-commits] [libc] [libc][test] Condition out tests that can't work on bare metal (PR #215830)
Simon Tatham via libc-commits
libc-commits at lists.llvm.org
Fri Aug 14 00:22:58 PDT 2026
================
@@ -30,15 +36,14 @@ function(_get_common_test_compile_options output_var c_test flags)
libc_add_definition(compile_options
"LIBC_TEST_SUBPROCESS_TESTS=${LIBC_TEST_SUBPROCESS_TESTS}")
- if(LIBC_TEST_SUBPROCESS_TESTS)
- # EXPECT_DEATH and ASSERT_DEATH might be quite slow. LIBC_TEST_SKIP_DEATH_TESTS
- # will make those tests no-op to reduce the overall test time.
- if(LIBC_TEST_SKIP_DEATH_TESTS)
- if(LIBC_CMAKE_VERBOSE_LOGGING)
- message(STATUS "LIBC_TEST_SKIP_DEATH_TESTS is set. EXPECT_DEATH/ASSERT_DEATH are no-op.")
- endif()
- list(APPEND compile_options "-DLIBC_TEST_SKIP_DEATH_TESTS")
+ # Set LIBC_TEST_SKIP_DEATH_TESTS to skip running tests that use EXPECT_DEATH
+ # and ASSERT_DEATH. On platforms where they work, they can be slow; on
+ # bare-metal platforms it might not be possible to implement them at all.
+ if(LIBC_TEST_SKIP_DEATH_TESTS)
----------------
statham-arm wrote:
You mean, leave the existing ifdefs as they originally were, but whenever LIBC_TEST_SUBPROCESS_TESTS isn't defined, we have a second `#else` branch where we define EXPECT_DEATH to be empty? OK.
We aren't seeing any test-program build failures relating to EXPECT_EXIT (in that with this patch and Mark's linked one we see no failures at all). I think that's just because the EXPECT_EXIT tests are all specific to functions that deal with complicated exiting behaviour, like `atexit`, and the bare-metal libc configuration doesn't include those functions, hence the tests aren't built or run either.
Whereas EXPECT_DEATH is more widespread, because it appears in tests of functions that have nothing _per se_ to do with exiting, such as testing that if you pass a null pointer to `localtime` then something appropriately horrible happens.
https://github.com/llvm/llvm-project/pull/215830
More information about the libc-commits
mailing list