diff --git a/libc/test/src/__support/CMakeLists.txt b/libc/test/src/__support/CMakeLists.txt index fa35aa45712ff..a8c5517238882 100644 --- a/libc/test/src/__support/CMakeLists.txt +++ b/libc/test/src/__support/CMakeLists.txt @@ -40,6 +40,7 @@ add_libc_unittest( DEPENDS libc.src.__support.str_to_float libc.src.__support.uint128 + libc.src.errno.errno ) add_libc_unittest( diff --git a/libc/test/src/__support/str_to_float_test.cpp b/libc/test/src/__support/str_to_float_test.cpp index b5bb3b931a8af..4ebdb33549ef6 100644 --- a/libc/test/src/__support/str_to_float_test.cpp +++ b/libc/test/src/__support/str_to_float_test.cpp @@ -9,6 +9,7 @@ #include "src/__support/FPUtil/FPBits.h" #include "src/__support/UInt128.h" #include "src/__support/str_to_float.h" +#include "src/errno/libc_errno.h" #include "test/UnitTest/Test.h" @@ -78,7 +79,7 @@ class LlvmLibcStrToFloatTest : public __llvm_libc::testing::Test { typename __llvm_libc::fputil::FPBits::UIntType actual_output_mantissa = 0; uint32_t actual_output_exp2 = 0; - errno = 0; + libc_errno = 0; auto result = __llvm_libc::internal::simple_decimal_conversion(numStart); @@ -250,7 +251,7 @@ TEST(LlvmLibcStrToFloatTest, SimpleDecimalConversionExtraTypes) { uint32_t float_output_mantissa = 0; uint32_t output_exp2 = 0; - errno = 0; + libc_errno = 0; auto float_result = __llvm_libc::internal::simple_decimal_conversion( "123456789012345678900"); float_output_mantissa = float_result.num.mantissa; @@ -262,7 +263,7 @@ TEST(LlvmLibcStrToFloatTest, SimpleDecimalConversionExtraTypes) { uint64_t double_output_mantissa = 0; output_exp2 = 0; - errno = 0; + libc_errno = 0; auto double_result = __llvm_libc::internal::simple_decimal_conversion( "123456789012345678900"); diff --git a/libc/test/src/errno/errno_test.cpp b/libc/test/src/errno/errno_test.cpp index 86a9a88e86685..33185c2bcf6f5 100644 --- a/libc/test/src/errno/errno_test.cpp +++ b/libc/test/src/errno/errno_test.cpp @@ -6,11 +6,11 @@ // //===----------------------------------------------------------------------===// -#include "src/errno/llvmlibc_errno.h" +#include "src/errno/libc_errno.h" #include "test/UnitTest/Test.h" TEST(LlvmLibcErrnoTest, Basic) { int test_val = 123; - llvmlibc_errno = test_val; - ASSERT_EQ(test_val, llvmlibc_errno); + libc_errno = test_val; + ASSERT_EQ(test_val, libc_errno); } diff --git a/libc/test/src/string/CMakeLists.txt b/libc/test/src/string/CMakeLists.txt index c9623a330b1c2..67f49ab3a114f 100644 --- a/libc/test/src/string/CMakeLists.txt +++ b/libc/test/src/string/CMakeLists.txt @@ -161,7 +161,6 @@ add_libc_unittest( SRCS strdup_test.cpp DEPENDS - libc.include.errno libc.include.stdlib libc.src.string.strdup libc.src.errno.errno diff --git a/libc/test/src/string/strdup_test.cpp b/libc/test/src/string/strdup_test.cpp index ffbc55a70fb21..ee46882233dd3 100644 --- a/libc/test/src/string/strdup_test.cpp +++ b/libc/test/src/string/strdup_test.cpp @@ -6,18 +6,18 @@ // //===----------------------------------------------------------------------===// +#include "src/errno/libc_errno.h" #include "src/string/strdup.h" #include "test/UnitTest/Test.h" -#include #include TEST(LlvmLibcStrDupTest, EmptyString) { const char *empty = ""; - errno = 0; + libc_errno = 0; char *result = __llvm_libc::strdup(empty); - ASSERT_EQ(errno, 0); + ASSERT_EQ(libc_errno, 0); ASSERT_NE(result, static_cast(nullptr)); ASSERT_NE(empty, const_cast(result)); @@ -28,9 +28,9 @@ TEST(LlvmLibcStrDupTest, EmptyString) { TEST(LlvmLibcStrDupTest, AnyString) { const char *abc = "abc"; - errno = 0; + libc_errno = 0; char *result = __llvm_libc::strdup(abc); - ASSERT_EQ(errno, 0); + ASSERT_EQ(libc_errno, 0); ASSERT_NE(result, static_cast(nullptr)); ASSERT_NE(abc, const_cast(result)); @@ -39,9 +39,9 @@ TEST(LlvmLibcStrDupTest, AnyString) { } TEST(LlvmLibcStrDupTest, NullPtr) { - errno = 0; + libc_errno = 0; char *result = __llvm_libc::strdup(nullptr); - ASSERT_EQ(errno, 0); + ASSERT_EQ(libc_errno, 0); ASSERT_EQ(result, static_cast(nullptr)); }