aboutsummaryrefslogtreecommitdiff
path: root/tests/testlib.c
diff options
context:
space:
mode:
authorLuca Dariz <luca@orpolo.org>2024-08-21 18:36:16 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2024-08-22 23:49:01 +0200
commitca7f98dab6ae77802a7d861ad76d9c4a4700b084 (patch)
treeb5a8c718a2c69b8fc3b29fa7bb7960f2c6095e24 /tests/testlib.c
parent384679f9e0c3243f452322174d7d3eef5354baf2 (diff)
downloadgnumach-ca7f98dab6ae77802a7d861ad76d9c4a4700b084.tar.gz
gnumach-ca7f98dab6ae77802a7d861ad76d9c4a4700b084.tar.bz2
gnumach-ca7f98dab6ae77802a7d861ad76d9c4a4700b084.zip
add rpc interrupted test
* tests/test-machmsg.c: add two use cases used by glibc during signal handling * tests/include/testlib.h * tests/testlib.c: add new wait_thread_terminated() helper Message-ID: <20240821163616.189307-3-luca@orpolo.org>
Diffstat (limited to 'tests/testlib.c')
-rw-r--r--tests/testlib.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/testlib.c b/tests/testlib.c
index f82990f9..d1ce6d86 100644
--- a/tests/testlib.c
+++ b/tests/testlib.c
@@ -209,6 +209,21 @@ mach_msg_return_t mach_msg_server_once(
return mr;
}
+void wait_thread_terminated(thread_t th)
+{
+ int err;
+ struct thread_basic_info info;
+ mach_msg_type_number_t count;
+ do {
+ count = THREAD_BASIC_INFO_COUNT;
+ err = thread_info(th, THREAD_BASIC_INFO, (thread_info_t)&info, &count);
+ if (err == MACH_SEND_INVALID_DEST)
+ break;
+ ASSERT_RET(err, "error in thread_info");
+ msleep(100); // don't poll continuously
+ } while (1);
+}
+
/*
* Minimal _start() for test modules, we just take the arguments from the
* kernel, call main() and reboot. As in glibc, we expect the argument pointer