Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Jan 2015 00:58:25 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r277278 - head/contrib/netbsd-tests/lib/libpthread
Message-ID:  <201501170058.t0H0wPHF001023@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Sat Jan 17 00:58:24 2015
New Revision: 277278
URL: https://svnweb.freebsd.org/changeset/base/277278

Log:
  Fix lib/libthr/tests/detach_test
  
  - Eliminate race with liberal use of sleep(3) [1]
  - Fix NetBSD-specific implementation way of testing result from pthread_cancel
    by testing with `td` instead of `NULL` [2]
  
  PR: 196738 [1]
  PR: 191906 [2]
  
  MFC after: 1 week
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/contrib/netbsd-tests/lib/libpthread/t_detach.c

Modified: head/contrib/netbsd-tests/lib/libpthread/t_detach.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libpthread/t_detach.c	Sat Jan 17 00:02:18 2015	(r277277)
+++ head/contrib/netbsd-tests/lib/libpthread/t_detach.c	Sat Jan 17 00:58:24 2015	(r277278)
@@ -38,11 +38,18 @@ __RCSID("$NetBSD: t_detach.c,v 1.1 2011/
 
 #include "h_common.h"
 
+#ifdef __FreeBSD__
+#include <time.h>
+#endif
+
 static void	*func(void *);
 
 static void *
 func(void *arg)
 {
+#ifdef __FreeBSD__
+	sleep(2);
+#endif
 	return NULL;
 }
 
@@ -72,18 +79,25 @@ ATF_TC_BODY(pthread_detach, tc)
 	 */
 	PTHREAD_REQUIRE(pthread_detach(t));
 
+#ifdef __FreeBSD__
+	sleep(1);
+#endif
 	rv = pthread_join(t, NULL);
 	ATF_REQUIRE(rv == EINVAL);
 
 #ifdef __FreeBSD__
-	atf_tc_expect_fail("PR # 191906: fails with EINVAL, not ESRCH");
+	sleep(3);
 #endif
 
 	/*
 	 * As usual, ESRCH should follow if
 	 * we try to detach an invalid thread.
 	 */
+#ifdef __NetBSD__
 	rv = pthread_cancel(NULL);
+#else
+	rv = pthread_cancel(t);
+#endif
 	ATF_REQUIRE(rv == ESRCH);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501170058.t0H0wPHF001023>