Source-Changes-HG archive

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

[src/trunk]: src/tests/lib/libc/sys add a signopipe test



details:   https://anonhg.NetBSD.org/src/rev/d330a29a4d43
branches:  trunk
changeset: 773108:d330a29a4d43
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Jan 28 02:47:09 2012 +0000

description:
add a signopipe test

diffstat:

 tests/lib/libc/sys/t_pipe2.c |  26 +++++++++++++++++++++++---
 1 files changed, 23 insertions(+), 3 deletions(-)

diffs (68 lines):

diff -r 3147b2e9b4c1 -r d330a29a4d43 tests/lib/libc/sys/t_pipe2.c
--- a/tests/lib/libc/sys/t_pipe2.c      Sat Jan 28 02:35:46 2012 +0000
+++ b/tests/lib/libc/sys/t_pipe2.c      Sat Jan 28 02:47:09 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_pipe2.c,v 1.2 2011/10/31 21:30:16 christos Exp $ */
+/* $NetBSD: t_pipe2.c,v 1.3 2012/01/28 02:47:09 christos Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_pipe2.c,v 1.2 2011/10/31 21:30:16 christos Exp $");
+__RCSID("$NetBSD: t_pipe2.c,v 1.3 2012/01/28 02:47:09 christos Exp $");
 
 #include <atf-c.h>
 #include <fcntl.h>
@@ -75,6 +75,14 @@
                ATF_REQUIRE((fcntl(fd[1], F_GETFL) & O_NONBLOCK) == 0);
        }
 
+       if (flags & O_NOSIGPIPE) {
+               ATF_REQUIRE(fcntl(fd[0], F_GETNOSIGPIPE) != 0);
+               ATF_REQUIRE(fcntl(fd[1], F_GETNOSIGPIPE) != 0);
+       } else {
+               ATF_REQUIRE(fcntl(fd[0], F_GETNOSIGPIPE) == 0);
+               ATF_REQUIRE(fcntl(fd[1], F_GETNOSIGPIPE) == 0);
+       }
+
        ATF_REQUIRE(close(fd[0]) != -1);
        ATF_REQUIRE(close(fd[1]) != -1);
 }
@@ -104,7 +112,7 @@
 ATF_TC(pipe2_cloexec);
 ATF_TC_HEAD(pipe2_cloexec, tc)
 {
-       atf_tc_set_md_var(tc, "descr", "A close-on-exec of pipe2(2)");
+       atf_tc_set_md_var(tc, "descr", "A close-on-exec test of pipe2(2)");
 }
 
 ATF_TC_BODY(pipe2_cloexec, tc)
@@ -112,6 +120,17 @@
        run(O_CLOEXEC);
 }
 
+ATF_TC(pipe2_nosigpipe);
+ATF_TC_HEAD(pipe2_nosigpipe, tc)
+{
+       atf_tc_set_md_var(tc, "descr", "A no sigpipe test of pipe2(2)");
+}
+
+ATF_TC_BODY(pipe2_nosigpipe, tc)
+{
+       run(O_NOSIGPIPE);
+}
+
 ATF_TC(pipe2_einval);
 ATF_TC_HEAD(pipe2_einval, tc)
 {
@@ -130,6 +149,7 @@
        ATF_TP_ADD_TC(tp, pipe2_basic);
        ATF_TP_ADD_TC(tp, pipe2_nonblock);
        ATF_TP_ADD_TC(tp, pipe2_cloexec);
+       ATF_TP_ADD_TC(tp, pipe2_nosigpipe);
        ATF_TP_ADD_TC(tp, pipe2_einval);
 
        return atf_no_error();



Home | Main Index | Thread Index | Old Index