Module Name:    src
Committed By:   pooka
Date:           Fri Feb 11 15:38:14 UTC 2011

Modified Files:
        src/tests/lib/librumphijack: Makefile
Added Files:
        src/tests/lib/librumphijack: h_client.c t_asyncio.sh

Log Message:
add test for fix in rev 1.36 of librumphijack/hijack.c


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/librumphijack/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/librumphijack/h_client.c \
    src/tests/lib/librumphijack/t_asyncio.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/Makefile
diff -u src/tests/lib/librumphijack/Makefile:1.1 src/tests/lib/librumphijack/Makefile:1.2
--- src/tests/lib/librumphijack/Makefile:1.1	Sun Feb  6 18:44:29 2011
+++ src/tests/lib/librumphijack/Makefile	Fri Feb 11 15:38:14 2011
@@ -1,12 +1,14 @@
-#	$NetBSD: Makefile,v 1.1 2011/02/06 18:44:29 pooka Exp $
+#	$NetBSD: Makefile,v 1.2 2011/02/11 15:38:14 pooka Exp $
 #
 
 .include <bsd.own.mk>
 
 TESTSDIR=	${TESTSBASE}/lib/librumphijack
 
-TESTS_SH=	t_tcpip
-TESTS_C=	h_netget
+TESTS_SH=	t_asyncio
+TESTS_SH+=	t_tcpip
+TESTS_C=	h_client
+TESTS_C+=	h_netget
 
 FILES=		netstat.expout index.html
 FILESDIR=	${TESTSDIR}

Added files:

Index: src/tests/lib/librumphijack/h_client.c
diff -u /dev/null src/tests/lib/librumphijack/h_client.c:1.1
--- /dev/null	Fri Feb 11 15:38:14 2011
+++ src/tests/lib/librumphijack/h_client.c	Fri Feb 11 15:38:14 2011
@@ -0,0 +1,71 @@
+/*	$NetBSD: h_client.c,v 1.1 2011/02/11 15:38:14 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.
+ */
+
+#include <sys/types.h>
+#include <sys/select.h>
+
+#include <err.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+int
+main(int argc, char *argv[])
+{
+
+	if (argc != 2) {
+		errx(1, "need testname as param");
+	}
+
+	if (strcmp(argv[1], "select_timeout") == 0) {
+		fd_set rfds;
+		struct timeval tv;
+		int rv;
+
+		tv.tv_sec = 0;
+		tv.tv_usec = 1;
+
+		FD_ZERO(&rfds);
+		FD_SET(STDIN_FILENO, &rfds);
+
+		rv = select(STDIN_FILENO+1, &rfds, NULL, NULL, &tv);
+		if (rv == -1)
+			err(1, "select");
+		if (rv != 0)
+			errx(1, "select succesful");
+
+		if (FD_ISSET(STDIN_FILENO, &rfds))
+			errx(1, "stdin fileno is still set");
+		exit(0);
+	} else {
+		return ENOTSUP;
+	}
+}
Index: src/tests/lib/librumphijack/t_asyncio.sh
diff -u /dev/null src/tests/lib/librumphijack/t_asyncio.sh:1.1
--- /dev/null	Fri Feb 11 15:38:14 2011
+++ src/tests/lib/librumphijack/t_asyncio.sh	Fri Feb 11 15:38:14 2011
@@ -0,0 +1,53 @@
+#       $NetBSD: t_asyncio.sh,v 1.1 2011/02/11 15:38:14 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'
+export RUMP_SERVER=unix://csock
+
+atf_test_case select_timeout cleanup
+select_timeout_head()
+{
+        atf_set "descr" "select() with timeout returns no fds set"
+}
+
+select_timeout_body()
+{
+
+	atf_check -s exit:0 ${rumpsrv} ${RUMP_SERVER}
+	atf_check -s exit:0 env LD_PRELOAD=/usr/lib/librumphijack.so \
+	    $(atf_get_srcdir)/h_client select_timeout
+}
+
+select_timeout_cleanup()
+{
+	rump.halt
+}
+
+atf_init_test_cases()
+{
+	atf_add_test_case select_timeout
+}

Reply via email to