[LTP] [PATCH v1] OpenPOSIX: Return PTS_UNTESTED when detaching or joining joined thread returns 0
Wei Gao
wegao@suse.com
Thu May 21 04:23:14 CEST 2026
The previous commit allowed a 0 return value, but as suggested by Cyril,
returning PTS_UNTESTED is more appropriate for Open POSIX testsuite when
the implementation does not trigger the optional ESRCH error.
Latest test in our openqa setup (Linux 7.1-rc2, Glibc 2.43) show following errors:
- pthread_detach_4-2: Test FAILED: Incorrect return code: 0 instead of ESRCH
- pthread_join_6-2: Test FAILED: Return code should be ESRCH, but is: 0 instead.
These are caused by glibc commit 5da15b15adab661c80e373b6af89be0b5fa5b3ad
("nptl: Do not use pthread set_tid_address as state synchronization (BZ #19951)").
Fixes: 630827d58634 ("OpenPOSIX: Allow 0 return value when detaching or joining joined thread")
Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Wei Gao <wegao@suse.com>
---
.../conformance/interfaces/pthread_detach/4-2.c | 11 ++++++++---
.../conformance/interfaces/pthread_join/6-2.c | 10 +++++++---
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-2.c
index 1e7b84117..4e5d80c96 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-2.c
@@ -18,7 +18,7 @@
* 1. Create a thread.
* 2.Wait 'till the thread exits.
* 3.Try and detach this thread.
- * 4.Check the return value and make sure it is ESRCH or 0
+ * 4.Check the return value and make sure it is ESRCH
*
*/
@@ -58,10 +58,15 @@ int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED)
/* Detach the non-existant thread. */
ret = pthread_detach(new_th);
+ if (ret == 0) {
+ printf("Test UNTESTED: Implementation does not return ESRCH\n");
+ return PTS_UNTESTED;
+ }
+
/* Check return value of pthread_detach() */
- if (ret != ESRCH && ret != 0) {
+ if (ret != ESRCH) {
printf
- ("Test FAILED: Incorrect return code: %d instead of ESRCH or 0\n",
+ ("Test FAILED: Incorrect return code: %d instead of ESRCH\n",
ret);
return PTS_FAIL;
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/6-2.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/6-2.c
index 4052a55e2..c924578a2 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/6-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/6-2.c
@@ -61,11 +61,15 @@ int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED)
/*
* Now that the thread has returned, try to join it again.
- * It should give the error code of ESRCH or 0.
+ * It should give the error code of ESRCH.
*/
ret = pthread_join(new_th, NULL);
- if (ret != ESRCH && ret != 0) {
- printf("Test FAILED: Return code should be ESRCH or 0, but is: "
+ if (ret == 0) {
+ printf("Test UNTESTED: Implementation does not return ESRCH\n");
+ return PTS_UNTESTED;
+ }
+ if (ret != ESRCH) {
+ printf("Test FAILED: Return code should be ESRCH, but is: "
"%d instead.\n", ret);
return PTS_FAIL;
}
--
2.54.0
More information about the ltp
mailing list