Skip to contentSkip to conversation

pthread_create/10-1: correct return value if test fails

PATCH Cyril Hrubis 1 participant 1 message Sep 7, 2011 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi!

Quoted 33 lines

This patch fixes return value always being 0 even if test fails. Using _exit(value) instead of pthread_exit();.

---
 .../conformance/interfaces/pthread_create/10-1.c   |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
testcases/open_posix_testsuite/conformance/interfaces/pthread_create/10-1.c +3 -3
index 265901f..fe0c88d 100644
@@ -76,16 +76,16 @@ void sig_handler(int sig)
 		if (created_thread == 1)
 		{
 			printf("Test FAILED: Created thread though an invalid attribute was passed to pthread_create().\n");
-			pthread_exit((void*)PTS_FAIL);
+			_exit(PTS_FAIL);
 		}
 
 		printf("Test PASSED\n");
-		pthread_exit((void*)PTS_PASS);
+		_exit(PTS_PASS);
 		return;
 	}
 
 	printf("Test FAILED: Did not receive segmentation fault signal, waited 10 seconds.\n");
-	pthread_exit((void*)PTS_FAIL);
+	_exit(PTS_FAIL);
 	return;
 }
 

testcases/open_posix_testsuite/conformance/interfaces/pthread_create/10-1.c int main() · line 127

Quoted 6 lines
testcases/open_posix_testsuite/conformance/interfaces/pthread_create/10-1.c +1 -1
@@ -124,4 +124,4 @@ int main()
 
 	printf("Test FAILED.\n");
 	return PTS_FAIL;
-}
\ No newline at end of file
+}

Commited, at least the tests correctly reports it's failure now. But it has some more desing flaws that needs to be fixed.

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
Using storage to extend the benefits of virtualization and iSCSI
Virtualization increases hardware utilization and delivers a new level of
agility. Learn what those decisions are and how to modernize your storage 
and backup environments for virtualization.
http://www.accelacomm.com/jaw/sfnl/114/51434361/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list