Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions libc/test/IntegrationTest/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@
////////////////////////////////////////////////////////////////////////////////
// Errno checks.

#define ASSERT_ERRNO_EQ(VAL) ASSERT_EQ(VAL, static_cast<int>(libc_errno))
#define ASSERT_ERRNO_SUCCESS() ASSERT_EQ(0, static_cast<int>(libc_errno))
#define ASSERT_ERRNO_FAILURE() ASSERT_NE(0, static_cast<int>(libc_errno))
#define ASSERT_ERRNO_EQ(VAL) ASSERT_EQ(VAL, static_cast<int>(errno))
#define ASSERT_ERRNO_SUCCESS() ASSERT_EQ(0, static_cast<int>(errno))
#define ASSERT_ERRNO_FAILURE() ASSERT_NE(0, static_cast<int>(errno))

// Integration tests are compiled with -ffreestanding which stops treating
// the main function as a non-overloadable special function. Hence, we use a
Expand Down
5 changes: 2 additions & 3 deletions libc/test/integration/src/pthread/pthread_create_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <errno.h>
#include <linux/param.h> // For EXEC_PAGESIZE.
#include <pthread.h>

Expand Down Expand Up @@ -332,7 +331,7 @@ static void run_failure_tests() {
}

TEST_MAIN() {
libc_errno = 0;
errno = 0;
run_success_tests();
run_failure_tests();
return 0;
Expand Down
6 changes: 3 additions & 3 deletions libc/test/integration/src/pthread/pthread_join_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <errno.h>
#include <pthread.h>

static void *simpleFunc(void *) { return nullptr; }
Expand All @@ -25,7 +25,7 @@ static void nullJoinTest() {
}

TEST_MAIN() {
libc_errno = 0;
errno = 0;
nullJoinTest();
return 0;
}
2 changes: 1 addition & 1 deletion libc/test/integration/src/pthread/pthread_name_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -20,6 +19,7 @@
#include "src/pthread/pthread_setname_np.h"
#include "test/IntegrationTest/test.h"

#include <errno.h>
#include <pthread.h>

using string_view = LIBC_NAMESPACE::cpp::string_view;
Expand Down
7 changes: 3 additions & 4 deletions libc/test/integration/src/unistd/getcwd_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <errno.h>
#include <stdlib.h> // For malloc and free

using LIBC_NAMESPACE::cpp::string_view;
Expand All @@ -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;
}
2 changes: 1 addition & 1 deletion libc/test/integration/startup/linux/tls_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//

#include "src/__support/libc_errno.h"
#include "src/sys/mman/mmap.h"
#include "test/IntegrationTest/test.h"

#include <errno.h>
#include <sys/mman.h>

constexpr int threadLocalDataSize = 101;
Expand Down
Loading