From 828c229df6bf65e7248484af21d3bae344fd1801 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se> Date: Fri, 13 Jul 2012 22:31:20 +0200 Subject: [PATCH] Use our own tcpconnect for the testsuite. Don't depend on tcputils. --- ChangeLog | 12 ++++++++++++ src/testsuite/functions.sh | 4 ---- src/testsuite/lshd-random-input-test | 4 +--- src/testsuite/lshg-tcpip-local-test | 4 +--- src/testsuite/lshg-tcpip-remote-test | 6 ++---- src/testsuite/rapid7-lshd-test | 4 +--- src/testsuite/socks4-test | 3 +-- src/testsuite/socks5-test | 3 +-- src/testsuite/tcpip-local-test | 4 +--- src/testsuite/tcpip-remote-test | 6 ++---- 10 files changed, 22 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index fa6847d0e..25869e131 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 2012-07-13 Niels Möller <nisse@lysator.liu.se> + * src/testsuite/functions.sh (need_tcputils): Deleted function. + * src/testsuite/lshd-random-input-test: Use ./tcpconnect, rather + than the possibly installed version from tcputils. Don't use + need_tcputils. + * src/testsuite/lshg-tcpip-local-test: Likewise. + * src/testsuite/lshg-tcpip-remote-test: Likewise. + * src/testsuite/rapid7-lshd-test: Likewise. + * src/testsuite/socks4-test: Likewise. + * src/testsuite/socks5-test: Likewise. + * src/testsuite/tcpip-local-test: Likewise. + * src/testsuite/tcpip-remote-test: Likewise. + * src/testsuite/tcpconnect.c (main): Ignore SIGPIPE. Fixes to diagnostic printouts. diff --git a/src/testsuite/functions.sh b/src/testsuite/functions.sh index 13348ab0a..b6499c3d5 100644 --- a/src/testsuite/functions.sh +++ b/src/testsuite/functions.sh @@ -115,10 +115,6 @@ need_xvfb () { [ -n "$XVFB" ] || test_skip } -need_tcputils () { - type tcpconnect >/dev/null 2>&1 || test_skip -} - need_tsocks () { type tsocks >/dev/null 2>&1 || test_skip } diff --git a/src/testsuite/lshd-random-input-test b/src/testsuite/lshd-random-input-test index 20ca84048..225427ab7 100755 --- a/src/testsuite/lshd-random-input-test +++ b/src/testsuite/lshd-random-input-test @@ -8,8 +8,6 @@ fi PORT=5555 -need_tcputils - werror "Testing lshd with random input" spawn_lshd @@ -17,7 +15,7 @@ spawn_lshd for seed in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ; do werror "Trying seed $seed" $LFIB_STREAM $seed \ - | tcpconnect localhost $PORT > /dev/null \ + | ./tcpconnect -v localhost $PORT > /dev/null \ || die "Connect failed" kill -0 `cat $PIDFILE` || die "Server died" diff --git a/src/testsuite/lshg-tcpip-local-test b/src/testsuite/lshg-tcpip-local-test index f954b95a7..76b95d40f 100755 --- a/src/testsuite/lshg-tcpip-local-test +++ b/src/testsuite/lshg-tcpip-local-test @@ -6,8 +6,6 @@ fi . $srcdir/functions.sh -need_tcputils - SERVERPORT=`expr $PORT + 1` PROXYPORT=`expr $PORT + 2` @@ -15,7 +13,7 @@ at_connect $SERVERPORT 1 'echo foo' \ && spawn_lshd \ && spawn_lsh --start-gateway \ && spawn_lshg -L $PROXYPORT:localhost:$SERVERPORT \ - && tcpconnect -r </dev/null localhost $PROXYPORT | grep foo \ + && ./tcpconnect -r </dev/null localhost $PROXYPORT | grep foo \ && test_success test_done diff --git a/src/testsuite/lshg-tcpip-remote-test b/src/testsuite/lshg-tcpip-remote-test index 4c343f062..bcc11e017 100755 --- a/src/testsuite/lshg-tcpip-remote-test +++ b/src/testsuite/lshg-tcpip-remote-test @@ -6,8 +6,6 @@ fi . $srcdir/functions.sh -need_tcputils - SERVERPORT=`expr $PORT + 1` PROXYPORT=`expr $PORT + 2` @@ -17,9 +15,9 @@ at_connect $SERVERPORT 1 'echo foo' \ && spawn_lshd \ && spawn_lsh --start-gateway \ && spawn_lshg -R $PROXYPORT:localhost:$SERVERPORT \ - && cat /dev/null | tcpconnect localhost $PROXYPORT | grep foo \ + && cat /dev/null | ./tcpconnect localhost $PROXYPORT | grep foo \ && kill `cat $LSHG_PIDFILE` \ && sleep 5 \ - && if tcpconnect </dev/null -i localhost $PROXYPORT ; then false ; else test_success ; fi + && if ./tcpconnect </dev/null -i localhost $PROXYPORT ; then false ; else test_success ; fi test_done diff --git a/src/testsuite/rapid7-lshd-test b/src/testsuite/rapid7-lshd-test index 4618cda12..c87053563 100755 --- a/src/testsuite/rapid7-lshd-test +++ b/src/testsuite/rapid7-lshd-test @@ -6,8 +6,6 @@ fi . $srcdir/functions.sh -need_tcputils - PORT=5555 werror "Testing lshd" @@ -16,7 +14,7 @@ spawn_lshd for f in $srcdir/rapid7-ssh-pdu/*.pdu ; do # werror "Testing $f" - tcpconnect localhost $PORT < "$f" > /dev/null \ + ./tcpconnect localhost $PORT < "$f" > /dev/null \ || die "Connect failed, test $f" kill -0 `cat $PIDFILE` || die "Server died, test $f" diff --git a/src/testsuite/socks4-test b/src/testsuite/socks4-test index 91baaa623..a1d3b2745 100755 --- a/src/testsuite/socks4-test +++ b/src/testsuite/socks4-test @@ -6,7 +6,6 @@ fi . $srcdir/functions.sh -need_tcputils need_tsocks SERVERPORT=`expr $PORT + 1` @@ -20,7 +19,7 @@ export TSOCKS_CONF_FILE at_connect $SERVERPORT 1 'grep bar && echo foo' \ && spawn_lshd \ && spawn_lsh -D$SOCKSPORT \ - && echo bar | tsocks tcpconnect localhost $SERVERPORT | grep foo \ + && echo bar | tsocks ./tcpconnect localhost $SERVERPORT | grep foo \ && test_success test_done diff --git a/src/testsuite/socks5-test b/src/testsuite/socks5-test index 13db0430f..8f8904fc7 100755 --- a/src/testsuite/socks5-test +++ b/src/testsuite/socks5-test @@ -6,7 +6,6 @@ fi . $srcdir/functions.sh -need_tcputils need_tsocks SERVERPORT=`expr $PORT + 1` @@ -20,7 +19,7 @@ export TSOCKS_CONF_FILE at_connect $SERVERPORT 1 'grep bar && echo foo' \ && spawn_lshd \ && spawn_lsh -D$SOCKSPORT \ - && echo bar | tsocks tcpconnect localhost $SERVERPORT | grep foo \ + && echo bar | tsocks ./tcpconnect localhost $SERVERPORT | grep foo \ && test_success test_done diff --git a/src/testsuite/tcpip-local-test b/src/testsuite/tcpip-local-test index 9abfbe58f..29e0e795f 100755 --- a/src/testsuite/tcpip-local-test +++ b/src/testsuite/tcpip-local-test @@ -6,15 +6,13 @@ fi . $srcdir/functions.sh -need_tcputils - SERVERPORT=`expr $PORT + 1` PROXYPORT=`expr $PORT + 2` at_connect $SERVERPORT 1 'grep bar && echo foo' \ && spawn_lshd \ && spawn_lsh -L $PROXYPORT:localhost:$SERVERPORT \ - && echo bar | tcpconnect localhost $PROXYPORT | grep foo \ + && echo bar | ./tcpconnect localhost $PROXYPORT | grep foo \ && test_success test_done diff --git a/src/testsuite/tcpip-remote-test b/src/testsuite/tcpip-remote-test index 4a9a5c23a..ac744c980 100755 --- a/src/testsuite/tcpip-remote-test +++ b/src/testsuite/tcpip-remote-test @@ -6,22 +6,20 @@ fi . $srcdir/functions.sh -need_tcputils - SERVERPORT=`expr $PORT + 1` PROXYPORT=`expr $PORT + 2` # For some reason, tcpconnect < /dev/null doesn't work on SunOS-5.4. Hence # the appearantly unneeded use of cat. -# The sleep is needed, because spawn_lsh returns when the +# FIXME: The sleep is needed, because spawn_lsh returns when the # tcpip-forward request is sent, and the server may not have processed # it yet. at_connect $SERVERPORT 1 'echo foo' \ && spawn_lshd \ && spawn_lsh -R $PROXYPORT:localhost:$SERVERPORT \ && sleep 2 \ - && cat /dev/null | tcpconnect localhost $PROXYPORT | grep foo \ + && cat /dev/null | ./tcpconnect localhost $PROXYPORT | grep foo \ && test_success test_done -- GitLab