svn commit: r274579 - head/contrib/netbsd-tests/lib/librt

Garrett Cooper ngie at FreeBSD.org
Sun Nov 16 06:59:59 UTC 2014


Author: ngie
Date: Sun Nov 16 06:59:58 2014
New Revision: 274579
URL: https://svnweb.freebsd.org/changeset/base/274579

Log:
  Call sem_unlink on semaphores before attempting to create them
  
  Due to the lack of uniqueness in the semaphore name, and the fact that the
  tests don't have cleanup routines, an interrupted test can leave a semaphore
  "laying around", causing all subsequent attempts to run the test to fail
  
  I will file a NetBSD PR for this issue soon

Modified:
  head/contrib/netbsd-tests/lib/librt/t_sem.c

Modified: head/contrib/netbsd-tests/lib/librt/t_sem.c
==============================================================================
--- head/contrib/netbsd-tests/lib/librt/t_sem.c	Sun Nov 16 06:35:20 2014	(r274578)
+++ head/contrib/netbsd-tests/lib/librt/t_sem.c	Sun Nov 16 06:59:58 2014	(r274579)
@@ -86,6 +86,9 @@ ATF_TC_BODY(basic, tc)
 	if (sysconf(_SC_SEMAPHORES) == -1)
 		atf_tc_skip("POSIX semaphores not supported");
 
+#ifdef __FreeBSD__
+	sem_unlink("/sem_b");
+#endif
 	sem_b = sem_open("/sem_b", O_CREAT | O_EXCL, 0644, 0);
 	ATF_REQUIRE(sem_b != SEM_FAILED);
 
@@ -127,6 +130,9 @@ ATF_TC_BODY(child, tc)
 	if (sysconf(_SC_SEMAPHORES) == -1)         
 		atf_tc_skip("POSIX semaphores not supported");
 
+#ifdef __FreeBSD__
+	sem_unlink("/sem_a");
+#endif
 	sem_a = sem_open("/sem_a", O_CREAT | O_EXCL, 0644, 0);
 	ATF_REQUIRE(sem_a != SEM_FAILED);
 


More information about the svn-src-all mailing list