1
1
mirror of https://github.com/wader/fq.git synced 2024-12-26 15:02:28 +03:00
fq/pkg/cli/test_exp.sh

22 lines
421 B
Bash
Raw Normal View History

2021-09-18 13:31:03 +03:00
#!/bin/sh
2021-09-18 19:23:28 +03:00
set -eu
2021-09-18 13:31:03 +03:00
FQ="$1"
shift
2021-09-18 13:31:03 +03:00
if which expect >/dev/null 2>&1; then
TEMPDIR=$(mktemp -d)
cp "$FQ" "${TEMPDIR}/fq"
2021-09-18 19:23:28 +03:00
PATH="${TEMPDIR}:${PATH}" expect "$1" >"${TEMPDIR}/fq.log" && FAIL=0 || FAIL=1
if [ $FAIL = "1" ]; then
2021-09-18 13:31:03 +03:00
cat "${TEMPDIR}/fq.log"
fi
rm -rf "${TEMPDIR}"
2021-09-18 19:23:28 +03:00
if [ $FAIL = "1" ]; then
2021-09-18 13:31:03 +03:00
exit 1
fi
2021-09-19 12:58:37 +03:00
echo "$0"
2021-09-18 13:31:03 +03:00
else
2021-09-19 12:58:37 +03:00
echo "$0: skip as expect is not installed"
2021-09-18 13:31:03 +03:00
fi