test RUMPHIJACK fdoff=8

This commit is contained in:
pooka 2011-03-14 15:56:40 +00:00
parent fd67cc6416
commit 3bc8d7931c
4 changed files with 74 additions and 3 deletions

View File

@ -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

View File

@ -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

View File

@ -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 @@ main(int argc, char *argv[])
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;
}

View File

@ -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
}