Source-Changes-HG archive

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

[src/trunk]: src test RUMPHIJACK fdoff=8



details:   https://anonhg.NetBSD.org/src/rev/b330fc028b78
branches:  trunk
changeset: 763237:b330fc028b78
user:      pooka <pooka%NetBSD.org@localhost>
date:      Mon Mar 14 15:56:40 2011 +0000

description:
test RUMPHIJACK fdoff=8

diffstat:

 distrib/sets/lists/tests/mi         |   3 +-
 tests/lib/librumphijack/Makefile    |   3 +-
 tests/lib/librumphijack/h_client.c  |  17 ++++++++++-
 tests/lib/librumphijack/t_config.sh |  54 +++++++++++++++++++++++++++++++++++++
 4 files changed, 74 insertions(+), 3 deletions(-)

diffs (123 lines):

diff -r 4a0d4e94e838 -r b330fc028b78 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Mon Mar 14 15:50:36 2011 +0000
+++ b/distrib/sets/lists/tests/mi       Mon Mar 14 15:56:40 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.270 2011/03/12 14:03:38 bouyer Exp $
+# $NetBSD: mi,v 1.271 2011/03/14 15:57:33 pooka Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -1964,6 +1964,7 @@
 ./usr/tests/lib/librumphijack/index.html                       tests-lib-tests         atf
 ./usr/tests/lib/librumphijack/netstat.expout                   tests-lib-tests         atf
 ./usr/tests/lib/librumphijack/t_asyncio                        tests-lib-tests         atf
+./usr/tests/lib/librumphijack/t_config                 tests-lib-tests         atf
 ./usr/tests/lib/librumphijack/t_cwd                    tests-lib-tests         atf
 ./usr/tests/lib/librumphijack/t_sh                     tests-lib-tests         atf
 ./usr/tests/lib/librumphijack/t_tcpip                  tests-lib-tests         atf
diff -r 4a0d4e94e838 -r b330fc028b78 tests/lib/librumphijack/Makefile
--- a/tests/lib/librumphijack/Makefile  Mon Mar 14 15:50:36 2011 +0000
+++ b/tests/lib/librumphijack/Makefile  Mon Mar 14 15:56:40 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.6 2011/03/03 11:54:11 pooka Exp $
+#      $NetBSD: Makefile,v 1.7 2011/03/14 15:57:23 pooka Exp $
 #
 
 .include <bsd.own.mk>
@@ -6,6 +6,7 @@
 TESTSDIR=      ${TESTSBASE}/lib/librumphijack
 
 TESTS_SH=      t_asyncio
+TESTS_SH+=     t_config
 TESTS_SH+=     t_cwd
 TESTS_SH+=     t_sh
 TESTS_SH+=     t_tcpip
diff -r 4a0d4e94e838 -r b330fc028b78 tests/lib/librumphijack/h_client.c
--- a/tests/lib/librumphijack/h_client.c        Mon Mar 14 15:50:36 2011 +0000
+++ b/tests/lib/librumphijack/h_client.c        Mon Mar 14 15:56:40 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: h_client.c,v 1.5 2011/03/08 14:53:03 pooka Exp $       */
+/*     $NetBSD: h_client.c,v 1.6 2011/03/14 15:56:40 pooka Exp $       */
 
 /*
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -113,6 +113,21 @@
                        errx(1, "poll unexpected revents");
 
                exit(0);
+       } else if (strcmp(argv[1], "fdoff8") == 0) {
+               int fd;
+
+               do
+                       if ((fd = open("/dev/null", O_RDWR)) == -1)
+                               err(1, "open1");
+               while (fd < 7);
+               fd = open("/dev/null", O_RDWR);
+               if (fd != -1 || errno != ENFILE)
+                       errx(1, "unexpected fd8 %d %d", fd, errno);
+               if (fcntl(0, F_MAXFD) != 7)
+                       errx(1, "fd leak?");
+               if ((fd = open("/rump/dev/null", O_RDWR)) != 8)
+                       errx(1, "rump open %d %d", fd, errno);
+               exit(0);
        } else {
                return ENOTSUP;
        }
diff -r 4a0d4e94e838 -r b330fc028b78 tests/lib/librumphijack/t_config.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/librumphijack/t_config.sh       Mon Mar 14 15:56:40 2011 +0000
@@ -0,0 +1,54 @@
+#       $NetBSD: t_config.sh,v 1.1 2011/03/14 15:56:40 pooka Exp $
+#
+# Copyright (c) 2011 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+rumpsrv='rump_server -lrumpvfs'
+export RUMP_SERVER=unix://csock
+
+atf_test_case fdoff cleanup
+fdoff_head()
+{
+        atf_set "descr" "RUMPHIJACK fdoff=8"
+}
+
+fdoff_body()
+{
+
+       atf_check -s exit:0 rump_server -lrumpvfs ${RUMP_SERVER}
+       export RUMPHIJACK=path=/rump,fdoff=8
+       atf_check -s exit:0 env LD_PRELOAD=/usr/lib/librumphijack.so \
+           $(atf_get_srcdir)/h_client fdoff8
+}
+
+fdoff_cleanup()
+{
+       rump.halt
+}
+
+atf_init_test_cases()
+{
+       atf_add_test_case fdoff
+}



Home | Main Index | Thread Index | Old Index