empserver/tests/smoke-test
Markus Armbruster 71cb2d8940 tests: Use only files known to git
Filename expansion can pick up junk files.  Use git-ls-files instead.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2014-01-06 20:49:45 +01:00

58 lines
1.2 KiB
Bash
Executable file

#!/bin/sh -e
# Smoke test for Empire
if [ $# -ne 1 ]
then echo "Usage: $0 SRCDIR" >&2; exit 1
fi
srcdir="$1"
. "$srcdir"/tests/test-common.sh
#
# Currently expected to work only with thread package LWP, because:
#
# - Thread scheduling is reliably deterministic only with LWP
# - Shell builtin kill appears not to do the job in MinGW
# - The Windows server tries to run as service when -d isn't
# specified
#
# TODO address these shortcomings.
#
if [ `sed -n 's/empthread *:= *\(.*\)/\1/p' <GNUmakefile` != LWP ]
then echo "Warning: smoke test not expected to work with this thread package!" >&2
fi
create_sandbox
begin_test "$srcdir"/tests/smoke/fairland.xdump
src/client/empire POGO peter <"$srcdir"/tests/smoke/newcap_script >/dev/null
t=
for i in `git ls-files "$srcdir"/tests/smoke | grep 'tests/smoke/../..$'`
do
p="$t"
t="${i%/??}"
if [ "$p" != "$t" ] && [ "$p" ]
then
src/client/empire POGO peter <<EOF >/dev/null
power new
report *
cen * ?own#0
comm * ?own#0
reso * ?own#0
force
EOF
fi
b="${i##*/}"
if [ $b -eq 0 ]
then c=POGO r=peter
else c="${b#0}"; r="$c"
fi
src/client/empire "$c" "$r" <"$i" >/dev/null
done
end_test
cmp_out var/empire/server.log var/empire/journal.log smoke.xdump