NetBSD-Bugs archive

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

Re: bin/51872: [PATCH] tests/lib/librt/t_sem: call sem_unlink after :basic and :child



The following reply was made to PR bin/51872; it has been noted by GNATS.

From: "Ngie Cooper (yaneurabeya)" <yaneurabeya%gmail.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: bin/51872: [PATCH] tests/lib/librt/t_sem: call sem_unlink after
 :basic and :child
Date: Fri, 13 Jan 2017 23:11:23 -0800

 --Apple-Mail=_AAE4D6DB-321E-4849-B5A5-6CC5B50101E7
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=us-ascii
 
 Patch attached.
 -Ngie
 
 --Apple-Mail=_AAE4D6DB-321E-4849-B5A5-6CC5B50101E7
 Content-Disposition: attachment;
 	filename=t_sem-run-sem_unlink-in-cleanup-routine.patch
 Content-Type: application/octet-stream;
 	x-unix-mode=0644;
 	name="t_sem-run-sem_unlink-in-cleanup-routine.patch"
 Content-Transfer-Encoding: 7bit
 
 Index: lib/librt/t_sem.c
 ===================================================================
 RCS file: /cvsroot/src/tests/lib/librt/t_sem.c,v
 retrieving revision 1.2
 diff -u -r1.2 t_sem.c
 --- lib/librt/t_sem.c	8 Nov 2010 13:05:49 -0000	1.2
 +++ lib/librt/t_sem.c	14 Jan 2017 07:05:38 -0000
 @@ -72,7 +72,7 @@
  
  #define NCHILDREN 10
  
 -ATF_TC(basic);
 +ATF_TC_WITH_CLEANUP(basic);
  ATF_TC_HEAD(basic, tc)
  {
  	atf_tc_set_md_var(tc, "descr", "Checks basic functionality of POSIX "
 @@ -108,8 +108,12 @@
  	ATF_REQUIRE_EQ(sem_close(sem_b), 0);
  	ATF_REQUIRE_EQ(sem_unlink("/sem_b"), 0);
  }
 +ATF_TC_CLEANUP(basic, tc)
 +{
 +	(void)sem_unlink("/sem_b");
 +}
  
 -ATF_TC(child);
 +ATF_TC_WITH_CLEANUP(child);
  ATF_TC_HEAD(child, tc)
  {
  	atf_tc_set_md_var(tc, "descr", "Checks using semaphores to synchronize "
 @@ -124,7 +128,7 @@
  
  	pid_t pid;
  
 -	if (sysconf(_SC_SEMAPHORES) == -1)         
 +	if (sysconf(_SC_SEMAPHORES) == -1)
  		atf_tc_skip("POSIX semaphores not supported");
  
  	sem_a = sem_open("/sem_a", O_CREAT | O_EXCL, 0644, 0);
 @@ -164,6 +168,10 @@
  	ATF_REQUIRE_EQ(sem_close(sem_a), 0);
  	ATF_REQUIRE_EQ(sem_unlink("/sem_a"), 0);
  }
 +ATF_TC_CLEANUP(child, tc)
 +{
 +	(void)sem_unlink("/sem_a");
 +}
  
  ATF_TP_ADD_TCS(tp)
  {
 
 --Apple-Mail=_AAE4D6DB-321E-4849-B5A5-6CC5B50101E7--
 


Home | Main Index | Thread Index | Old Index