[libc-commits] [libc] [libc] Expand usage of libc null checks. (PR #116262)
Aly ElAshram via libc-commits
libc-commits at lists.llvm.org
Wed Dec 18 14:44:43 PST 2024
AlyElashram wrote:
> What's the error you observe? The precommit bot is pointing out:
I reverted the changes in the functions that were failing in the prebuilt commit , My only failures now are in the tests.
Here is the test I'm trying out , the test is added inside memchr_test.cpp:
```
#include "hdr/signal_macros.h"
#include "test/UnitTest/Test.h"
TEST(LlvmLibcMemChrTest, CrashOnNullPtr) {
ASSERT_DEATH([](){ LIBC_NAMESPACE::memchr(nullptr, 1, 1); } , WITH_SIGNAL(SIGSEGV));
}
```
Here is the result of the test :
```
[1908/2035] Linking CXX executable libc/test/src/string/libc.test.src.string.memchr_test.__hermetic__.__build__
FAILED: libc/test/src/string/libc.test.src.string.memchr_test.__hermetic__.__build__
: && /usr/bin/clang++ -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g -nolibc -nostartfiles -nostdlib++ -static libc/startup/linux/crt1.o libc/test/src/string/CMakeFiles/libc.test.src.string.memchr_test.__hermetic__.__build__.dir/memchr_test.cpp.o -o libc/test/src/string/libc.test.src.string.memchr_test.__hermetic__.__build__ libc/test/UnitTest/libLibcTest.hermetic.a libc/test/UnitTest/libLibcHermeticTestSupport.hermetic.a libc/test/src/string/liblibc.test.src.string.memchr_test.__hermetic__.libc.a && :
/usr/bin/ld: libc/test/src/string/CMakeFiles/libc.test.src.string.memchr_test.__hermetic__.__build__.dir/memchr_test.cpp.o: in function `LlvmLibcMemChrTest_CrashOnNullPtr::Run()':
/home/aly/llvm-project/libc/test/src/string/memchr_test.cpp:127:(.text+0xcb2): undefined reference to `__llvm_libc_20_0_0_git::testing::Test::testProcessKilled(__llvm_libc_20_0_0_git::testutils::FunctionCaller*, int, char const*, char const*, __llvm_libc_20_0_0_git::testing::internal::Location)'
/usr/bin/ld: libc/test/src/string/libc.test.src.string.memchr_test.__hermetic__.__build__: hidden symbol `_ZN22__llvm_libc_20_0_0_git7testing4Test17testProcessKilledEPNS_9testutils14FunctionCallerEiPKcS6_NS0_8internal8LocationE' isn't defined
/usr/bin/ld: final link failed: bad value
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
```
What I understand from the error is that it's not seeing the `ASSERT_DEATH` macro , but i'm not sure why since the `test.h` file is included.
@nickdesaulniers
https://github.com/llvm/llvm-project/pull/116262
More information about the libc-commits
mailing list