summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-05-11 19:27:19 +0300
committerAndrei Karas <akaras@inbox.ru>2017-05-11 19:27:19 +0300
commit4d8f17cfd69f3078518c1a82e53a8a6e611099ac (patch)
tree3f20f4a78b5a425c96f411383e7e56a1399bd681 /tools
parent105447be78701b25e59d5654e4450fdf2195e45a (diff)
downloadmanaverse-4d8f17cfd69f3078518c1a82e53a8a6e611099ac.tar.gz
manaverse-4d8f17cfd69f3078518c1a82e53a8a6e611099ac.tar.bz2
manaverse-4d8f17cfd69f3078518c1a82e53a8a6e611099ac.tar.xz
manaverse-4d8f17cfd69f3078518c1a82e53a8a6e611099ac.zip
Use ipc for simple tests in runtest.sh
Diffstat (limited to 'tools')
-rwxr-xr-xtools/ci/scripts/runtest.sh112
1 files changed, 74 insertions, 38 deletions
diff --git a/tools/ci/scripts/runtest.sh b/tools/ci/scripts/runtest.sh
index 80b54a0ff..95e3758e8 100755
--- a/tools/ci/scripts/runtest.sh
+++ b/tools/ci/scripts/runtest.sh
@@ -1,46 +1,82 @@
#!/bin/bash
-./src/manaplus --renderer=0 >logs/run.log 2>&1 &
-export PID=$!
-sleep 12s
+function check_is_run {
+ kill -0 ${PID}
+ if [ "$?" != 0 ]; then
+ echo "Error: process look like crashed"
+ cat logs/run.log
+ echo "Run with gdb"
+ cp ./src/manaplus ./logs/
+ cp -r core* ./logs/
+ COREFILE=$(find . -maxdepth 1 -name "core*" | head -n 1)
+ if [[ -f "$COREFILE" ]]; then
+ gdb -c "$COREFILE" ./src/manaplus -ex "thread apply all bt" -ex "set pagination 0" -batch
+ fi
+ exit 1
+ fi
+}
-kill -0 ${PID}
-if [ "$?" != 0 ]; then
- echo "Error: process look like crashed"
- cat logs/run.log
- echo "Run with gdb"
- cp ./src/manaplus ./logs/
- cp -r core* ./logs/
- COREFILE=$(find . -maxdepth 1 -name "core*" | head -n 1)
- if [[ -f "$COREFILE" ]]; then
- gdb -c "$COREFILE" ./src/manaplus -ex "thread apply all bt" -ex "set pagination 0" -batch
+function run {
+ ./src/manaplus --enable-ipc --renderer=0 >logs/run.log 2>&1 &
+ export PID=$!
+ sleep 12s
+}
+
+function kill_app {
+ kill -s SIGTERM ${PID}
+ export RET=$?
+
+ sleep 10s
+
+ if [ "${RET}" != 0 ]; then
+ echo "Error: process not responsing to termination signal"
+ kill -s SIGKILL ${PID}
+ cat logs/run.log
+ exit 1
fi
- exit 1
-fi
-kill -s SIGTERM ${PID}
-export RET=$?
+}
-sleep 10s
+function final_log {
+ export DATA=$(cat logs/run.log)
+ if [[ -z "${DATA}" ]]; then
+ echo "Error: no output"
+ exit 1
+ fi
-if [ "${RET}" != 0 ]; then
- echo "Error: process not responsing to termination signal"
- kill -s SIGKILL ${PID}
cat logs/run.log
- exit 1
-fi
-
-export DATA=$(cat logs/run.log)
-if [[ -z "${DATA}" ]]; then
- echo "Error: no output"
- exit 1
-fi
-
-cat logs/run.log
-
-export DATA=$(grep "[.]cpp" logs/run.log)
-if [[ -n "${DATA}" ]]; then
- echo "Error: possible leak detected"
- echo "${DATA}"
- exit 1
-fi
+
+ export DATA=$(grep "[.]cpp" logs/run.log)
+ if [[ -n "${DATA}" ]]; then
+ echo "Error: possible leak detected"
+ echo "${DATA}"
+ exit 1
+ fi
+}
+
+function send_command {
+ echo -n "$1" | nc 127.0.0.1 44007
+}
+
+run
+check_is_run
+
+send_command "/screenshot 1_"
+sleep 5s
+check_is_run
+
+# send down key
+send_command "/guikey -960 keyGUIDown"
+sleep 5s
+check_is_run
+
+send_command "/screenshot 2_"
+sleep 5s
+check_is_run
+
+# final delay
+sleep 5s
+
+kill_app
+final_log
+
exit 0