rapid7-lsh-test 806 Bytes
Newer Older
Niels Möller's avatar
Niels Möller committed
1 2
#! /bin/sh

3 4
if [ -z "$srcdir" ] ; then
  srcdir=`pwd`
Niels Möller's avatar
Niels Möller committed
5 6
fi

7 8 9
. $srcdir/functions.sh

PORT=5556
Niels Möller's avatar
Niels Möller committed
10

11
./mini-inetd -- $PORT /bin/sh /bin/sh -c 'cat current 2>/dev/null' & 
12
pid=$!
Niels Möller's avatar
Niels Möller committed
13

14
at_exit "kill $pid; rm -f current" 0
Niels Möller's avatar
Niels Möller committed
15

16
werror "Testing lsh"
Niels Möller's avatar
Niels Möller committed
17

18
for f in $srcdir/rapid7-ssh-pdu/*.pdu ; do
19
    # werror "Testing $f"
20 21
    rm -f current    || die "Deleting symlink current failed"
    ln -s $f current || die "Creating symlink current -> $f failed"
Niels Möller's avatar
Niels Möller committed
22

23
    set +e
24
    HOME="$TEST_HOME" ../lsh -q --sloppy --host-db-update=/dev/null -p $PORT localhost exit 0
Niels Möller's avatar
Niels Möller committed
25
    status="$?"
26
    set -e
Niels Möller's avatar
Niels Möller committed
27 28 29 30 31 32 33
    # Should be either 1 or 17 (not sure exactly when
    # which of these are returned)
    case "$status" in
	1|17)
	    :
	;;
	*)
34
	    die "Strange exit code $status from client, test $f"
Niels Möller's avatar
Niels Möller committed
35 36 37 38 39 40
	;;
    esac
done

werror "Test done"

41
test_success