Use return values from syscalls in eventfd tests.

PiperOrigin-RevId: 253890611
This commit is contained in:
Rahat Mahmood 2019-06-18 16:20:42 -07:00 committed by gVisor bot
parent 0e07c94d54
commit 546b2948cb
1 changed files with 5 additions and 4 deletions

View File

@ -53,9 +53,9 @@ TEST(EventfdTest, Nonblock) {
void* read_three_times(void* arg) {
int efd = *reinterpret_cast<int*>(arg);
uint64_t l;
read(efd, &l, sizeof(l));
read(efd, &l, sizeof(l));
read(efd, &l, sizeof(l));
EXPECT_THAT(read(efd, &l, sizeof(l)), SyscallSucceedsWithValue(sizeof(l)));
EXPECT_THAT(read(efd, &l, sizeof(l)), SyscallSucceedsWithValue(sizeof(l)));
EXPECT_THAT(read(efd, &l, sizeof(l)), SyscallSucceedsWithValue(sizeof(l)));
return nullptr;
}
@ -160,7 +160,8 @@ TEST(EventfdTest, NotifyNonZero_NoRandomSave) {
ScopedThread t([&efd] {
sleep(5);
uint64_t val = 1;
write(efd.get(), &val, sizeof(val));
EXPECT_THAT(write(efd.get(), &val, sizeof(val)),
SyscallSucceedsWithValue(sizeof(val)));
});
// epoll_wait should return once the thread writes.