home · contact · privacy
Rename and improve testing script.
[plomrogue] / test_server.sh
diff --git a/test_server.sh b/test_server.sh
new file mode 100755 (executable)
index 0000000..8d6d7b4
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+./redo
+echo "Copying tested server script to ./tested_server.py."
+cp ./plomrogue-server.py ./testing/tested_server.py
+echo "Copying tested C library source to ./tested_server_lib.c."
+cp ./libplomrogue.c ./testing/tested_server_lib.c
+
+cp ./testing/start _test
+echo "Starting server on save file '_test' copied from ./testing/start."
+python3 -m cProfile -o ./testing/cProfile plomrogue-server.py -l _test &
+
+echo "Waiting until ./server/in is ready for writing."
+while [ ! -e ./server/in ]
+do
+    sleep 0.1
+done
+
+echo "Catting ./testing/run into ./server/in."
+cat ./testing/run >> server/in
+
+echo "Waiting until server has quit (i.e. ./server/in has disappeared)."
+while [ -e ./server/in ]
+do
+    sleep 1
+done
+
+echo "Server has quit. Here's the length of the diff of final '_test' (copy at"
+echo "./testing/last_end) to the reference save file ./testing/ref_end (TEST WENT "
+echo "WELL IF ZERO): "
+mv _test testing/last_end
+diff testing/last_end testing/ref_end | wc -l
+
+rm record__test