summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorIvan Zhakov <ivan@apache.org>2022-06-27 23:13:52 +0000
committerIvan Zhakov <ivan@apache.org>2022-06-27 23:13:52 +0000
commit7791a5b5497b7dad6f500e2db2df4da1d35cacaf (patch)
tree068fa7aef0a464175de8bfbb102f046b8ec5f5c3 /test
parent7bcf46ab762c90550e499ae1a5a4134ea3d27a8c (diff)
downloadapr-7791a5b5497b7dad6f500e2db2df4da1d35cacaf.tar.gz
On 'thread-name' branch: Add apr_thread_name_get() and apr_thread_name_set()
API to get/set thread name. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/thread-name@1902297 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 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;