diff --git a/libc/test/IntegrationTest/test.h b/libc/test/IntegrationTest/test.h index 24c007d2e12e6..4a03f7aa6318b 100644 --- a/libc/test/IntegrationTest/test.h +++ b/libc/test/IntegrationTest/test.h @@ -68,9 +68,9 @@ //////////////////////////////////////////////////////////////////////////////// // Errno checks. -#define ASSERT_ERRNO_EQ(VAL) ASSERT_EQ(VAL, static_cast(libc_errno)) -#define ASSERT_ERRNO_SUCCESS() ASSERT_EQ(0, static_cast(libc_errno)) -#define ASSERT_ERRNO_FAILURE() ASSERT_NE(0, static_cast(libc_errno)) +#define ASSERT_ERRNO_EQ(VAL) ASSERT_EQ(VAL, static_cast(errno)) +#define ASSERT_ERRNO_SUCCESS() ASSERT_EQ(0, static_cast(errno)) +#define ASSERT_ERRNO_FAILURE() ASSERT_NE(0, static_cast(errno)) // Integration tests are compiled with -ffreestanding which stops treating // the main function as a non-overloadable special function. Hence, we use a diff --git a/libc/test/integration/src/pthread/pthread_create_test.cpp b/libc/test/integration/src/pthread/pthread_create_test.cpp index aecbad6514aaa..abd348e707c09 100644 --- a/libc/test/integration/src/pthread/pthread_create_test.cpp +++ b/libc/test/integration/src/pthread/pthread_create_test.cpp @@ -29,10 +29,9 @@ #include "src/__support/CPP/new.h" #include "src/__support/threads/thread.h" -#include "src/__support/libc_errno.h" - #include "test/IntegrationTest/test.h" +#include #include // For EXEC_PAGESIZE. #include @@ -332,7 +331,7 @@ static void run_failure_tests() { } TEST_MAIN() { - libc_errno = 0; + errno = 0; run_success_tests(); run_failure_tests(); return 0; diff --git a/libc/test/integration/src/pthread/pthread_join_test.cpp b/libc/test/integration/src/pthread/pthread_join_test.cpp index 5d0bcd8e23658..6dea99de1a64f 100644 --- a/libc/test/integration/src/pthread/pthread_join_test.cpp +++ b/libc/test/integration/src/pthread/pthread_join_test.cpp @@ -9,9 +9,9 @@ #include "src/pthread/pthread_create.h" #include "src/pthread/pthread_join.h" -#include "src/__support/libc_errno.h" - #include "test/IntegrationTest/test.h" + +#include #include static void *simpleFunc(void *) { return nullptr; } @@ -25,7 +25,7 @@ static void nullJoinTest() { } TEST_MAIN() { - libc_errno = 0; + errno = 0; nullJoinTest(); return 0; } diff --git a/libc/test/integration/src/pthread/pthread_name_test.cpp b/libc/test/integration/src/pthread/pthread_name_test.cpp index 343a22356593a..d2a5ffc544ec9 100644 --- a/libc/test/integration/src/pthread/pthread_name_test.cpp +++ b/libc/test/integration/src/pthread/pthread_name_test.cpp @@ -8,7 +8,6 @@ #include "hdr/stdint_proxy.h" // uintptr_t #include "src/__support/CPP/string_view.h" -#include "src/__support/libc_errno.h" #include "src/pthread/pthread_create.h" #include "src/pthread/pthread_getname_np.h" #include "src/pthread/pthread_join.h" @@ -20,6 +19,7 @@ #include "src/pthread/pthread_setname_np.h" #include "test/IntegrationTest/test.h" +#include #include using string_view = LIBC_NAMESPACE::cpp::string_view; diff --git a/libc/test/integration/src/unistd/getcwd_test.cpp b/libc/test/integration/src/unistd/getcwd_test.cpp index 1b321b01e9315..7b87a8f0ed41c 100644 --- a/libc/test/integration/src/unistd/getcwd_test.cpp +++ b/libc/test/integration/src/unistd/getcwd_test.cpp @@ -7,12 +7,12 @@ //===----------------------------------------------------------------------===// #include "src/__support/CPP/string_view.h" -#include "src/__support/libc_errno.h" #include "src/stdlib/getenv.h" #include "src/unistd/getcwd.h" #include "test/IntegrationTest/test.h" +#include #include // For malloc and free using LIBC_NAMESPACE::cpp::string_view; @@ -31,13 +31,12 @@ TEST_MAIN(int argc, char **argv, char **envp) { cwd = LIBC_NAMESPACE::getcwd(buffer, 0); ASSERT_TRUE(cwd == nullptr); ASSERT_ERRNO_EQ(EINVAL); - libc_errno = 0; // Insufficient size + errno = 0; cwd = LIBC_NAMESPACE::getcwd(buffer, 2); ASSERT_TRUE(cwd == nullptr); - int err = libc_errno; - ASSERT_EQ(err, ERANGE); + ASSERT_ERRNO_EQ(ERANGE); return 0; } diff --git a/libc/test/integration/startup/linux/tls_test.cpp b/libc/test/integration/startup/linux/tls_test.cpp index de3bd06c39cf6..688a94bdeb6fb 100644 --- a/libc/test/integration/startup/linux/tls_test.cpp +++ b/libc/test/integration/startup/linux/tls_test.cpp @@ -6,10 +6,10 @@ // //===----------------------------------------------------------------------===// -#include "src/__support/libc_errno.h" #include "src/sys/mman/mmap.h" #include "test/IntegrationTest/test.h" +#include #include constexpr int threadLocalDataSize = 101;