Module Name: src
Committed By: martin
Date: Fri Aug 29 11:44:47 UTC 2014
Modified Files:
src/tests/lib/libpthread [netbsd-7]: t_swapcontext.c
Log Message:
Pull up following revision(s) (requested by bouyer in ticket #63):
tests/lib/libpthread/t_swapcontext.c: revision 1.2
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.1.12.1 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.1.12.1
--- src/tests/lib/libpthread/t_swapcontext.c:1.1 Wed Sep 12 02:00:55 2012
+++ src/tests/lib/libpthread/t_swapcontext.c Fri Aug 29 11:44:46 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.1.12.1 2014/08/29 11:44:46 martin 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)