summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorIvan Zhakov <ivan@apache.org>2023-01-21 16:13:27 +0000
committerIvan Zhakov <ivan@apache.org>2023-01-21 16:13:27 +0000
commit9b4df62cd1117d6b4348c8a1f7871ece024eb413 (patch)
tree6b009aab810e5a22ec6ff0c167af99b0dd5e733e /test
parent545069e7dc77a47168c0667bd7080db008d402de (diff)
parent166a06a11e80a5479a806ebb5a213d1c3e547fc7 (diff)
downloadapr-9b4df62cd1117d6b4348c8a1f7871ece024eb413.tar.gz
Merge thread-name branch (PR 60587) [1]:
* Introduce apr_thread_name_set() and apr_thread_name_get(). [1] https://bz.apache.org/bugzilla/show_bug.cgi?id=60587 [2] https://lists.apache.org/thread/z24logzc6v8tc0p2q3375cc10qo9y5yw git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1906889 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test')
-rw-r--r--test/testthread.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/testthread.c b/test/testthread.c
index 6eb8ebc6d..72f3ddd0a 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;