Source-Changes-HG archive

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

[src/trunk]: src/tests/lib/librt PR/51872: Ngie Cooper: call sem_unlink after...



details:   https://anonhg.NetBSD.org/src/rev/6725cd50a78a
branches:  trunk
changeset: 350628:6725cd50a78a
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Jan 14 20:58:20 2017 +0000

description:
PR/51872: Ngie Cooper: call sem_unlink after :basic and :child

diffstat:

 tests/lib/librt/t_sem.c |  18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diffs (61 lines):

diff -r 162458ffc95b -r 6725cd50a78a tests/lib/librt/t_sem.c
--- a/tests/lib/librt/t_sem.c   Sat Jan 14 20:57:24 2017 +0000
+++ b/tests/lib/librt/t_sem.c   Sat Jan 14 20:58:20 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_sem.c,v 1.2 2010/11/08 13:05:49 njoly Exp $ */
+/* $NetBSD: t_sem.c,v 1.3 2017/01/14 20:58:20 christos Exp $ */
 
 /*
  * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
 #include <sys/cdefs.h>
 __COPYRIGHT("@(#) Copyright (c) 2008, 2010\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_sem.c,v 1.2 2010/11/08 13:05:49 njoly Exp $");
+__RCSID("$NetBSD: t_sem.c,v 1.3 2017/01/14 20:58:20 christos Exp $");
 
 #include <sys/wait.h>
 
@@ -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)
 {



Home | Main Index | Thread Index | Old Index