summaryrefslogtreecommitdiff
path: root/test/testthread.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/testthread.c')
-rw-r--r--test/testthread.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/testthread.c b/test/testthread.c
index e64bdd4b7..2f8b1cb5a 100644
--- a/test/testthread.c
+++ b/test/testthread.c
@@ -107,6 +107,36 @@ static void check_thread_once(abts_case *tc, void *data)
ABTS_INT_EQUAL(tc, 1, value);
}
+static void thread_name(abts_case *tc, void *data)
+{
+ apr_status_t rv;
+ char *name;
+
+ rv = apr_thread_name_set("thread-1", NULL, p);
+ if (rv == APR_ENOTIMPL) {
+ ABTS_NOT_IMPL(tc, "apr_thread_name_set is not implemented.")
+ return ;
+ }
+
+ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
+
+ rv = apr_thread_name_get(&name, NULL, p);
+ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
+ ABTS_STR_EQUAL(tc, "thread-1", name);
+
+ rv = apr_thread_name_set("thread-1", NULL, p);
+ if (rv == APR_ENOTIMPL) {
+ ABTS_NOT_IMPL(tc, "apr_thread_name_set is not implemented.")
+ return ;
+ }
+
+ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
+
+ rv = apr_thread_name_get(&name, NULL, p);
+ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
+ ABTS_STR_EQUAL(tc, "thread-1", name);
+}
+
#else
static void threads_not_impl(abts_case *tc, void *data)
@@ -128,6 +158,7 @@ abts_suite *testthread(abts_suite *suite)
abts_run_test(suite, join_threads, NULL);
abts_run_test(suite, check_locks, NULL);
abts_run_test(suite, check_thread_once, NULL);
+ abts_run_test(suite, thread_name, NULL);
#endif
return suite;