CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: christos Date: Sat Aug 13 11:22:11 UTC 2016 Modified Files: src/tests/lib/librumphijack: t_tcpip.sh Log Message: order netinet6 properly. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/tests/lib/librumphijack/t_tcpip.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/t_tcpip.sh diff -u src/tests/lib/librumphijack/t_tcpip.sh:1.17 src/tests/lib/librumphijack/t_tcpip.sh:1.18 --- src/tests/lib/librumphijack/t_tcpip.sh:1.17 Thu Aug 11 17:29:44 2016 +++ src/tests/lib/librumphijack/t_tcpip.sh Sat Aug 13 07:22:11 2016 @@ -1,4 +1,4 @@ -# $NetBSD: t_tcpip.sh,v 1.17 2016/08/11 21:29:44 kre Exp $ +# $NetBSD: t_tcpip.sh,v 1.18 2016/08/13 11:22:11 christos Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,7 +25,8 @@ # POSSIBILITY OF SUCH DAMAGE. # -rumpnetsrv='rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpdev' +rumpnetlibs="-lrumpnet -lrumpnet_net -lrumpnet_netinet6 -lrumpnet_netinet" +rumpnetsrv="rump_server $rumpnetlibs -lrumpdev" export RUMP_SERVER=unix://csock atf_test_case http cleanup @@ -37,7 +38,7 @@ http_head() http_body() { - atf_check -s exit:0 ${rumpnetsrv} -lrumpnet_netinet6 ${RUMP_SERVER} + atf_check -s exit:0 ${rumpnetsrv} ${RUMP_SERVER} # start bozo in daemon mode atf_check -s exit:0 env LD_PRELOAD=/usr/lib/librumphijack.so \
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: kre Date: Thu Aug 11 21:29:44 UTC 2016 Modified Files: src/tests/lib/librumphijack: t_tcpip.sh Log Message: One more -lrumpdev To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/tests/lib/librumphijack/t_tcpip.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/t_tcpip.sh diff -u src/tests/lib/librumphijack/t_tcpip.sh:1.16 src/tests/lib/librumphijack/t_tcpip.sh:1.17 --- src/tests/lib/librumphijack/t_tcpip.sh:1.16 Tue Dec 29 07:17:19 2015 +++ src/tests/lib/librumphijack/t_tcpip.sh Thu Aug 11 21:29:44 2016 @@ -1,4 +1,4 @@ -# $NetBSD: t_tcpip.sh,v 1.16 2015/12/29 07:17:19 pgoyette Exp $ +# $NetBSD: t_tcpip.sh,v 1.17 2016/08/11 21:29:44 kre Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,7 +25,7 @@ # POSSIBILITY OF SUCH DAMAGE. # -rumpnetsrv='rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet' +rumpnetsrv='rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpdev' export RUMP_SERVER=unix://csock atf_test_case http cleanup @@ -205,7 +205,7 @@ test_nfs() unset LD_PRELOAD # at least the kernel server is easier - atf_check -s exit:0 rump_server -lrumpvfs -lrumpnet \ + atf_check -s exit:0 rump_server -lrumpvfs -lrumpnet -lrumpdev \ -lrumpnet_net -lrumpnet_netinet -lrumpnet_shmif -lrumpfs_nfs\ ${RUMP_SERVER} @@ -232,7 +232,7 @@ nfs_head() nfs_body() { test_nfs -lrumpvfs -lrumpdev -lrumpnet -lrumpnet_net \ - -lrumpnet_netinet -lrumpnet_local -lrumpnet_shmif \ + -lrumpnet_netinet -lrumpnet_local -lrumpnet_shmif -lrumpdev \ -lrumpdev_disk -lrumpfs_ffs -lrumpfs_nfs -lrumpfs_nfsserver \ -d key=/dk,hostpath=ffs.img,size=host } @@ -254,7 +254,7 @@ nfs_autoload_body() { [ `uname -m` = "i386" ] || atf_skip "test currently valid only on i386" test_nfs -lrumpvfs -lrumpdev -lrumpnet -lrumpnet_net \ - -lrumpnet_netinet -lrumpnet_local -lrumpnet_shmif \ + -lrumpnet_netinet -lrumpnet_local -lrumpnet_shmif -lrumpdev \ -lrumpdev_disk -d key=/dk,hostpath=ffs.img,size=host }
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: pgoyette Date: Tue Dec 29 07:17:19 UTC 2015 Modified Files: src/tests/lib/librumphijack: t_tcpip.sh Log Message: Since we're expecting to autoload modules here, make sure that the kernel (or rump-server) has autoload enabled. This should finish fixing PR bin/49153 XXX The test still does not run successfully, due to another bug that XXX was recently introduced. This second bug is being worked on. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/tests/lib/librumphijack/t_tcpip.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/t_tcpip.sh diff -u src/tests/lib/librumphijack/t_tcpip.sh:1.15 src/tests/lib/librumphijack/t_tcpip.sh:1.16 --- src/tests/lib/librumphijack/t_tcpip.sh:1.15 Wed Aug 26 09:19:20 2015 +++ src/tests/lib/librumphijack/t_tcpip.sh Tue Dec 29 07:17:19 2015 @@ -1,4 +1,4 @@ -# $NetBSD: t_tcpip.sh,v 1.15 2015/08/26 09:19:20 martin Exp $ +# $NetBSD: t_tcpip.sh,v 1.16 2015/12/29 07:17:19 pgoyette Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -179,6 +179,8 @@ test_nfs() 'echo "/export -noresvport -noresvmnt 10.1.1.100" | \ dd of=/rump/etc/exports 2> /dev/null' + atf_check -s exit:0 rump.sysctl -q -w kern.module.autoload=1 + atf_check -s exit:0 -e ignore mount_ffs /dk /rump/export atf_check -s exit:0 -x "echo ${magicstr} > /rump/export/im_alive"
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: martin Date: Wed Aug 26 09:19:20 UTC 2015 Modified Files: src/tests/lib/librumphijack: t_tcpip.sh Log Message: Mark the ssh test as expected failure pointing to PR lib/50174 To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/tests/lib/librumphijack/t_tcpip.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/t_tcpip.sh diff -u src/tests/lib/librumphijack/t_tcpip.sh:1.14 src/tests/lib/librumphijack/t_tcpip.sh:1.15 --- src/tests/lib/librumphijack/t_tcpip.sh:1.14 Thu Oct 9 06:52:37 2014 +++ src/tests/lib/librumphijack/t_tcpip.sh Wed Aug 26 09:19:20 2015 @@ -1,4 +1,4 @@ -# $NetBSD: t_tcpip.sh,v 1.14 2014/10/09 06:52:37 apb Exp $ +# $NetBSD: t_tcpip.sh,v 1.15 2015/08/26 09:19:20 martin Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -122,6 +122,7 @@ ssh_head() ssh_body() { + atf_expect_fail PR lib/50174 atf_check -s exit:0 ${rumpnetsrv} ${RUMP_SERVER} # make sure clients die after we nuke the server
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: apb Date: Thu Oct 9 06:52:37 UTC 2014 Modified Files: src/tests/lib/librumphijack: t_tcpip.sh Log Message: Avoid literal CR in sed regular expression. Instead, use printf(1) to save the regexp in a shell variable, taking advantage of the fact that printf understands \r. This should fix a complaint from subversion, reported in PR 49249. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/tests/lib/librumphijack/t_tcpip.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/t_tcpip.sh diff -u src/tests/lib/librumphijack/t_tcpip.sh:1.13 src/tests/lib/librumphijack/t_tcpip.sh:1.14 --- src/tests/lib/librumphijack/t_tcpip.sh:1.13 Fri Jan 3 13:18:00 2014 +++ src/tests/lib/librumphijack/t_tcpip.sh Thu Oct 9 06:52:37 2014 @@ -1,4 +1,4 @@ -# $NetBSD: t_tcpip.sh,v 1.13 2014/01/03 13:18:00 pooka Exp $ +# $NetBSD: t_tcpip.sh,v 1.14 2014/10/09 06:52:37 apb Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -53,8 +53,9 @@ http_body() # check that we got what we wanted atf_check -o match:'HTTP/1.0 200 OK' cat webfile atf_check -o match:'Content-Length: 95' cat webfile + blank_line_re=$(printf '^\r$') # matches a line with only CRLF atf_check -o file:$(atf_get_srcdir)/index.html \ - sed -n '1,/^$/!p' webfile + sed -n 1,/${blank_line_re}/!p webfile } http_cleanup()
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: gson Date: Wed Aug 27 13:32:16 UTC 2014 Modified Files: src/tests/lib/librumphijack: t_asyncio.sh Log Message: The 4 second timeout of the invafd test case is not always enough when running under qemu; increase it to 10 seconds. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 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/t_asyncio.sh diff -u src/tests/lib/librumphijack/t_asyncio.sh:1.3 src/tests/lib/librumphijack/t_asyncio.sh:1.4 --- src/tests/lib/librumphijack/t_asyncio.sh:1.3 Sun Feb 20 23:45:46 2011 +++ src/tests/lib/librumphijack/t_asyncio.sh Wed Aug 27 13:32:16 2014 @@ -1,4 +1,4 @@ -# $NetBSD: t_asyncio.sh,v 1.3 2011/02/20 23:45:46 pooka Exp $ +# $NetBSD: t_asyncio.sh,v 1.4 2014/08/27 13:32:16 gson Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -70,7 +70,7 @@ atf_test_case invafd cleanup invafd_head() { atf_set descr poll on invalid rump fd - atf_set timeout 4 + atf_set timeout 10 } invafd_body()
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: pooka Date: Fri Jan 3 13:18:00 UTC 2014 Modified Files: src/tests/lib/librumphijack: t_tcpip.sh Log Message: netstat expected output includes ipv6 sucket, so add netinet6 To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/tests/lib/librumphijack/t_tcpip.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/t_tcpip.sh diff -u src/tests/lib/librumphijack/t_tcpip.sh:1.12 src/tests/lib/librumphijack/t_tcpip.sh:1.13 --- src/tests/lib/librumphijack/t_tcpip.sh:1.12 Thu Aug 16 12:57:24 2012 +++ src/tests/lib/librumphijack/t_tcpip.sh Fri Jan 3 13:18:00 2014 @@ -1,4 +1,4 @@ -# $NetBSD: t_tcpip.sh,v 1.12 2012/08/16 12:57:24 pgoyette Exp $ +# $NetBSD: t_tcpip.sh,v 1.13 2014/01/03 13:18:00 pooka Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -37,7 +37,7 @@ http_head() http_body() { - atf_check -s exit:0 ${rumpnetsrv} ${RUMP_SERVER} + atf_check -s exit:0 ${rumpnetsrv} -lrumpnet_netinet6 ${RUMP_SERVER} # start bozo in daemon mode atf_check -s exit:0 env LD_PRELOAD=/usr/lib/librumphijack.so \
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: pgoyette Date: Thu Aug 16 12:57:25 UTC 2012 Modified Files: src/tests/lib/librumphijack: t_tcpip.sh Log Message: Fix more fallout from the changes to nfsd's command-line options To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/tests/lib/librumphijack/t_tcpip.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/t_tcpip.sh diff -u src/tests/lib/librumphijack/t_tcpip.sh:1.11 src/tests/lib/librumphijack/t_tcpip.sh:1.12 --- src/tests/lib/librumphijack/t_tcpip.sh:1.11 Sat May 14 17:42:28 2011 +++ src/tests/lib/librumphijack/t_tcpip.sh Thu Aug 16 12:57:24 2012 @@ -1,4 +1,4 @@ -# $NetBSD: t_tcpip.sh,v 1.11 2011/05/14 17:42:28 jmmv Exp $ +# $NetBSD: t_tcpip.sh,v 1.12 2012/08/16 12:57:24 pgoyette Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -190,7 +190,7 @@ test_nfs() # finally, le nfschuck export RUMPHIJACK='blanket=/var/run,socket=all,vfs=all' - atf_check -s exit:0 nfsd -tu + atf_check -s exit:0 nfsd # # now, time for the client server and associated madness.
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: jruoho Date: Fri Apr 20 05:15:11 UTC 2012 Modified Files: src/tests/lib/librumphijack: h_client.c Log Message: Close all file descriptors before trying to reason about the number of open descriptors. Should fix the test failures reported on current users. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/tests/lib/librumphijack/h_client.c 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.7 src/tests/lib/librumphijack/h_client.c:1.8 --- src/tests/lib/librumphijack/h_client.c:1.7 Tue Apr 17 09:23:21 2012 +++ src/tests/lib/librumphijack/h_client.c Fri Apr 20 05:15:11 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: h_client.c,v 1.7 2012/04/17 09:23:21 jruoho Exp $ */ +/* $NetBSD: h_client.c,v 1.8 2012/04/20 05:15:11 jruoho Exp $ */ /* * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -115,12 +115,15 @@ main(int argc, char *argv[]) return EXIT_SUCCESS; } else if (strcmp(argv[1], fdoff8) == 0) { + + (void)closefrom(0); + int fd; - do + do { if ((fd = open(/dev/null, O_RDWR)) == -1) err(EXIT_FAILURE, open1); - while (fd 7); + } while (fd 7); fd = open(/dev/null, O_RDWR); if (fd != -1 || errno != ENFILE) errx(EXIT_FAILURE, unexpected fd8 %d %d, fd, errno);
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: jruoho Date: Tue Apr 17 09:23:21 UTC 2012 Modified Files: src/tests/lib/librumphijack: h_client.c h_cwd.c h_netget.c Log Message: Return from main() and use EXIT_FAILURE/EXIT_SUCCESS from stdlib(3). To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/lib/librumphijack/h_client.c cvs rdiff -u -r1.2 -r1.3 src/tests/lib/librumphijack/h_cwd.c cvs rdiff -u -r1.1 -r1.2 src/tests/lib/librumphijack/h_netget.c 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.6 src/tests/lib/librumphijack/h_client.c:1.7 --- src/tests/lib/librumphijack/h_client.c:1.6 Mon Mar 14 15:56:40 2011 +++ src/tests/lib/librumphijack/h_client.c Tue Apr 17 09:23:21 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: h_client.c,v 1.6 2011/03/14 15:56:40 pooka Exp $ */ +/* $NetBSD: h_client.c,v 1.7 2012/04/17 09:23:21 jruoho Exp $ */ /* * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -57,19 +57,19 @@ main(int argc, char *argv[]) tv.tv_usec = 1; if (pipe(pipefd) == -1) - err(1, pipe); + err(EXIT_FAILURE, pipe); FD_ZERO(rfds); FD_SET(pipefd[0], rfds); rv = select(pipefd[0]+1, rfds, NULL, NULL, tv); if (rv == -1) - err(1, select); + err(EXIT_FAILURE, select); if (rv != 0) - errx(1, select succesful); + errx(EXIT_FAILURE, select succesful); if (FD_ISSET(pipefd[0], rfds)) - errx(1, stdin fileno is still set); - exit(0); + errx(EXIT_FAILURE, stdin fileno is still set); + return EXIT_SUCCESS; } else if (strcmp(argv[1], select_allunset) == 0) { fd_set fds; struct timeval tv; @@ -82,24 +82,24 @@ main(int argc, char *argv[]) rv = select(100, fds, fds, fds, tv); if (rv == -1) - err(1, select); + err(EXIT_FAILURE, select); if (rv != 0) - errx(1, select succesful); + errx(EXIT_FAILURE, select succesful); rv = select(0, NULL, NULL, NULL, tv); if (rv == -1) - err(1, select2); + err(EXIT_FAILURE, select2); if (rv != 0) - errx(1, select2 succesful); + errx(EXIT_FAILURE, select2 succesful); - exit(0); + return EXIT_SUCCESS; } else if (strcmp(argv[1], invafd) == 0) { struct pollfd pfd[2]; int fd, rv; fd = open(/rump/dev/null, O_RDWR); if (fd == -1) - err(1, open); + err(EXIT_FAILURE, open); close(fd); pfd[0].fd = STDIN_FILENO; @@ -108,26 +108,27 @@ main(int argc, char *argv[]) pfd[1].events = POLLIN; if ((rv = poll(pfd, 2, INFTIM)) != 1) - errx(1, poll unexpected rv %d (%d), rv, errno); + errx(EXIT_FAILURE, poll unexpected rv %d (%d), + rv, errno); if (pfd[1].revents != POLLNVAL || pfd[0].revents != 0) - errx(1, poll unexpected revents); + errx(EXIT_FAILURE, poll unexpected revents); - exit(0); + return EXIT_SUCCESS; } else if (strcmp(argv[1], fdoff8) == 0) { int fd; do if ((fd = open(/dev/null, O_RDWR)) == -1) -err(1, open1); +err(EXIT_FAILURE, open1); while (fd 7); fd = open(/dev/null, O_RDWR); if (fd != -1 || errno != ENFILE) - errx(1, unexpected fd8 %d %d, fd, errno); + errx(EXIT_FAILURE, unexpected fd8 %d %d, fd, errno); if (fcntl(0, F_MAXFD) != 7) - errx(1, fd leak?); + errx(EXIT_FAILURE, fd leak?); if ((fd = open(/rump/dev/null, O_RDWR)) != 8) - errx(1, rump open %d %d, fd, errno); - exit(0); + errx(EXIT_FAILURE, rump open %d %d, fd, errno); + return EXIT_SUCCESS; } else { return ENOTSUP; } Index: src/tests/lib/librumphijack/h_cwd.c diff -u src/tests/lib/librumphijack/h_cwd.c:1.2 src/tests/lib/librumphijack/h_cwd.c:1.3 --- src/tests/lib/librumphijack/h_cwd.c:1.2 Sat Feb 19 19:57:28 2011 +++ src/tests/lib/librumphijack/h_cwd.c Tue Apr 17 09:23:21 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: h_cwd.c,v 1.2 2011/02/19 19:57:28 pooka Exp $ */ +/* $NetBSD: h_cwd.c,v 1.3 2012/04/17 09:23:21 jruoho Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -33,6 +33,7 @@ #include err.h #include errno.h #include fcntl.h +#include stdlib.h #include string.h #include unistd.h @@ -58,7 +59,7 @@ dochdir(const char *path, const char *er { if (chdir(path) == -1) - err(1, %s, errmsg); + err(EXIT_FAILURE, %s, errmsg); } static void @@ -68,9 +69,9 @@ dofchdir(const char *path, const char *e fd = open(path, O_RDONLY); if (fd == -1) - err(1, open %s, errmsg); + err(EXIT_FAILURE, open %s, errmsg); if (fchdir(fd) == -1) - err(1, fchdir %s, errmsg); + err(EXIT_FAILURE, fchdir %s, errmsg); close(fd); } static void (*thechdir)(const char *, const char *); @@ -81,44 +82,44 @@ simple(void) thechdir(prefix, chdir1); if (getcwd(pwd, sizeof(pwd)) == NULL) - err(1, getcwd1); + err(EXIT_FAILURE, getcwd1); if (strcmp(pwd, prefix) != 0) - errx(1, strcmp1); + errx(EXIT_FAILURE, strcmp1); if (mkdir(dir, 0777) == -1) - err(1, mkdir2); + err(EXIT_FAILURE, mkdir2); thechdir(dir,
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: christos Date: Thu Dec 1 21:54:10 UTC 2011 Modified Files: src/tests/lib/librumphijack: t_vfs.sh Log Message: add missing dev_disk library for getdiskinfo. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/lib/librumphijack/t_vfs.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/t_vfs.sh diff -u src/tests/lib/librumphijack/t_vfs.sh:1.4 src/tests/lib/librumphijack/t_vfs.sh:1.5 --- src/tests/lib/librumphijack/t_vfs.sh:1.4 Tue Mar 8 17:21:52 2011 +++ src/tests/lib/librumphijack/t_vfs.sh Thu Dec 1 16:54:10 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_vfs.sh,v 1.4 2011/03/08 22:21:52 pooka Exp $ +# $NetBSD: t_vfs.sh,v 1.5 2011/12/01 21:54:10 christos Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -27,7 +27,7 @@ img=ffs.img rumpsrv_ffs=\ -rump_server -lrumpvfs -lrumpfs_ffs -d key=/img,hostpath=${img},size=host +rump_server -lrumpvfs -lrumpfs_ffs -lrumpdev_disk -d key=/img,hostpath=${img},size=host export RUMP_SERVER=unix://csock domount()
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: jmmv Date: Tue Mar 29 15:43:45 UTC 2011 Modified Files: src/tests/lib/librumphijack: t_tcpip.sh Log Message: Make httpd create a pid file and use that to kill the server in a controlled manner (instead of indirectly through rump.halt). Suggested by pooka@. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/tests/lib/librumphijack/t_tcpip.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/t_tcpip.sh diff -u src/tests/lib/librumphijack/t_tcpip.sh:1.8 src/tests/lib/librumphijack/t_tcpip.sh:1.9 --- src/tests/lib/librumphijack/t_tcpip.sh:1.8 Tue Mar 22 17:07:11 2011 +++ src/tests/lib/librumphijack/t_tcpip.sh Tue Mar 29 15:43:45 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_tcpip.sh,v 1.8 2011/03/22 17:07:11 pooka Exp $ +# $NetBSD: t_tcpip.sh,v 1.9 2011/03/29 15:43:45 jmmv Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -38,12 +38,10 @@ { atf_check -s exit:0 ${rumpnetsrv} ${RUMP_SERVER} - # make sure clients die after we nuke the server - export RUMPHIJACK_RETRYCONNECT='die' # start bozo in daemon mode atf_check -s exit:0 env LD_PRELOAD=/usr/lib/librumphijack.so \ - /usr/libexec/httpd -b -s $(atf_get_srcdir) + /usr/libexec/httpd -P ./httpd.pid -b -s $(atf_get_srcdir) atf_check -s exit:0 -o file:$(atf_get_srcdir)/netstat.expout \ rump.netstat -a @@ -62,6 +60,11 @@ http_cleanup() { rump.halt + + if [ -f httpd.pid ]; then + kill -9 $(cat httpd.pid) + rm -f httpd.pid + fi } #
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: jmmv Date: Tue Mar 29 16:03:32 UTC 2011 Modified Files: src/tests/lib/librumphijack: t_tcpip.sh Log Message: Halt the httpd server _before_ rump. Per pooka@'s suggestion. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/tests/lib/librumphijack/t_tcpip.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/t_tcpip.sh diff -u src/tests/lib/librumphijack/t_tcpip.sh:1.9 src/tests/lib/librumphijack/t_tcpip.sh:1.10 --- src/tests/lib/librumphijack/t_tcpip.sh:1.9 Tue Mar 29 15:43:45 2011 +++ src/tests/lib/librumphijack/t_tcpip.sh Tue Mar 29 16:03:32 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_tcpip.sh,v 1.9 2011/03/29 15:43:45 jmmv Exp $ +# $NetBSD: t_tcpip.sh,v 1.10 2011/03/29 16:03:32 jmmv Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -59,12 +59,12 @@ http_cleanup() { - rump.halt - if [ -f httpd.pid ]; then kill -9 $(cat httpd.pid) rm -f httpd.pid fi + + rump.halt } #
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: pooka Date: Tue Mar 22 17:07:11 UTC 2011 Modified Files: src/tests/lib/librumphijack: t_tcpip.sh Log Message: check that nfsd works with kernel module autoloading To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/tests/lib/librumphijack/t_tcpip.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/t_tcpip.sh diff -u src/tests/lib/librumphijack/t_tcpip.sh:1.7 src/tests/lib/librumphijack/t_tcpip.sh:1.8 --- src/tests/lib/librumphijack/t_tcpip.sh:1.7 Thu Mar 10 13:42:33 2011 +++ src/tests/lib/librumphijack/t_tcpip.sh Tue Mar 22 17:07:11 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_tcpip.sh,v 1.7 2011/03/10 13:42:33 pooka Exp $ +# $NetBSD: t_tcpip.sh,v 1.8 2011/03/22 17:07:11 pooka Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -146,14 +146,7 @@ # sshd dies due to RUMPHIJACK_RETRYCONNECT=1d6 } - -atf_test_case nfs cleanup -nfs_head() -{ -atf_set descr Test hijacked nfsd and mount_nfs -} - -nfs_body() +test_nfs() { magicstr='wind in my hair' @@ -162,11 +155,7 @@ # start nfs kernel server. this is a mouthful export RUMP_SERVER=unix://serversock - atf_check -s exit:0 rump_server -lrumpvfs -lrumpdev -lrumpnet \ - -lrumpnet_net -lrumpnet_netinet -lrumpnet_local \ - -lrumpnet_shmif -lrumpdev_disk -lrumpfs_ffs -lrumpfs_nfs \ - -lrumpfs_nfsserver \ - -d key=/dk,hostpath=ffs.img,size=host ${RUMP_SERVER} + atf_check -s exit:0 rump_server $* ${RUMP_SERVER} atf_check -s exit:0 rump.ifconfig shmif0 create atf_check -s exit:0 rump.ifconfig shmif0 linkstr shmbus @@ -223,20 +212,54 @@ atf_check -s exit:0 mount_nfs 10.1.1.1:/export /rump/mnt atf_check -s exit:0 -o inline:${magicstr}\n cat /rump/mnt/im_alive + atf_check -s exit:0 -o match:'.*im_alive$' ls -l /rump/mnt/im_alive } -nfs_cleanup() + +atf_test_case nfs cleanup +nfs_head() +{ +atf_set descr Test hijacked nfsd and mount_nfs +} + +nfs_body() { + test_nfs -lrumpvfs -lrumpdev -lrumpnet -lrumpnet_net \ + -lrumpnet_netinet -lrumpnet_local -lrumpnet_shmif \ + -lrumpdev_disk -lrumpfs_ffs -lrumpfs_nfs -lrumpfs_nfsserver \ + -d key=/dk,hostpath=ffs.img,size=host +} +nfs_cleanup() +{ RUMP_SERVER=unix://serversock rump.halt 2 /dev/null RUMP_SERVER=unix://clientsock rump.halt 2 /dev/null : } +atf_test_case nfs_autoload cleanup +nfs_autoload_head() +{ +atf_set descr Test hijacked nfsd with autoload from /stand +} + +nfs_autoload_body() +{ + [ `uname -m` = i386 ] || atf_skip test currently valid only on i386 + test_nfs -lrumpvfs -lrumpdev -lrumpnet -lrumpnet_net \ + -lrumpnet_netinet -lrumpnet_local -lrumpnet_shmif \ + -lrumpdev_disk -d key=/dk,hostpath=ffs.img,size=host +} + +nfs_autoload_cleanup() +{ + nfs_cleanup +} atf_init_test_cases() { atf_add_test_case http atf_add_test_case ssh atf_add_test_case nfs + atf_add_test_case nfs_autoload }
CVS commit: src/tests/lib/librumphijack
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 +}
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: pooka Date: Mon Mar 14 15:57:23 UTC 2011 Modified Files: src/tests/lib/librumphijack: Makefile Log Message: test RUMPHIJACK fdoff=8 To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/lib/librumphijack/Makefile 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.6 src/tests/lib/librumphijack/Makefile:1.7 --- src/tests/lib/librumphijack/Makefile:1.6 Thu Mar 3 11:54:11 2011 +++ src/tests/lib/librumphijack/Makefile Mon Mar 14 15:57:23 2011 @@ -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
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: pooka Date: Thu Mar 10 13:42:34 UTC 2011 Modified Files: src/tests/lib/librumphijack: t_tcpip.sh Log Message: * remove juiblex from nfsd startup (i was using -DDEBUG nfsd yesterday) * some minor nits To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/lib/librumphijack/t_tcpip.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/t_tcpip.sh diff -u src/tests/lib/librumphijack/t_tcpip.sh:1.6 src/tests/lib/librumphijack/t_tcpip.sh:1.7 --- src/tests/lib/librumphijack/t_tcpip.sh:1.6 Wed Mar 9 21:25:59 2011 +++ src/tests/lib/librumphijack/t_tcpip.sh Thu Mar 10 13:42:33 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_tcpip.sh,v 1.6 2011/03/09 21:25:59 pooka Exp $ +# $NetBSD: t_tcpip.sh,v 1.7 2011/03/10 13:42:33 pooka Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -198,10 +198,14 @@ # finally, le nfschuck export RUMPHIJACK='blanket=/var/run,socket=all,vfs=all' - atf_check -s exit:0 nfsd -tu + atf_check -s exit:0 nfsd -tu + # # now, time for the client server and associated madness. + # + export RUMP_SERVER=unix://clientsock + unset RUMPHIJACK unset LD_PRELOAD # at least the kernel server is easier @@ -214,7 +218,6 @@ atf_check -s exit:0 rump.ifconfig shmif0 inet 10.1.1.100 export LD_PRELOAD=/usr/lib/librumphijack.so - unset RUMPHIJACK atf_check -s exit:0 mkdir /rump/mnt atf_check -s exit:0 mount_nfs 10.1.1.1:/export /rump/mnt
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: pooka Date: Wed Mar 9 21:26:00 UTC 2011 Modified Files: src/tests/lib/librumphijack: t_tcpip.sh Log Message: nfsd + mount_nfs test with stock system binaries To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/lib/librumphijack/t_tcpip.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/t_tcpip.sh diff -u src/tests/lib/librumphijack/t_tcpip.sh:1.5 src/tests/lib/librumphijack/t_tcpip.sh:1.6 --- src/tests/lib/librumphijack/t_tcpip.sh:1.5 Wed Feb 16 19:31:31 2011 +++ src/tests/lib/librumphijack/t_tcpip.sh Wed Mar 9 21:25:59 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_tcpip.sh,v 1.5 2011/02/16 19:31:31 pooka Exp $ +# $NetBSD: t_tcpip.sh,v 1.6 2011/03/09 21:25:59 pooka Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -146,8 +146,94 @@ # sshd dies due to RUMPHIJACK_RETRYCONNECT=1d6 } + +atf_test_case nfs cleanup +nfs_head() +{ +atf_set descr Test hijacked nfsd and mount_nfs +} + +nfs_body() +{ + + magicstr='wind in my hair' + # create ffs file system we'll be serving from + atf_check -s exit:0 -o ignore newfs -F -s 1 ffs.img + + # start nfs kernel server. this is a mouthful + export RUMP_SERVER=unix://serversock + atf_check -s exit:0 rump_server -lrumpvfs -lrumpdev -lrumpnet \ + -lrumpnet_net -lrumpnet_netinet -lrumpnet_local \ + -lrumpnet_shmif -lrumpdev_disk -lrumpfs_ffs -lrumpfs_nfs \ + -lrumpfs_nfsserver \ + -d key=/dk,hostpath=ffs.img,size=host ${RUMP_SERVER} + + atf_check -s exit:0 rump.ifconfig shmif0 create + atf_check -s exit:0 rump.ifconfig shmif0 linkstr shmbus + atf_check -s exit:0 rump.ifconfig shmif0 inet 10.1.1.1 + + export RUMPHIJACK_RETRYCONNECT=die + export LD_PRELOAD=/usr/lib/librumphijack.so + + atf_check -s exit:0 mkdir -p /rump/var/run + atf_check -s exit:0 mkdir -p /rump/var/db + atf_check -s exit:0 touch /rump/var/db/mountdtab + atf_check -s exit:0 mkdir /rump/etc + atf_check -s exit:0 mkdir /rump/export + + atf_check -s exit:0 sh -c \ + 'echo /export -noresvport -noresvmnt 10.1.1.100 | \ + dd of=/rump/etc/exports 2 /dev/null' + + atf_check -s exit:0 -e ignore mount_ffs /dk /rump/export + atf_check -s exit:0 sh -c echo ${magicstr} /rump/export/im_alive + + # start rpcbind. we want /var/run/rpcbind.sock + export RUMPHIJACK='blanket=/var/run,socket=all' + atf_check -s exit:0 rpcbind + + # ok, then we want mountd in the similar fashion + export RUMPHIJACK='blanket=/var/run:/var/db:/export,socket=all,path=/rump,vfs=all' + atf_check -s exit:0 mountd /rump/etc/exports + + # finally, le nfschuck + export RUMPHIJACK='blanket=/var/run,socket=all,vfs=all' + atf_check -s exit:0 nfsd -tu + + # now, time for the client server and associated madness. + export RUMP_SERVER=unix://clientsock + unset LD_PRELOAD + + # at least the kernel server is easier + atf_check -s exit:0 rump_server -lrumpvfs -lrumpnet \ + -lrumpnet_net -lrumpnet_netinet -lrumpnet_shmif -lrumpfs_nfs\ + ${RUMP_SERVER} + + atf_check -s exit:0 rump.ifconfig shmif0 create + atf_check -s exit:0 rump.ifconfig shmif0 linkstr shmbus + atf_check -s exit:0 rump.ifconfig shmif0 inet 10.1.1.100 + + export LD_PRELOAD=/usr/lib/librumphijack.so + unset RUMPHIJACK + + atf_check -s exit:0 mkdir /rump/mnt + atf_check -s exit:0 mount_nfs 10.1.1.1:/export /rump/mnt + + atf_check -s exit:0 -o inline:${magicstr}\n cat /rump/mnt/im_alive +} + +nfs_cleanup() +{ + + RUMP_SERVER=unix://serversock rump.halt 2 /dev/null + RUMP_SERVER=unix://clientsock rump.halt 2 /dev/null + : +} + + atf_init_test_cases() { atf_add_test_case http atf_add_test_case ssh + atf_add_test_case nfs }
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: pooka Date: Tue Mar 8 14:53:03 UTC 2011 Modified Files: src/tests/lib/librumphijack: h_client.c Log Message: print out the unexpected rv too To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/lib/librumphijack/h_client.c 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.4 src/tests/lib/librumphijack/h_client.c:1.5 --- src/tests/lib/librumphijack/h_client.c:1.4 Tue Mar 1 08:54:18 2011 +++ src/tests/lib/librumphijack/h_client.c Tue Mar 8 14:53:03 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: h_client.c,v 1.4 2011/03/01 08:54:18 pooka Exp $ */ +/* $NetBSD: h_client.c,v 1.5 2011/03/08 14:53:03 pooka Exp $ */ /* * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -95,7 +95,7 @@ exit(0); } else if (strcmp(argv[1], invafd) == 0) { struct pollfd pfd[2]; - int fd; + int fd, rv; fd = open(/rump/dev/null, O_RDWR); if (fd == -1) @@ -107,8 +107,8 @@ pfd[1].fd = fd; pfd[1].events = POLLIN; - if (poll(pfd, 2, INFTIM) != 1) - errx(1, poll unexpected rv); + if ((rv = poll(pfd, 2, INFTIM)) != 1) + errx(1, poll unexpected rv %d (%d), rv, errno); if (pfd[1].revents != POLLNVAL || pfd[0].revents != 0) errx(1, poll unexpected revents);
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: pooka Date: Tue Mar 8 21:36:25 UTC 2011 Modified Files: src/tests/lib/librumphijack: t_vfs.sh Log Message: test case for runon prefixes To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/lib/librumphijack/t_vfs.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/t_vfs.sh diff -u src/tests/lib/librumphijack/t_vfs.sh:1.2 src/tests/lib/librumphijack/t_vfs.sh:1.3 --- src/tests/lib/librumphijack/t_vfs.sh:1.2 Wed Feb 23 16:38:08 2011 +++ src/tests/lib/librumphijack/t_vfs.sh Tue Mar 8 21:36:25 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_vfs.sh,v 1.2 2011/02/23 16:38:08 pooka Exp $ +# $NetBSD: t_vfs.sh,v 1.3 2011/03/08 21:36:25 pooka Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -136,6 +136,7 @@ } simpletest mv_x +simpletest runonprefix # # do a cross-kernel mv @@ -149,6 +150,13 @@ atf_check -s exit:0 diff -ru ${thedir}.2 /rump/${thedir} } +runonprefix() +{ + + atf_check -s exit:0 -o ignore stat /rump/dev + atf_check -s exit:1 -e ignore stat /rumpdev +} + atf_init_test_cases() { @@ -156,4 +164,5 @@ atf_add_test_case cpcopy atf_add_test_case mv_x atf_add_test_case mv_nox + atf_add_test_case runonprefix }
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: pooka Date: Tue Mar 8 22:21:52 UTC 2011 Modified Files: src/tests/lib/librumphijack: t_vfs.sh Log Message: some blanket tests To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/lib/librumphijack/t_vfs.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/t_vfs.sh diff -u src/tests/lib/librumphijack/t_vfs.sh:1.3 src/tests/lib/librumphijack/t_vfs.sh:1.4 --- src/tests/lib/librumphijack/t_vfs.sh:1.3 Tue Mar 8 21:36:25 2011 +++ src/tests/lib/librumphijack/t_vfs.sh Tue Mar 8 22:21:52 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_vfs.sh,v 1.3 2011/03/08 21:36:25 pooka Exp $ +# $NetBSD: t_vfs.sh,v 1.4 2011/03/08 22:21:52 pooka Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -137,6 +137,8 @@ simpletest mv_x simpletest runonprefix +simpletest blanket +simpletest doubleblanket # # do a cross-kernel mv @@ -152,11 +154,33 @@ runonprefix() { - atf_check -s exit:0 -o ignore stat /rump/dev atf_check -s exit:1 -e ignore stat /rumpdev } +blanket() +{ + export RUMPHIJACK='blanket=/dev,path=/rump' + atf_check -s exit:0 -o save:stat.out \ + stat -f ${statstr} /rump/dev/null + atf_check -s exit:0 -o file:stat.out \ + stat -f ${statstr} /dev/null +} + +doubleblanket() +{ + atf_check -s exit:0 mkdir /rump/dir + atf_check -s exit:0 ln -s dir /rump/dirtoo + + export RUMPHIJACK='blanket=/dirtoo:/dir' + atf_check -s exit:0 touch /dir/file + + atf_check -s exit:0 -o save:stat.out \ + stat -f ${statstr} /dir/file + atf_check -s exit:0 -o file:stat.out \ + stat -f ${statstr} /dirtoo/file +} + atf_init_test_cases() { @@ -165,4 +189,6 @@ atf_add_test_case mv_x atf_add_test_case mv_nox atf_add_test_case runonprefix + atf_add_test_case blanket + atf_add_test_case doubleblanket }
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: pooka Date: Thu Mar 3 11:54:12 UTC 2011 Modified Files: src/tests/lib/librumphijack: Makefile Added Files: src/tests/lib/librumphijack: t_sh.sh Log Message: add tests for hijacked /bin/sh (mostly redirection now) To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/lib/librumphijack/Makefile cvs rdiff -u -r0 -r1.1 src/tests/lib/librumphijack/t_sh.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.5 src/tests/lib/librumphijack/Makefile:1.6 --- src/tests/lib/librumphijack/Makefile:1.5 Wed Feb 23 13:01:57 2011 +++ src/tests/lib/librumphijack/Makefile Thu Mar 3 11:54:11 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.5 2011/02/23 13:01:57 pooka Exp $ +# $NetBSD: Makefile,v 1.6 2011/03/03 11:54:11 pooka Exp $ # .include bsd.own.mk @@ -7,6 +7,7 @@ TESTS_SH= t_asyncio TESTS_SH+= t_cwd +TESTS_SH+= t_sh TESTS_SH+= t_tcpip TESTS_SH+= t_vfs TESTS_C= h_client Added files: Index: src/tests/lib/librumphijack/t_sh.sh diff -u /dev/null src/tests/lib/librumphijack/t_sh.sh:1.1 --- /dev/null Thu Mar 3 11:54:12 2011 +++ src/tests/lib/librumphijack/t_sh.sh Thu Mar 3 11:54:12 2011 @@ -0,0 +1,91 @@ +# $NetBSD: t_sh.sh,v 1.1 2011/03/03 11:54:12 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. +# + +# +# Test various /bin/sh descriptor games. +# +# Note that there is an extra level of trickery here, since +# we need to run an extra level of shell to catch LD_PRELOAD. +# + +rumpsrv='rump_server -lrumpvfs' +export RUMP_SERVER=unix://csock +exout=this is the output you are looking for + +atf_test_case runscript cleanup +runscript_head() +{ +atf_set descr can run /bin/sh scripts from rumpfs +} + +runscript_body() +{ + atf_check -s exit:0 ${rumpsrv} ${RUMP_SERVER} + + export LD_PRELOAD=/usr/lib/librumphijack.so + echo echo $exout thescript + atf_check -s exit:0 mv thescript /rump + atf_check -s exit:0 -o inline:${exout}\n -x sh /rump/thescript +} + +runscript_cleanup() +{ + rump.halt +} + +atf_test_case redirect cleanup +redirect_head() +{ +atf_set descr input/output redirection works with rumphijack +} + +redirect_body() +{ + atf_check -s exit:0 ${rumpsrv} ${RUMP_SERVER} + export LD_PRELOAD=/usr/lib/librumphijack.so + + echo echo $exout /rump/thefile thescript + atf_check -s exit:0 -x sh thescript + + # read it without input redirection + atf_check -s exit:0 -o inline:${exout}\n cat /rump/thefile + + # read it with input redirection (note, need an exec'd shell again) + echo cat /rump/thefile thescript + atf_check -s exit:0 -o inline:${exout}\n -x sh thescript +} + +redirect_cleanup() +{ + rump.halt +} + +atf_init_test_cases() +{ + atf_add_test_case runscript + atf_add_test_case redirect +}
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: pooka Date: Tue Mar 1 08:54:18 UTC 2011 Modified Files: src/tests/lib/librumphijack: h_client.c Log Message: Create a pipe on which to select. selecting on STDIN_FILENO seems to be succesful *sometimes* on some archs (i'm suspecting this is in some way related to lib/libc/ttyio/t_ttyio failing). To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/lib/librumphijack/h_client.c 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.3 src/tests/lib/librumphijack/h_client.c:1.4 --- src/tests/lib/librumphijack/h_client.c:1.3 Sun Feb 20 23:45:46 2011 +++ src/tests/lib/librumphijack/h_client.c Tue Mar 1 08:54:18 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: h_client.c,v 1.3 2011/02/20 23:45:46 pooka Exp $ */ +/* $NetBSD: h_client.c,v 1.4 2011/03/01 08:54:18 pooka Exp $ */ /* * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -50,21 +50,24 @@ if (strcmp(argv[1], select_timeout) == 0) { fd_set rfds; struct timeval tv; + int pipefd[2]; int rv; tv.tv_sec = 0; tv.tv_usec = 1; + if (pipe(pipefd) == -1) + err(1, pipe); FD_ZERO(rfds); - FD_SET(STDIN_FILENO, rfds); + FD_SET(pipefd[0], rfds); - rv = select(STDIN_FILENO+1, rfds, NULL, NULL, tv); + rv = select(pipefd[0]+1, rfds, NULL, NULL, tv); if (rv == -1) err(1, select); if (rv != 0) errx(1, select succesful); - if (FD_ISSET(STDIN_FILENO, rfds)) + if (FD_ISSET(pipefd[0], rfds)) errx(1, stdin fileno is still set); exit(0); } else if (strcmp(argv[1], select_allunset) == 0) {
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: pooka Date: Wed Feb 23 13:01:57 UTC 2011 Modified Files: src/tests/lib/librumphijack: Makefile Added Files: src/tests/lib/librumphijack: t_vfs.sh Log Message: simple vfs tests (mount ffs, cp/pax files there, un/remount, check with diff) To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/lib/librumphijack/Makefile cvs rdiff -u -r0 -r1.1 src/tests/lib/librumphijack/t_vfs.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.4 src/tests/lib/librumphijack/Makefile:1.5 --- src/tests/lib/librumphijack/Makefile:1.4 Sat Feb 19 13:19:52 2011 +++ src/tests/lib/librumphijack/Makefile Wed Feb 23 13:01:57 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.4 2011/02/19 13:19:52 pooka Exp $ +# $NetBSD: Makefile,v 1.5 2011/02/23 13:01:57 pooka Exp $ # .include bsd.own.mk @@ -8,6 +8,7 @@ TESTS_SH= t_asyncio TESTS_SH+= t_cwd TESTS_SH+= t_tcpip +TESTS_SH+= t_vfs TESTS_C= h_client TESTS_C+= h_netget TESTS_C+= h_cwd Added files: Index: src/tests/lib/librumphijack/t_vfs.sh diff -u /dev/null src/tests/lib/librumphijack/t_vfs.sh:1.1 --- /dev/null Wed Feb 23 13:01:57 2011 +++ src/tests/lib/librumphijack/t_vfs.sh Wed Feb 23 13:01:57 2011 @@ -0,0 +1,107 @@ +# $NetBSD: t_vfs.sh,v 1.1 2011/02/23 13:01:57 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. +# + +img=ffs.img +rumpsrv=\ +rump_server -lrumpvfs -lrumpfs_ffs -d key=/img,hostpath=${img},size=host +export RUMP_SERVER=unix://csock + +domount() +{ + + mntdir=$1 + [ $# -eq 0 ] mntdir=/rump/mnt + atf_check -s exit:0 -e ignore mount_ffs /img ${mntdir} +} + +unmount() +{ + + atf_check -s exit:0 umount -R ${1} +} + +remount() +{ + + unmount /rump/mnt + domount /rump/mnt2 +} + +test_case() +{ + local name=${1}; shift + + atf_test_case ${name} cleanup + eval ${name}_head() { } + eval ${name}_body() { \ + atf_check -s exit:0 -o ignore newfs -F -s 2 ${img} ; \ + atf_check -s exit:0 ${rumpsrv} ${RUMP_SERVER} ; \ + export LD_PRELOAD=/usr/lib/librumphijack.so ; \ + mkdir /rump/mnt /rump/mnt2 ; \ + domount ; \ + ${name} ${@} ; \ + unmount /rump/mnt2 ;\ + } + eval ${name}_cleanup() { \ + rump.halt + } +} + +test_case paxcopy +test_case cpcopy + +# +# use rumphijack to cp/pax stuff onto an image, unmount it, remount it +# at a different location, and check that we have an identical copy +# (we make a local copy to avoid the minor possibility that someone +# modifies the source dir data while the test is running) +# +paxcopy() +{ + parent=$(dirname $(atf_get_srcdir)) + thedir=$(basename $(atf_get_srcdir)) + atf_check -s exit:0 pax -rw -s,${parent},, $(atf_get_srcdir) . + atf_check -s exit:0 pax -rw ${thedir} /rump/mnt + remount + atf_check -s exit:0 diff -ru ${thedir} /rump/mnt2/${thedir} +} + +cpcopy() +{ + thedir=$(basename $(atf_get_srcdir)) + atf_check -s exit:0 cp -Rp $(atf_get_srcdir) . + atf_check -s exit:0 cp -Rp ${thedir} /rump/mnt + remount + atf_check -s exit:0 diff -ru ${thedir} /rump/mnt2/${thedir} +} + +atf_init_test_cases() +{ + + atf_add_test_case paxcopy + atf_add_test_case cpcopy +}
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: pooka Date: Wed Feb 23 16:38:08 UTC 2011 Modified Files: src/tests/lib/librumphijack: t_vfs.sh Log Message: some tests for mv(1) To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/lib/librumphijack/t_vfs.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/t_vfs.sh diff -u src/tests/lib/librumphijack/t_vfs.sh:1.1 src/tests/lib/librumphijack/t_vfs.sh:1.2 --- src/tests/lib/librumphijack/t_vfs.sh:1.1 Wed Feb 23 13:01:57 2011 +++ src/tests/lib/librumphijack/t_vfs.sh Wed Feb 23 16:38:08 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_vfs.sh,v 1.1 2011/02/23 13:01:57 pooka Exp $ +# $NetBSD: t_vfs.sh,v 1.2 2011/02/23 16:38:08 pooka Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -26,7 +26,7 @@ # img=ffs.img -rumpsrv=\ +rumpsrv_ffs=\ rump_server -lrumpvfs -lrumpfs_ffs -d key=/img,hostpath=${img},size=host export RUMP_SERVER=unix://csock @@ -38,19 +38,35 @@ atf_check -s exit:0 -e ignore mount_ffs /img ${mntdir} } -unmount() +dounmount() { - atf_check -s exit:0 umount -R ${1} + atf_check -s exit:0 umount -R ${mntdir} } remount() { - unmount /rump/mnt + dounmount domount /rump/mnt2 } +simpletest() +{ + local name=${1}; shift + + atf_test_case ${name} cleanup + eval ${name}_head() { } + eval ${name}_body() { \ + atf_check -s exit:0 rump_server -lrumpvfs ${RUMP_SERVER} ; \ + export LD_PRELOAD=/usr/lib/librumphijack.so ; \ + ${name} ${@} ; \ + } + eval ${name}_cleanup() { \ + rump.halt + } +} + test_case() { local name=${1}; shift @@ -59,12 +75,12 @@ eval ${name}_head() { } eval ${name}_body() { \ atf_check -s exit:0 -o ignore newfs -F -s 2 ${img} ; \ - atf_check -s exit:0 ${rumpsrv} ${RUMP_SERVER} ; \ + atf_check -s exit:0 ${rumpsrv_ffs} ${RUMP_SERVER} ; \ export LD_PRELOAD=/usr/lib/librumphijack.so ; \ mkdir /rump/mnt /rump/mnt2 ; \ domount ; \ ${name} ${@} ; \ - unmount /rump/mnt2 ;\ + dounmount ${mntdir} } eval ${name}_cleanup() { \ rump.halt @@ -73,6 +89,7 @@ test_case paxcopy test_case cpcopy +test_case mv_nox # # use rumphijack to cp/pax stuff onto an image, unmount it, remount it @@ -99,9 +116,44 @@ atf_check -s exit:0 diff -ru ${thedir} /rump/mnt2/${thedir} } +# +# non-crosskernel mv (non-simple test since this uses rename(2) +# which is not supported by rumpfs) +# + +# stat default format sans changetime and filename +statstr='%d %i %Sp %l %Su %Sg %r %z \%Sa\ \%Sm\ \%SB\ %k %b %#Xf' +mv_nox() +{ + + atf_check -s exit:0 touch /rump/mnt/filename + atf_check -s exit:0 -o save:stat.out \ + stat -f ${statstr} /rump/mnt/filename + atf_check -s exit:0 mkdir /rump/mnt/dir + atf_check -s exit:0 mv /rump/mnt/filename /rump/mnt/dir/same + atf_check -s exit:0 -o file:stat.out \ + stat -f ${statstr} /rump/mnt/dir/same +} + +simpletest mv_x + +# +# do a cross-kernel mv +# +mv_x() +{ + thedir=$(basename $(atf_get_srcdir)) + atf_check -s exit:0 cp -Rp $(atf_get_srcdir) . + atf_check -s exit:0 cp -Rp ${thedir} ${thedir}.2 + atf_check -s exit:0 mv ${thedir} /rump + atf_check -s exit:0 diff -ru ${thedir}.2 /rump/${thedir} +} + atf_init_test_cases() { atf_add_test_case paxcopy atf_add_test_case cpcopy + atf_add_test_case mv_x + atf_add_test_case mv_nox }
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: pooka Date: Sun Feb 20 23:45:46 UTC 2011 Modified Files: src/tests/lib/librumphijack: h_client.c t_asyncio.sh Log Message: check that poll on an invalid fd doesn't hang in the dual poll case To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 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/h_client.c diff -u src/tests/lib/librumphijack/h_client.c:1.2 src/tests/lib/librumphijack/h_client.c:1.3 --- src/tests/lib/librumphijack/h_client.c:1.2 Sat Feb 12 10:28:08 2011 +++ src/tests/lib/librumphijack/h_client.c Sun Feb 20 23:45:46 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: h_client.c,v 1.2 2011/02/12 10:28:08 pooka Exp $ */ +/* $NetBSD: h_client.c,v 1.3 2011/02/20 23:45:46 pooka Exp $ */ /* * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -28,10 +28,12 @@ */ #include sys/types.h +#include sys/poll.h #include sys/select.h #include err.h #include errno.h +#include fcntl.h #include stdio.h #include stdlib.h #include string.h @@ -88,6 +90,26 @@ errx(1, select2 succesful); exit(0); + } else if (strcmp(argv[1], invafd) == 0) { + struct pollfd pfd[2]; + int fd; + + fd = open(/rump/dev/null, O_RDWR); + if (fd == -1) + err(1, open); + close(fd); + + pfd[0].fd = STDIN_FILENO; + pfd[0].events = POLLIN; + pfd[1].fd = fd; + pfd[1].events = POLLIN; + + if (poll(pfd, 2, INFTIM) != 1) + errx(1, poll unexpected rv); + if (pfd[1].revents != POLLNVAL || pfd[0].revents != 0) + errx(1, poll unexpected revents); + + exit(0); } else { return ENOTSUP; } Index: src/tests/lib/librumphijack/t_asyncio.sh diff -u src/tests/lib/librumphijack/t_asyncio.sh:1.2 src/tests/lib/librumphijack/t_asyncio.sh:1.3 --- src/tests/lib/librumphijack/t_asyncio.sh:1.2 Sat Feb 12 10:28:08 2011 +++ src/tests/lib/librumphijack/t_asyncio.sh Sun Feb 20 23:45:46 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_asyncio.sh,v 1.2 2011/02/12 10:28:08 pooka Exp $ +# $NetBSD: t_asyncio.sh,v 1.3 2011/02/20 23:45:46 pooka Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -66,8 +66,29 @@ rump.halt } +atf_test_case invafd cleanup +invafd_head() +{ +atf_set descr poll on invalid rump fd + atf_set timeout 4 +} + +invafd_body() +{ + + atf_check -s exit:0 rump_server -lrumpvfs ${RUMP_SERVER} + atf_check -s exit:0 env LD_PRELOAD=/usr/lib/librumphijack.so \ + $(atf_get_srcdir)/h_client invafd +} + +invafd_cleanup() +{ + rump.halt +} + atf_init_test_cases() { atf_add_test_case select_timeout atf_add_test_case select_allunset + atf_add_test_case invafd }
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: pooka Date: Sat Feb 19 13:19:53 UTC 2011 Modified Files: src/tests/lib/librumphijack: Makefile Added Files: src/tests/lib/librumphijack: h_cwd.c t_cwd.sh Log Message: a basic getcwd() test To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/lib/librumphijack/Makefile cvs rdiff -u -r0 -r1.1 src/tests/lib/librumphijack/h_cwd.c \ src/tests/lib/librumphijack/t_cwd.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.3 src/tests/lib/librumphijack/Makefile:1.4 --- src/tests/lib/librumphijack/Makefile:1.3 Mon Feb 14 15:14:00 2011 +++ src/tests/lib/librumphijack/Makefile Sat Feb 19 13:19:52 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.3 2011/02/14 15:14:00 pooka Exp $ +# $NetBSD: Makefile,v 1.4 2011/02/19 13:19:52 pooka Exp $ # .include bsd.own.mk @@ -6,9 +6,11 @@ TESTSDIR= ${TESTSBASE}/lib/librumphijack TESTS_SH= t_asyncio +TESTS_SH+= t_cwd TESTS_SH+= t_tcpip TESTS_C= h_client TESTS_C+= h_netget +TESTS_C+= h_cwd FILES= netstat.expout index.html FILESDIR= ${TESTSDIR} Added files: Index: src/tests/lib/librumphijack/h_cwd.c diff -u /dev/null src/tests/lib/librumphijack/h_cwd.c:1.1 --- /dev/null Sat Feb 19 13:19:53 2011 +++ src/tests/lib/librumphijack/h_cwd.c Sat Feb 19 13:19:52 2011 @@ -0,0 +1,90 @@ +/* $NetBSD: h_cwd.c,v 1.1 2011/02/19 13:19:52 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/stat.h + +#include err.h +#include errno.h +#include string.h +#include unistd.h + +int +main(void) +{ + char pwd[1024]; + + if (chdir(/rump) == -1) + err(1, chdir1); + if (getcwd(pwd, sizeof(pwd)) == NULL) + err(1, getcwd1); + if (strcmp(pwd, /rump) != 0) + errx(1, strcmp1); + + if (mkdir(dir, 0777) == -1) + err(1, mkdir2); + if (chdir(dir) == -1) + err(1, chdir2); + if (getcwd(pwd, sizeof(pwd)) == NULL) + err(1, getcwd2); + if (strcmp(pwd, /rump/dir) != 0) + errx(1, strcmp2); + + if (mkdir(dir, 0777) == -1) + err(1, mkdir3); + if (chdir(dir) == -1) + err(1, chdir3); + if (getcwd(pwd, sizeof(pwd)) == NULL) + err(1, getcwd3); + if (strcmp(pwd, /rump/dir/dir) != 0) + errx(1, strcmp3); + + if (chdir(..) == -1) + err(1, chdir4); + if (getcwd(pwd, sizeof(pwd)) == NULL) + err(1, getcwd4); + if (strcmp(pwd, /rump/dir) != 0) + errx(1, strcmp4); + + if (chdir(../../../../../../..) == -1) + err(1, chdir5); + if (getcwd(pwd, sizeof(pwd)) == NULL) + err(1, getcwd5); + if (strcmp(pwd, /rump) != 0) + errx(1, strcmp5); + + if (chdir(/) == -1) + err(1, chdir6); + if (getcwd(pwd, sizeof(pwd)) == NULL) + err(1, getcwd6); + if (strcmp(pwd, /) != 0) + errx(1, strcmp6); + + return 0; +} Index: src/tests/lib/librumphijack/t_cwd.sh diff -u /dev/null src/tests/lib/librumphijack/t_cwd.sh:1.1 --- /dev/null Sat Feb 19 13:19:53 2011 +++ src/tests/lib/librumphijack/t_cwd.sh Sat Feb 19 13:19:52 2011 @@ -0,0 +1,53 @@ +# $NetBSD: t_cwd.sh,v 1.1 2011/02/19 13:19:52 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
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: pooka Date: Sat Feb 19 19:57:28 UTC 2011 Modified Files: src/tests/lib/librumphijack: h_cwd.c t_cwd.sh Log Message: more test cases: * // prefix * fchdir * cd-via-symlink To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/lib/librumphijack/h_cwd.c \ src/tests/lib/librumphijack/t_cwd.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_cwd.c diff -u src/tests/lib/librumphijack/h_cwd.c:1.1 src/tests/lib/librumphijack/h_cwd.c:1.2 --- src/tests/lib/librumphijack/h_cwd.c:1.1 Sat Feb 19 13:19:52 2011 +++ src/tests/lib/librumphijack/h_cwd.c Sat Feb 19 19:57:28 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: h_cwd.c,v 1.1 2011/02/19 13:19:52 pooka Exp $ */ +/* $NetBSD: h_cwd.c,v 1.2 2011/02/19 19:57:28 pooka Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -32,59 +32,136 @@ #include err.h #include errno.h +#include fcntl.h #include string.h #include unistd.h -int -main(void) +static const char *prefix; +static size_t prefixlen; +static char buf[1024]; +static char pwd[1024]; + +static const char * +makepath(const char *tail) +{ + + strcpy(buf, prefix); + if (prefix[prefixlen-1] != '/') + strcat(buf, /); + strcat(buf, tail); + + return buf; +} + +static void +dochdir(const char *path, const char *errmsg) +{ + + if (chdir(path) == -1) + err(1, %s, errmsg); +} + +static void +dofchdir(const char *path, const char *errmsg) +{ + int fd; + + fd = open(path, O_RDONLY); + if (fd == -1) + err(1, open %s, errmsg); + if (fchdir(fd) == -1) + err(1, fchdir %s, errmsg); + close(fd); +} +static void (*thechdir)(const char *, const char *); + +static void +simple(void) { - char pwd[1024]; - if (chdir(/rump) == -1) - err(1, chdir1); + thechdir(prefix, chdir1); if (getcwd(pwd, sizeof(pwd)) == NULL) err(1, getcwd1); - if (strcmp(pwd, /rump) != 0) + if (strcmp(pwd, prefix) != 0) errx(1, strcmp1); if (mkdir(dir, 0777) == -1) err(1, mkdir2); - if (chdir(dir) == -1) - err(1, chdir2); + thechdir(dir, chdir2); if (getcwd(pwd, sizeof(pwd)) == NULL) err(1, getcwd2); - if (strcmp(pwd, /rump/dir) != 0) + if (strcmp(pwd, makepath(dir)) != 0) errx(1, strcmp2); if (mkdir(dir, 0777) == -1) err(1, mkdir3); - if (chdir(dir) == -1) - err(1, chdir3); + thechdir(dir, chdir3); if (getcwd(pwd, sizeof(pwd)) == NULL) err(1, getcwd3); - if (strcmp(pwd, /rump/dir/dir) != 0) + if (strcmp(pwd, makepath(dir/dir)) != 0) errx(1, strcmp3); - if (chdir(..) == -1) - err(1, chdir4); + thechdir(.., chdir4); if (getcwd(pwd, sizeof(pwd)) == NULL) err(1, getcwd4); - if (strcmp(pwd, /rump/dir) != 0) + if (strcmp(pwd, makepath(dir)) != 0) errx(1, strcmp4); - if (chdir(../../../../../../..) == -1) - err(1, chdir5); + + thechdir(../../../../../../.., chdir5); if (getcwd(pwd, sizeof(pwd)) == NULL) err(1, getcwd5); - if (strcmp(pwd, /rump) != 0) + if (strcmp(pwd, prefix) != 0) errx(1, strcmp5); - if (chdir(/) == -1) - err(1, chdir6); + thechdir(/, chdir6); if (getcwd(pwd, sizeof(pwd)) == NULL) err(1, getcwd6); if (strcmp(pwd, /) != 0) errx(1, strcmp6); +} + +static void +symlinktest(void) +{ + + thechdir(prefix, chdir1); + if (mkdir(adir, 0777) == -1) + err(1, mkdir1); + if (mkdir(anotherdir, 0777) == -1) + err(1, mkdir2); + + if (symlink(/adir, anotherdir/lincthesink) == -1) + err(1, symlink); + + thechdir(anotherdir/lincthesink, chdir2); + if (getcwd(pwd, sizeof(pwd)) == NULL) + err(1, getcwd); + if (strcmp(pwd, makepath(adir)) != 0) + errx(1, strcmp); +} + +int +main(int argc, char *argv[]) +{ + + if (argc != 4) + errx(1, usage); + + prefix = argv[1]; + prefixlen = strlen(argv[1]); + + if (strcmp(argv[3], chdir) == 0) + thechdir = dochdir; + else if (strcmp(argv[3], fchdir) == 0) + thechdir = dofchdir; + else + errx(1, invalid chdir type); + + if (strcmp(argv[2], simple) == 0) + simple(); + if (strcmp(argv[2], symlink) == 0) + symlinktest(); return 0; } Index: src/tests/lib/librumphijack/t_cwd.sh diff -u src/tests/lib/librumphijack/t_cwd.sh:1.1 src/tests/lib/librumphijack/t_cwd.sh:1.2 --- src/tests/lib/librumphijack/t_cwd.sh:1.1 Sat Feb 19 13:19:52 2011 +++ src/tests/lib/librumphijack/t_cwd.sh Sat Feb 19 19:57:28 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_cwd.sh,v 1.1 2011/02/19 13:19:52 pooka Exp $ +# $NetBSD: t_cwd.sh,v 1.2 2011/02/19 19:57:28 pooka Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -28,26 +28,45 @@ rumpsrv='rump_server -lrumpvfs' export RUMP_SERVER=unix://csock -atf_test_case basic cleanup -basic_head() -{ -atf_set descr basic cwd test -} - -basic_body() +test_case() { + local name=${1}; shift - atf_check -s exit:0 ${rumpsrv} ${RUMP_SERVER} - atf_check -s exit:0 env LD_PRELOAD=/usr/lib/librumphijack.so \ - $(atf_get_srcdir)/h_cwd + atf_test_case ${name} cleanup + eval
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: pooka Date: Mon Feb 14 15:14:00 UTC 2011 Modified Files: src/tests/lib/librumphijack: Makefile t_tcpip.sh Added Files: src/tests/lib/librumphijack: ssh_config.in ssh_host_key ssh_host_key.pub sshd_config.in Log Message: Test that hijacked ssh/sshd work. Copypastes jmmv's sshd magic from fs/psshfs. (dunno if it's worth sharing the code, or even what the best practice for doing so would be) To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/lib/librumphijack/Makefile cvs rdiff -u -r0 -r1.1 src/tests/lib/librumphijack/ssh_config.in \ src/tests/lib/librumphijack/ssh_host_key \ src/tests/lib/librumphijack/ssh_host_key.pub \ src/tests/lib/librumphijack/sshd_config.in cvs rdiff -u -r1.1 -r1.2 src/tests/lib/librumphijack/t_tcpip.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.2 src/tests/lib/librumphijack/Makefile:1.3 --- src/tests/lib/librumphijack/Makefile:1.2 Fri Feb 11 15:38:14 2011 +++ src/tests/lib/librumphijack/Makefile Mon Feb 14 15:14:00 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.2 2011/02/11 15:38:14 pooka Exp $ +# $NetBSD: Makefile,v 1.3 2011/02/14 15:14:00 pooka Exp $ # .include bsd.own.mk @@ -13,6 +13,12 @@ FILES= netstat.expout index.html FILESDIR= ${TESTSDIR} +# ssh test +FILES+= ssh_config.in +FILES+= ssh_host_key +FILES+= ssh_host_key.pub +FILES+= sshd_config.in + ATFFILE= yes .include bsd.test.mk Index: src/tests/lib/librumphijack/t_tcpip.sh diff -u src/tests/lib/librumphijack/t_tcpip.sh:1.1 src/tests/lib/librumphijack/t_tcpip.sh:1.2 --- src/tests/lib/librumphijack/t_tcpip.sh:1.1 Sun Feb 6 18:44:30 2011 +++ src/tests/lib/librumphijack/t_tcpip.sh Mon Feb 14 15:14:00 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_tcpip.sh,v 1.1 2011/02/06 18:44:30 pooka Exp $ +# $NetBSD: t_tcpip.sh,v 1.2 2011/02/14 15:14:00 pooka Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -42,7 +42,7 @@ export RUMPHIJACK_RETRY='die' # start bozo in daemon mode - atf_check -s exit:0 -e ignore env LD_PRELOAD=/usr/lib/librumphijack.so \ + atf_check -s exit:0 env LD_PRELOAD=/usr/lib/librumphijack.so \ /usr/libexec/httpd -b -s $(atf_get_srcdir) atf_check -s exit:0 -o file:$(atf_get_srcdir)/netstat.expout \ @@ -64,7 +64,90 @@ rump.halt } +# +# Starts a SSH server and sets up the client to access it. +# Authentication is allowed and done using an RSA key exclusively, which +# is generated on the fly as part of the test case. +# XXX: Ideally, all the tests in this test program should be able to share +# the generated key, because creating it can be a very slow process on some +# machines. +# +# XXX2: copypasted from jmmv's sshd thingamob in the psshfs test. +# ideally code (and keys, like jmmv notes above) could be shared +# +start_sshd() { + echo Setting up SSH server configuration + sed -e s,@SRCDIR@,$(atf_get_srcdir),g -e s,@WORKDIR@,$(pwd),g \ + $(atf_get_srcdir)/sshd_config.in sshd_config || \ + atf_fail Failed to create sshd_config + atf_check -s ignore -o empty -e ignore \ + cp $(atf_get_srcdir)/ssh_host_key . + atf_check -s ignore -o empty -e ignore \ + cp $(atf_get_srcdir)/ssh_host_key.pub . + atf_check -s eq:0 -o empty -e empty chmod 400 ssh_host_key + atf_check -s eq:0 -o empty -e empty chmod 444 ssh_host_key.pub + +env LD_PRELOAD=/usr/lib/librumphijack.so \ + /usr/sbin/sshd -e -f ./sshd_config + while [ ! -f sshd.pid ]; do + sleep 0.01 + done + echo SSH server started (pid $(cat sshd.pid)) + + echo Setting up SSH client configuration + atf_check -s eq:0 -o empty -e empty \ + ssh-keygen -f ssh_user_key -t rsa -b 1024 -N -q + atf_check -s eq:0 -o empty -e empty \ + cp ssh_user_key.pub authorized_keys + echo 127.0.0.1,localhost,::1 \ + $(cat $(atf_get_srcdir)/ssh_host_key.pub) known_hosts || \ + atf_fail Failed to create known_hosts + atf_check -s eq:0 -o empty -e empty chmod 600 authorized_keys + sed -e s,@SRCDIR@,$(atf_get_srcdir),g -e s,@WORKDIR@,$(pwd),g \ + $(atf_get_srcdir)/ssh_config.in ssh_config || \ + atf_fail Failed to create ssh_config + + echo sshd running +} + +atf_test_case ssh cleanup +ssh_head() +{ +atf_set descr Test that hijacked ssh/sshd works +} + +ssh_body() +{ + + atf_check -s exit:0 ${rumpnetsrv} ${RUMP_SERVER} + # make sure clients die after we nuke the server + export RUMPHIJACK_RETRY='die' + + export LD_LIBRARY_PATH=/home/pooka/src/nb5/src/lib/libssh + + start_sshd + + # create some sort of directory for us to ls + mkdir testdir + cd testdir + jot 11 | xargs touch + jot 11 12 | xargs mkdir + cd .. + + atf_check -s exit:0 -o save:ssh.out\ + env LD_PRELOAD=/usr/lib/librumphijack.so \ + ssh -T -F ssh_config 127.0.0.1 ls -li $(pwd)/testdir + atf_check -s exit:0 -o
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: pooka Date: Mon Feb 14 19:54:29 UTC 2011 Modified Files: src/tests/lib/librumphijack: t_tcpip.sh Log Message: -debugging crud To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/lib/librumphijack/t_tcpip.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/t_tcpip.sh diff -u src/tests/lib/librumphijack/t_tcpip.sh:1.2 src/tests/lib/librumphijack/t_tcpip.sh:1.3 --- src/tests/lib/librumphijack/t_tcpip.sh:1.2 Mon Feb 14 15:14:00 2011 +++ src/tests/lib/librumphijack/t_tcpip.sh Mon Feb 14 19:54:29 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_tcpip.sh,v 1.2 2011/02/14 15:14:00 pooka Exp $ +# $NetBSD: t_tcpip.sh,v 1.3 2011/02/14 19:54:29 pooka Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -123,8 +123,6 @@ # make sure clients die after we nuke the server export RUMPHIJACK_RETRY='die' - export LD_LIBRARY_PATH=/home/pooka/src/nb5/src/lib/libssh - start_sshd # create some sort of directory for us to ls
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: pooka Date: Mon Feb 14 19:56:30 UTC 2011 Modified Files: src/tests/lib/librumphijack: t_tcpip.sh Log Message: explicitly set BLOCKSIZE so that we don't get fooled again To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/lib/librumphijack/t_tcpip.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/t_tcpip.sh diff -u src/tests/lib/librumphijack/t_tcpip.sh:1.3 src/tests/lib/librumphijack/t_tcpip.sh:1.4 --- src/tests/lib/librumphijack/t_tcpip.sh:1.3 Mon Feb 14 19:54:29 2011 +++ src/tests/lib/librumphijack/t_tcpip.sh Mon Feb 14 19:56:30 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_tcpip.sh,v 1.3 2011/02/14 19:54:29 pooka Exp $ +# $NetBSD: t_tcpip.sh,v 1.4 2011/02/14 19:56:30 pooka Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -134,8 +134,10 @@ atf_check -s exit:0 -o save:ssh.out\ env LD_PRELOAD=/usr/lib/librumphijack.so \ - ssh -T -F ssh_config 127.0.0.1 ls -li $(pwd)/testdir - atf_check -s exit:0 -o file:ssh.out ls -li $(pwd)/testdir + ssh -T -F ssh_config 127.0.0.1 env BLOCKSIZE=512 \ + ls -li $(pwd)/testdir + atf_check -s exit:0 -o file:ssh.out env BLOCKSIZE=512 \ + ls -li $(pwd)/testdir } ssh_cleanup()
CVS commit: src/tests/lib/librumphijack
Module Name:src Committed By: pooka Date: Sat Feb 12 10:28:08 UTC 2011 Modified Files: src/tests/lib/librumphijack: h_client.c t_asyncio.sh Log Message: Add test case from PR lib/44552 by Alexander Nasonov. I also lobbed in a test for select(0, NULL, NULL, NULL, tv) in there. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 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/h_client.c diff -u src/tests/lib/librumphijack/h_client.c:1.1 src/tests/lib/librumphijack/h_client.c:1.2 --- src/tests/lib/librumphijack/h_client.c:1.1 Fri Feb 11 15:38:14 2011 +++ src/tests/lib/librumphijack/h_client.c Sat Feb 12 10:28:08 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: h_client.c,v 1.1 2011/02/11 15:38:14 pooka Exp $ */ +/* $NetBSD: h_client.c,v 1.2 2011/02/12 10:28:08 pooka Exp $ */ /* * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -65,6 +65,29 @@ if (FD_ISSET(STDIN_FILENO, rfds)) errx(1, stdin fileno is still set); exit(0); + } else if (strcmp(argv[1], select_allunset) == 0) { + fd_set fds; + struct timeval tv; + int rv; + + tv.tv_sec = 0; + tv.tv_usec = 1; + + FD_ZERO(fds); + + rv = select(100, fds, fds, fds, tv); + if (rv == -1) + err(1, select); + if (rv != 0) + errx(1, select succesful); + + rv = select(0, NULL, NULL, NULL, tv); + if (rv == -1) + err(1, select2); + if (rv != 0) + errx(1, select2 succesful); + + exit(0); } else { return ENOTSUP; } Index: src/tests/lib/librumphijack/t_asyncio.sh diff -u src/tests/lib/librumphijack/t_asyncio.sh:1.1 src/tests/lib/librumphijack/t_asyncio.sh:1.2 --- src/tests/lib/librumphijack/t_asyncio.sh:1.1 Fri Feb 11 15:38:14 2011 +++ src/tests/lib/librumphijack/t_asyncio.sh Sat Feb 12 10:28:08 2011 @@ -1,4 +1,4 @@ -# $NetBSD: t_asyncio.sh,v 1.1 2011/02/11 15:38:14 pooka Exp $ +# $NetBSD: t_asyncio.sh,v 1.2 2011/02/12 10:28:08 pooka Exp $ # # Copyright (c) 2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -47,7 +47,27 @@ rump.halt } +atf_test_case select_allunset cleanup +select_allunset_head() +{ +atf_set descr select() with no set fds in fd_set should not crash +} + +select_allunset_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_allunset +} + +select_allunset_cleanup() +{ + rump.halt +} + atf_init_test_cases() { atf_add_test_case select_timeout + atf_add_test_case select_allunset }
CVS commit: src/tests/lib/librumphijack
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,