mirror of https://github.com/wolfSSL/wolfssh.git
55 lines
1.2 KiB
Bash
Executable File
55 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env sh
|
|
|
|
# Prerequisite checking
|
|
|
|
if [ ! -x "$(command -v expect)" ]
|
|
then
|
|
echo "skipping: missing expect"
|
|
exit 77
|
|
fi
|
|
|
|
# Automake sets $srcdir for tests. When building out-of-tree (e.g.
|
|
# make distcheck), the expect script only lives in the source tree,
|
|
# not the build tree. Fall back to the current directory otherwise.
|
|
expect_script="${srcdir:-.}/scripts/fwd.test.expect"
|
|
|
|
if [ ! -x "$expect_script" ]
|
|
then
|
|
echo "fail: missing expect script"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -x "$(command -v nc)" ]
|
|
then
|
|
echo "skipping: missing netcat"
|
|
exit 77
|
|
fi
|
|
|
|
## libtool can leave behind a script that runs the actual executable.
|
|
if [ ! -x ./examples/echoserver/echoserver ] || \
|
|
./examples/echoserver/echoserver "-?" 2>&1 | grep -q "does not exist"
|
|
then
|
|
echo "fail: missing echoserver"
|
|
exit 1
|
|
fi
|
|
|
|
## libtool can leave behind a script that runs the actual executable.
|
|
if [ ! -x ./examples/portfwd/portfwd ] || \
|
|
./examples/portfwd/portfwd "-?" 2>&1 | grep -q "does not exist"
|
|
then
|
|
echo "skipping: missing forwarding"
|
|
exit 77
|
|
fi
|
|
|
|
## test for nonblocking only
|
|
if ./examples/client/client "-?" 2>&1 | grep WOLFSSH_TEST_BLOCK >/dev/null 2>&1
|
|
then
|
|
echo "skipping: non-blocking test"
|
|
exit 77
|
|
fi
|
|
|
|
|
|
# Run the expect script
|
|
|
|
"$expect_script"
|