Skip to content

Commit ecac389

Browse files
committed
Check errno on startup in timerfd__{reset_to_very_long,unmodified_errno}
Due to a bug in CheriBSD, errno was set non-zero when starting this test, but without these checks the test confusingly failed in the later check which made me think something was wrong in timerfd_create. Check errno on startup to make this more obvious. See CTSRD-CHERI/cheribsd#1424
1 parent c8ef343 commit ecac389

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

test/timerfd-test.c

+3
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,7 @@ ATF_TC_BODY_FD_LEAKCHECK(timerfd__short_evfilt_timer_timeout, tc)
943943
ATF_TC_WITHOUT_HEAD(timerfd__unmodified_errno);
944944
ATF_TC_BODY_FD_LEAKCHECK(timerfd__unmodified_errno, tc)
945945
{
946+
ATF_REQUIRE(errno == 0);
946947
int timerfd = timerfd_create(CLOCK_MONOTONIC, /**/
947948
TFD_CLOEXEC | TFD_NONBLOCK);
948949
ATF_REQUIRE(timerfd >= 0);
@@ -954,6 +955,7 @@ ATF_TC_BODY_FD_LEAKCHECK(timerfd__unmodified_errno, tc)
954955
.it_value.tv_nsec = 100000000,
955956
},
956957
NULL) == 0);
958+
ATF_REQUIRE(errno == 0);
957959
(void)wait_for_timerfd(timerfd);
958960
ATF_REQUIRE(errno == 0);
959961

@@ -980,6 +982,7 @@ ATF_TC_BODY_FD_LEAKCHECK(timerfd__unmodified_errno, tc)
980982
ATF_TC_WITHOUT_HEAD(timerfd__reset_to_very_long);
981983
ATF_TC_BODY_FD_LEAKCHECK(timerfd__reset_to_very_long, tc)
982984
{
985+
ATF_REQUIRE(errno == 0);
983986
int timerfd = timerfd_create(CLOCK_MONOTONIC, /**/
984987
TFD_CLOEXEC | TFD_NONBLOCK);
985988
ATF_REQUIRE(timerfd >= 0);

0 commit comments

Comments
 (0)