Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libpthread Go back to the initial context (as test...



details:   https://anonhg.NetBSD.org/src/rev/99f710e40e67
branches:  trunk
changeset: 331820:99f710e40e67
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Mon Aug 25 16:31:15 2014 +0000

description:
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.

diffstat:

 tests/lib/libpthread/t_swapcontext.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 1fdfe019f9f6 -r 99f710e40e67 tests/lib/libpthread/t_swapcontext.c
--- a/tests/lib/libpthread/t_swapcontext.c      Mon Aug 25 16:27:25 2014 +0000
+++ b/tests/lib/libpthread/t_swapcontext.c      Mon Aug 25 16:31:15 2014 +0000
@@ -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 @@
 
        ATF_REQUIRE_EQ(oself, nself);
        printf("Test succeeded\n");
+       /* Go back in main */
+       ATF_REQUIRE(swapcontext(&nctx, &octx));
 
        /* NOTREACHED */
        return;
@@ -99,8 +101,7 @@
 
        PTHREAD_REQUIRE(getcontext(&nctx));
        PTHREAD_REQUIRE(pthread_create(&thread, NULL, threadfunc, NULL));
-       
-       return;
+       PTHREAD_REQUIRE(pthread_join(thread, NULL));
 }
 
 ATF_TP_ADD_TCS(tp)



Home | Main Index | Thread Index | Old Index