mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 05:20:30 +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
Notes:
sideshowbarker
2024-07-18 01:43:16 +09:00
Author: https://github.com/tcl3 Commit: https://github.com/SerenityOS/serenity/commit/d04968fee4 Pull-request: https://github.com/SerenityOS/serenity/pull/18805
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(sem_trywait(&semaphore) == 0);
|
||||
VERIFY(sem_trywait(&semaphore) == EAGAIN);
|
||||
VERIFY(sem_trywait(&semaphore) == -1);
|
||||
VERIFY(errno == EAGAIN);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
@ -136,7 +137,8 @@ static ErrorOr<void> test_semaphore_as_event()
|
|||
[[maybe_unused]] auto r1 = reader->join();
|
||||
[[maybe_unused]] auto r2 = writer->join();
|
||||
|
||||
VERIFY(sem_trywait(&semaphore) == EAGAIN);
|
||||
VERIFY(sem_trywait(&semaphore) == -1);
|
||||
VERIFY(errno == EAGAIN);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
@ -181,7 +183,8 @@ static ErrorOr<void> test_semaphore_nonbinary()
|
|||
for (size_t i = 0; i < num; i++) {
|
||||
VERIFY(sem_trywait(&semaphore) == 0);
|
||||
}
|
||||
VERIFY(sem_trywait(&semaphore) == EAGAIN);
|
||||
VERIFY(sem_trywait(&semaphore) == -1);
|
||||
VERIFY(errno == EAGAIN);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue