summaryrefslogtreecommitdiff
path: root/tools/ci/scripts/runtest.sh
blob: 9862d5bf8428eae9f1480fe6cc7d199219d53ac8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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