2 # Smoke test for Empire
5 then echo "Usage: $0 SRCDIR" >&2; exit 1
10 . "$srcdir"/tests/test-common.sh
13 # Currently expected to work only with thread package LWP and a
14 # random() that behaves exactly like the one on my development system,
17 # - Thread scheduling is reliably deterministic only with LWP
18 # - The PRN sequence produced by random() isn't portable
19 # - Shell builtin kill appears not to do the job in MinGW
20 # - The Windows server tries to run as service when -d isn't
23 # TODO address these shortcomings.
25 if [ "`uname -s`" != "Linux" ] # lame approx. of "random() behaves like mine"
26 then echo "Warning: smoke test not expected to work on this system!" >&2
27 elif [ `sed -n 's/empthread *:= *\(.*\)/\1/p' <GNUmakefile` != LWP ]
28 then echo "Warning: smoke test not expected to work with this thread package!" >&2
33 exec 3>sandbox/smoke.out
35 # Create world and start server
36 src/util/files -e sandbox/etc/empire/econfig -f >&3
37 src/util/fairland -e sandbox/etc/empire/econfig -q -s sandbox/newcap_script -R 1 10 30
39 src/client/empire POGO peter <sandbox/newcap_script >/dev/null
43 for i in "$srcdir"/tests/smoke/[0-9]*
48 echo "Update Turn $t starting" >&3
49 src/client/empire POGO peter <<EOF >&3
57 echo "Update Turn $t completed successfully" >&3
62 echo "Player $p Turn $t starting" >&3
65 else c="${p#0}"; r="$c"
67 src/client/empire "$c" "$r" <$j >&3
68 echo "Player $p Turn $t completed successfully" >&3
78 src/util/empdump -e sandbox/etc/empire/econfig -x >sandbox/smoke.xdump
80 # Smoke test completed; compare results
81 cmp_out smoke.out var/empire/server.log var/empire/journal.log smoke.xdump