mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:04:57 +00:00
test-pthread: Check for correct return value from sem_trywait()
At some point `sem_trywait()` changed from returning an error code on failure to returning -1 and setting the errno. Update test-pthread to expect this behavior.
This commit is contained in:
parent
dab991284f
commit
d04968fee4
1 changed files with 6 additions and 3 deletions
|
@ -107,7 +107,8 @@ static ErrorOr<void> test_semaphore_as_lock()
|
||||||
|
|
||||||
VERIFY(v.size() == threads_count * num_times);
|
VERIFY(v.size() == threads_count * num_times);
|
||||||
VERIFY(sem_trywait(&semaphore) == 0);
|
VERIFY(sem_trywait(&semaphore) == 0);
|
||||||
VERIFY(sem_trywait(&semaphore) == EAGAIN);
|
VERIFY(sem_trywait(&semaphore) == -1);
|
||||||
|
VERIFY(errno == EAGAIN);
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -136,7 +137,8 @@ static ErrorOr<void> test_semaphore_as_event()
|
||||||
[[maybe_unused]] auto r1 = reader->join();
|
[[maybe_unused]] auto r1 = reader->join();
|
||||||
[[maybe_unused]] auto r2 = writer->join();
|
[[maybe_unused]] auto r2 = writer->join();
|
||||||
|
|
||||||
VERIFY(sem_trywait(&semaphore) == EAGAIN);
|
VERIFY(sem_trywait(&semaphore) == -1);
|
||||||
|
VERIFY(errno == EAGAIN);
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -181,7 +183,8 @@ static ErrorOr<void> test_semaphore_nonbinary()
|
||||||
for (size_t i = 0; i < num; i++) {
|
for (size_t i = 0; i < num; i++) {
|
||||||
VERIFY(sem_trywait(&semaphore) == 0);
|
VERIFY(sem_trywait(&semaphore) == 0);
|
||||||
}
|
}
|
||||||
VERIFY(sem_trywait(&semaphore) == EAGAIN);
|
VERIFY(sem_trywait(&semaphore) == -1);
|
||||||
|
VERIFY(errno == EAGAIN);
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue