]> git.pond.sub.org Git - empserver/blob - tests/smoke-test
tests: Drop smoke.out, actofgod.out
[empserver] / tests / smoke-test
1 #!/bin/sh -e
2 # Smoke test for Empire
3
4 if [ $# -ne 1 ]
5 then echo "Usage: $0 SRCDIR" >&2; exit 1
6 fi
7
8 srcdir="$1"
9
10 . "$srcdir"/tests/test-common.sh
11
12 #
13 # Currently expected to work only with thread package LWP, because:
14
15 # - Thread scheduling is reliably deterministic only with LWP
16 # - Shell builtin kill appears not to do the job in MinGW
17 # - The Windows server tries to run as service when -d isn't
18 #   specified
19 #
20 # TODO address these shortcomings.
21 #
22 if [ `sed -n 's/empthread *:= *\(.*\)/\1/p' <GNUmakefile` != LWP ]
23 then echo "Warning: smoke test not expected to work with this thread package!" >&2
24 fi
25
26 create_sandbox
27
28 # Create world and start server
29 src/util/files -e sandbox/etc/empire/econfig -f >/dev/null
30 src/util/empdump -e sandbox/etc/empire/econfig -i "$srcdir"/tests/smoke/fairland.xdump
31 start_server
32 src/client/empire POGO peter <"$srcdir"/tests/smoke/newcap_script >/dev/null
33
34 # Feed player input
35 need_update=
36 for i in "$srcdir"/tests/smoke/[0-9]*
37 do
38     t="${i##*/}"
39     if [ "$need_update" ]
40     then
41         src/client/empire POGO peter <<EOF >/dev/null
42 power new
43 report *
44 cen * ?own#0
45 comm * ?own#0
46 reso * ?own#0
47 force
48 EOF
49     fi
50     for j in "$i"/*
51     do
52         p="${j##*/}"
53         if [ $p -eq 0 ]
54         then c=POGO r=peter
55         else c="${p#0}"; r="$c"
56         fi
57         src/client/empire "$c" "$r" <$j >/dev/null
58     done
59     need_update=y
60 done
61
62 # Stop server
63 stop_server
64
65 src/util/empdump -e sandbox/etc/empire/econfig -x >sandbox/smoke.xdump
66
67 # Smoke test completed; compare results
68 cmp_out var/empire/server.log var/empire/journal.log smoke.xdump