1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
#!/bin/bash
# This test exercises the example described in the README.
# basic-command is the example program from the README.
cmd=debian/tests/basic-command
die () {
printf '%s\n' "$*" 1>&2
exit 1
}
chmod +x $cmd || exit 1
log=$AUTOPKGTEST_TMP/error.log
$cmd &>$log
text='error: Failed to divide by zero'
# The output must contain this text.
if ! grep -q "$text" $log; then
echo "Should have output the error, but did not."
echo "Log: --"
cat $log
echo "--"
exit 1
fi
# With verbosity critical, the output must not contain the error text.
$cmd --verbosity=critical &>$log
if grep -q "$text" $log; then
echo "Should have NOT output the error."
echo "Log: --"
cat $log
echo "--"
exit 1
fi
|