home · contact · privacy
Fix testing script.
[plomrogue] / test_server.sh
1 #!/bin/sh
2
3 set -e
4
5 ./build.sh
6 echo "Copying tested server script to ./tested_server.py."
7 cp ./roguelike-server ./testing/tested_server.py
8 echo "Copying tested C library source to ./tested_server_lib.c."
9 cp .libplomrogue.c ./testing/tested_server_lib.c
10
11 cp ./testing/start _test
12 echo "Starting server on save file '_test' copied from ./testing/start."
13 python3 -m cProfile -o ./testing/cProfile roguelike-server -l _test &
14
15 echo "Waiting until ./server/in is ready for writing."
16 while [ ! -e ./server/in ]
17 do
18     sleep 0.1
19 done
20
21 echo "Catting ./testing/run into ./server/in."
22 cat ./testing/run >> server/in
23
24 echo "Waiting until server has quit (i.e. ./server/in has disappeared)."
25 while [ -e ./server/in ]
26 do
27     sleep 1
28 done
29
30 echo "Server has quit. Here's the length of the diff of final '_test' (copy at"
31 echo "./testing/last_end) to the reference save file ./testing/ref_end (TEST WENT "
32 echo "WELL IF ZERO): "
33 mv _test testing/last_end
34 diff testing/last_end testing/ref_end | wc -l
35
36 rm record__test