Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/librumphijack add test for fix in rev 1.36 of libr...
details: https://anonhg.NetBSD.org/src/rev/bd2b784d4aa4
branches: trunk
changeset: 761941:bd2b784d4aa4
user: pooka <pooka%NetBSD.org@localhost>
date: Fri Feb 11 15:38:14 2011 +0000
description:
add test for fix in rev 1.36 of librumphijack/hijack.c
diffstat:
tests/lib/librumphijack/Makefile | 8 ++-
tests/lib/librumphijack/h_client.c | 71 ++++++++++++++++++++++++++++++++++++
tests/lib/librumphijack/t_asyncio.sh | 53 ++++++++++++++++++++++++++
3 files changed, 129 insertions(+), 3 deletions(-)
diffs (153 lines):
diff -r a39b560318e9 -r bd2b784d4aa4 tests/lib/librumphijack/Makefile
--- a/tests/lib/librumphijack/Makefile Fri Feb 11 14:02:12 2011 +0000
+++ b/tests/lib/librumphijack/Makefile Fri Feb 11 15:38:14 2011 +0000
@@ -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}
diff -r a39b560318e9 -r bd2b784d4aa4 tests/lib/librumphijack/h_client.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/librumphijack/h_client.c Fri Feb 11 15:38:14 2011 +0000
@@ -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;
+ }
+}
diff -r a39b560318e9 -r bd2b784d4aa4 tests/lib/librumphijack/t_asyncio.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/librumphijack/t_asyncio.sh Fri Feb 11 15:38:14 2011 +0000
@@ -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
+}
Home |
Main Index |
Thread Index |
Old Index