summaryrefslogtreecommitdiff
path: root/Userland/Utilities
diff options
context:
space:
mode:
authorTim Ledbetter <timledbetter@gmail.com>2023-05-13 13:06:50 +0100
committerAndreas Kling <kling@serenityos.org>2023-05-13 17:05:59 +0200
commitd04968fee43446d73fb81b81dc1c6d508a2e1753 (patch)
tree76c90dac6573e1d757ef3930bcb38feaf8d15e05 /Userland/Utilities
parentdab991284fc723421f945cfd36f9dbc618785ee9 (diff)
downloadserenity-d04968fee43446d73fb81b81dc1c6d508a2e1753.zip
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.
Diffstat (limited to 'Userland/Utilities')
-rw-r--r--Userland/Utilities/test-pthread.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/Userland/Utilities/test-pthread.cpp b/Userland/Utilities/test-pthread.cpp
index de73f3f9e8..2b11604c0d 100644
--- a/Userland/Utilities/test-pthread.cpp
+++ b/Userland/Utilities/test-pthread.cpp
@@ -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 {};
}