- ret = lttng_pthread_getname_np(name, TEST_NAME_PROPER_LEN);
- ok(ret == 0, "Get the thread name: %s", name);
+ /* Get the initial thread name */
+ ret = lttng_pthread_getname_np(name1, TEST_NAME_PROPER_LEN);
+ ok(ret == 0, "Get the thread name: '%s'", name1);
+
+ /* Set a thread name of more than 16 bytes, should fail */
+ ret = lttng_pthread_setname_np(too_long_name);
+ ok(ret == ERANGE, "Set a too long thread name: '%s'", too_long_name);
+
+ /* Get the thread name again, shouldn't have changed */
+ ret = lttng_pthread_getname_np(name2, TEST_NAME_PROPER_LEN);
+ ok(ret == 0, "Get the thread name: '%s'", name2);
+ ok(strcmp(name1, name2) == 0, "Compare the initial thread name: '%s' == '%s'", name1, name2);