Skip to contentSkip to conversation

OpenPOSIX: Return PTS_UNTESTED when detaching or joining joined thread returns 0

PATCH In review Wei Gao via ltp 3 participants 3 messages May 21 – Jun 1

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 OpenPOSIX: Return PTS_UNTESTED when detaching or joining joined thread returns 0

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")
---
 .../conformance/interfaces/pthread_detach/4-2.c       | 11 ++++++++---
 .../conformance/interfaces/pthread_join/6-2.c         | 10 +++++++---
 2 files changed, 15 insertions(+), 6 deletions(-)
testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-2.c +8 -3
index 1e7b84117..4e5d80c96 100644
@@ -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;
 
testcases/open_posix_testsuite/conformance/interfaces/pthread_join/6-2.c +7 -3
index 4052a55e2..c924578a2 100644
@@ -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;
 	}
Signature · 5 lines
2.54.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by LTP AI Reviewer on v1 1/1
#1 lore raw

Hi Wei,

testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-2.c int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED) · line 64

Quoted 6 lines · Wei Gao

OpenPOSIX: Return PTS_UNTESTED when detaching or joining joined thread returns 0

testcases/open_posix_testsuite/conformance/interfaces/pthread_detach/4-2.c +4 -0
+       if (ret == 0) {
+               printf("Test UNTESTED: Implementation does not return ESRCH\n");
+               return PTS_UNTESTED;
+       }

Correct approach — returning PTS_UNTESTED is more semantically accurate than accepting 0 as a passing result when ESRCH is the expected optional behavior.

---
Note:

Our agent completed the review of the patch. The full review can be found at: https://patchwork.ozlabs.org/project/ltp/list/?series=505260

The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp