]> git.pond.sub.org Git - empserver/blob - tests/actofgod-test
tests: Drop smoke.out, actofgod.out
[empserver] / tests / actofgod-test
1 #!/bin/sh -e
2 # Acts of god 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: test not expected to work with this thread package!" >&2
24 fi
25
26 create_sandbox
27 cat >>sandbox/etc/empire/econfig <<EOF
28 WORLD_X 24
29 WORLD_Y 16
30 EOF
31
32 # Create world, hide creation output
33 src/util/files -e sandbox/etc/empire/econfig -f >/dev/null
34 cp -r sandbox/var/empire/tel sandbox/var/empire/empty.tel
35 start_server
36 src/client/empire POGO peter <"$srcdir"/tests/actofgod/init_script >/dev/null
37 stop_server
38 mv sandbox/var/empire/tel sandbox/var/empire/init.tel
39 mv sandbox/var/empire/empty.tel sandbox/var/empire/tel
40 mv sandbox/var/empire/journal.log sandbox/var/empire/init.journal.log
41 mv sandbox/var/empire/server.log sandbox/var/empire/init.server.log
42
43 # Start server
44 start_server
45
46 # Feed input
47 perl "$srcdir"/tests/actofgod/geninput.pl | src/client/empire POGO peter >/dev/null
48
49 # Stop server
50 stop_server
51
52 src/util/empdump -e sandbox/etc/empire/econfig -x >sandbox/actofgod.xdump
53
54 # Test completed; compare results
55 cmp_out var/empire/server.log var/empire/journal.log actofgod.xdump