Skip to content

Commit

Permalink
Fix epoll__event_size test on CHERI systems
Browse files Browse the repository at this point in the history
Some systems such as 64-bit CHERI-RISC-V or Arm Morello have 128-bit
pointers, so for them the sizeof(event) assertion needs to be updated.
  • Loading branch information
arichardson committed Aug 12, 2024
1 parent 58c9087 commit 6dce79a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/epoll-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,12 @@ ATF_TC_BODY_FD_LEAKCHECK(epoll__event_size, tc)
struct epoll_event event;
// this check works on 32bit _and_ 64bit, since
// sizeof(epoll_event) == sizeof(uint32_t) + sizeof(uint64_t)
#if __SIZEOF_POINTER__ <= 8
ATF_REQUIRE(sizeof(event) == 12);
#else
/* On systems with 128-bit pointers, it will be padded to 32 bytes */
ATF_REQUIRE(sizeof(event) == 2 * sizeof(void*));
#endif
}

ATF_TC_WITHOUT_HEAD(epoll__recursive_register);
Expand Down Expand Up @@ -1232,7 +1237,9 @@ ATF_TC_BODY_FD_LEAKCHECK(epoll__epollpri, tcptr)
fd_tcp_socket(fds);

ATF_REQUIRE(fcntl(fds[0], F_SETFL, O_NONBLOCK) == 0);
ATF_REQUIRE(fcntl(fds[0], F_GETFL) & O_NONBLOCK);
ATF_REQUIRE(fcntl(fds[1], F_SETFL, O_NONBLOCK) == 0);
ATF_REQUIRE(fcntl(fds[1], F_GETFL) & O_NONBLOCK);

int ep = epoll_create1(EPOLL_CLOEXEC);
ATF_REQUIRE(ep >= 0);
Expand Down

0 comments on commit 6dce79a

Please sign in to comment.