tests: New helper function feed_input, for comment support
feed_input drops lines starting with a bar character '|', so they can serve as comments. Syntax chosen because such lines shouldn't be needed in tests. In particular, the server already ignores such lines when it reads commands, because they get parsed as empty command with a pipeline, and empty commands get ignored, regardless of redirections. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
71cb2d8940
commit
d0d692e415
3 changed files with 12 additions and 5 deletions
|
@ -31,9 +31,8 @@ EOF
|
|||
|
||||
begin_test "$srcdir"/tests/actofgod/init_script
|
||||
|
||||
perl "$srcdir"/tests/actofgod/geninput.pl | src/client/empire POGO peter >/dev/null
|
||||
perl "$srcdir"/tests/actofgod/geninput.pl | feed_input POGO peter
|
||||
|
||||
end_test
|
||||
|
||||
# Test completed; compare results
|
||||
cmp_out var/empire/server.log var/empire/journal.log actofgod.xdump
|
||||
|
|
|
@ -27,7 +27,7 @@ create_sandbox
|
|||
|
||||
begin_test "$srcdir"/tests/smoke/fairland.xdump
|
||||
|
||||
src/client/empire POGO peter <"$srcdir"/tests/smoke/newcap_script >/dev/null
|
||||
feed_input POGO peter "$srcdir"/tests/smoke/newcap_script
|
||||
|
||||
t=
|
||||
for i in `git ls-files "$srcdir"/tests/smoke | grep 'tests/smoke/../..$'`
|
||||
|
@ -36,7 +36,7 @@ do
|
|||
t="${i%/??}"
|
||||
if [ "$p" != "$t" ] && [ "$p" ]
|
||||
then
|
||||
src/client/empire POGO peter <<EOF >/dev/null
|
||||
feed_input POGO peter <<EOF
|
||||
power new
|
||||
report *
|
||||
cen * ?own#0
|
||||
|
@ -50,7 +50,7 @@ EOF
|
|||
then c=POGO r=peter
|
||||
else c="${b#0}"; r="$c"
|
||||
fi
|
||||
src/client/empire "$c" "$r" <"$i" >/dev/null
|
||||
feed_input "$c" "$r" "$i"
|
||||
done
|
||||
|
||||
end_test
|
||||
|
|
|
@ -70,6 +70,14 @@ stop_server()
|
|||
done
|
||||
}
|
||||
|
||||
feed_input()
|
||||
{
|
||||
c=$1
|
||||
r=$2
|
||||
shift 2
|
||||
sed '/^|/d' "$@" | src/client/empire "$c" "$r" >/dev/null
|
||||
}
|
||||
|
||||
begin_test()
|
||||
{
|
||||
src/util/files -e sandbox/etc/empire/econfig -f >/dev/null
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue