]> git.pond.sub.org Git - empserver/blob - tests/actofgod-test
tests/actofgod: New, disabled for now because it oopses
[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 exec 3>sandbox/actofgod.out
33
34 # Create world, hide creation output
35 src/util/files -e sandbox/etc/empire/econfig -f >&3
36 cp -r sandbox/var/empire/tel sandbox/var/empire/empty.tel
37 start_server
38 src/client/empire POGO peter <"$srcdir"/tests/actofgod/init_script >/dev/null
39 stop_server
40 mv sandbox/var/empire/tel sandbox/var/empire/init.tel
41 mv sandbox/var/empire/empty.tel sandbox/var/empire/tel
42 mv sandbox/var/empire/journal.log sandbox/var/empire/init.journal.log
43 mv sandbox/var/empire/server.log sandbox/var/empire/init.server.log
44
45 # Start server
46 start_server
47
48 # Feed input
49 perl "$srcdir"/tests/actofgod/geninput.pl | src/client/empire POGO peter >/dev/null
50
51 # Stop server
52 stop_server
53
54 exec 3>&-
55
56 src/util/empdump -e sandbox/etc/empire/econfig -x >sandbox/actofgod.xdump
57
58 # Test completed; compare results
59 cmp_out actofgod.out var/empire/server.log var/empire/journal.log actofgod.xdump