summaryrefslogtreecommitdiff
path: root/tools/ci/scripts
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-04-22 21:30:43 +0300
committerAndrei Karas <akaras@inbox.ru>2017-04-22 21:30:43 +0300
commit26ada73e5178d75e7a1ecef074976b1c956d972f (patch)
treea5030aaad3d1becf9ff8bf01ae2d00ef71f01f0d /tools/ci/scripts
parent1e059ddb25a56995aca739987e3a4cd98cd344c4 (diff)
downloadplus-26ada73e5178d75e7a1ecef074976b1c956d972f.tar.gz
plus-26ada73e5178d75e7a1ecef074976b1c956d972f.tar.bz2
plus-26ada73e5178d75e7a1ecef074976b1c956d972f.tar.xz
plus-26ada73e5178d75e7a1ecef074976b1c956d972f.zip
Add test with run and terminate game binary into .gitlab-ci.yml
Diffstat (limited to 'tools/ci/scripts')
-rwxr-xr-xtools/ci/scripts/runtest.sh41
1 files changed, 41 insertions, 0 deletions
diff --git a/tools/ci/scripts/runtest.sh b/tools/ci/scripts/runtest.sh
new file mode 100755
index 000000000..9862d5bf8
--- /dev/null
+++ b/tools/ci/scripts/runtest.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+export SDL_VIDEODRIVER="dummy"
+
+./src/manaplus --renderer=0 >logs/run.log 2>&1 &
+export PID=$!
+sleep 12s
+
+kill -0 ${PID}
+if [ "$?" != 0 ]; then
+ echo "Error: process look like crashed"
+ cat logs/run.log
+ exit 1
+fi
+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
+
+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
+exit 0