Skip to content

Commit 8e7fabe

Browse files
committed
Make errno asserts noop on gpu targets
1 parent 3c162ba commit 8e7fabe

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

libc/test/IntegrationTest/test.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,15 @@
6868
////////////////////////////////////////////////////////////////////////////////
6969
// Errno checks.
7070

71+
#ifdef LIBC_TARGET_ARCH_IS_GPU
72+
#define ASSERT_ERRNO_EQ(VAL)
73+
#define ASSERT_ERRNO_SUCCESS()
74+
#define ASSERT_ERRNO_FAILURE()
75+
#else
7176
#define ASSERT_ERRNO_EQ(VAL) ASSERT_EQ(VAL, static_cast<int>(errno))
7277
#define ASSERT_ERRNO_SUCCESS() ASSERT_EQ(0, static_cast<int>(errno))
7378
#define ASSERT_ERRNO_FAILURE() ASSERT_NE(0, static_cast<int>(errno))
79+
#endif
7480

7581
// Integration tests are compiled with -ffreestanding which stops treating
7682
// the main function as a non-overloadable special function. Hence, we use a

libc/test/UnitTest/ErrnoCheckingTest.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
// Define macro to validate the value stored in the errno and restore it
1717
// to zero.
1818

19+
#ifdef LIBC_TARGET_ARCH_IS_GPU
20+
#define ASSERT_ERRNO_EQ(VAL)
21+
#define ASSERT_ERRNO_SUCCESS()
22+
#define ASSERT_ERRNO_FAILURE()
23+
#else
1924
#define ASSERT_ERRNO_EQ(VAL) \
2025
do { \
2126
ASSERT_EQ(VAL, static_cast<int>(libc_errno)); \
@@ -27,6 +32,7 @@
2732
ASSERT_NE(0, static_cast<int>(libc_errno)); \
2833
libc_errno = 0; \
2934
} while (0)
35+
#endif
3036

3137
namespace LIBC_NAMESPACE_DECL {
3238
namespace testing {

0 commit comments

Comments
 (0)