Module Name:    src
Committed By:   bouyer
Date:           Mon Aug 25 16:31:15 UTC 2014

Modified Files:
        src/tests/lib/libpthread: t_swapcontext.c

Log Message:
Go back to the initial context (as tests/lib/libc/sys/t_swapcontext.c does)
after checking pthread_self() didn't change. Otherwise the process exits
outside of atf context.
Should fix "Test case exited normally but failed to create the results file: 
Results file is empty" reports from atf-run.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libpthread/t_swapcontext.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libpthread/t_swapcontext.c
diff -u src/tests/lib/libpthread/t_swapcontext.c:1.1 src/tests/lib/libpthread/t_swapcontext.c:1.2
--- src/tests/lib/libpthread/t_swapcontext.c:1.1	Wed Sep 12 02:00:55 2012
+++ src/tests/lib/libpthread/t_swapcontext.c	Mon Aug 25 16:31:15 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: t_swapcontext.c,v 1.1 2012/09/12 02:00:55 manu Exp $ */
+/* $NetBSD: t_swapcontext.c,v 1.2 2014/08/25 16:31:15 bouyer Exp $ */
 
 /*
  * Copyright (c) 2012 Emmanuel Dreyfus. All rights reserved.
@@ -59,6 +59,8 @@ swapfunc(void *arg)
 
 	ATF_REQUIRE_EQ(oself, nself);
 	printf("Test succeeded\n");
+	/* Go back in main */
+	ATF_REQUIRE(swapcontext(&nctx, &octx));
 
 	/* NOTREACHED */
 	return;
@@ -99,8 +101,7 @@ ATF_TC_BODY(swapcontext1, tc)
 
 	PTHREAD_REQUIRE(getcontext(&nctx));
 	PTHREAD_REQUIRE(pthread_create(&thread, NULL, threadfunc, NULL));
-	
-	return;
+	PTHREAD_REQUIRE(pthread_join(thread, NULL));
 }
 
 ATF_TP_ADD_TCS(tp)

Reply via email to