Module Name: src Committed By: pooka Date: Mon Mar 14 15:56:41 UTC 2011
Modified Files: src/tests/lib/librumphijack: h_client.c Added Files: src/tests/lib/librumphijack: t_config.sh Log Message: test RUMPHIJACK fdoff=8 To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/lib/librumphijack/h_client.c cvs rdiff -u -r0 -r1.1 src/tests/lib/librumphijack/t_config.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/lib/librumphijack/h_client.c diff -u src/tests/lib/librumphijack/h_client.c:1.5 src/tests/lib/librumphijack/h_client.c:1.6 --- src/tests/lib/librumphijack/h_client.c:1.5 Tue Mar 8 14:53:03 2011 +++ src/tests/lib/librumphijack/h_client.c Mon Mar 14 15:56:40 2011 @@ -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; } Added files: Index: src/tests/lib/librumphijack/t_config.sh diff -u /dev/null src/tests/lib/librumphijack/t_config.sh:1.1 --- /dev/null Mon Mar 14 15:56:41 2011 +++ src/tests/lib/librumphijack/t_config.sh Mon Mar 14 15:56:40 2011 @@ -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 +}