Skip to content
Snippets Groups Projects
Commit 64a118f2 authored by Guido Gunther's avatar Guido Gunther :zzz:
Browse files

smoketest: allow to set running time and valgrind

This will make is simple to integrate it into CI
parent 072b6699
No related branches found
No related tags found
No related merge requests found
......@@ -2,24 +2,57 @@
RET=1
set -x
set -e
WORKDIR=$(mktemp -d)
PHOSH_LOG="${WORKDIR}/phosh.log"
WLROOTS_LOG="${WORKDIR}/rootston.log"
ROOTSTON_CONFIG="${WORKDIR}/rootston.ini"
TIMEOUT=5
function cleanup () {
[ ! -f core ] || echo bt | gdb -c core _build/src/phosh
[ "${RET}" -eq 0 ] || cat ${WLROOTS_LOG} || true
[ "${RET}" -eq 0 ] || cat ${PHOSH_LOG} || true
[ -z "${XVFB_PID}" ] || kill -9 "${XVFB_PID}" || true
[ -z "${PHOSH_PID}" ] || kill -9 "${PHOSH_PID}" >& /dev/null || true
[ -z "${WORKDIR}" ] || rm -rf "${WORKDIR}"
[ "${RET}" -eq 0 ] || [ ! -f "${WLROOTS_LOG}" ] || cat "${WLROOTS_LOG}" || true
[ "${RET}" -eq 0 ] || [ ! -f "${PHOSH_LOG}" ] || cat "${PHOSH_LOG}" || true
[ -z "${XVFB_PID}" ] || kill -9 "${XVFB_PID}" >& /dev/null || true
[ -z "${PHOSH_PID}" ] || kill -9 "${PHOSH_PID}" >& /dev/null || true
[ -z "${WORKDIR}" ] || rm -rf "${WORKDIR}"
}
trap cleanup EXIT
function usage () {
cat <<EOF
Usage: $0
-h - Display this help message."
-T <seconds> - how long should phosh run (default $TIMEOUT seconds
-V - run under valgrind
EOF
}
while getopts "hT:V" opt; do
case ${opt} in
T)
TIMEOUT=$OPTARG
;;
V)
export PHOSH_VALGRIND=1
;;
\?)
echo "Invalid Option: -$OPTARG" 1>&2
usage "$0"
RET=1
exit 0
;;
h)
usage "$0"
RET=0
exit 0
;;
esac
done
cat <<EOF > "${ROOTSTON_CONFIG}"
[output:X11-1]
mode = 768x1024
......@@ -28,6 +61,9 @@ mode = 768x1024
mode = 1280x800
EOF
# Provide output for the interesting parts
set -x
XVFB_OPTS="-screen 0 768x1024x24 -ac +extension GLX +render -noreset"
export WLR_BACKENDS=x11
export XDG_RUNTIME_DIR="${WORKDIR}"
......@@ -54,7 +90,7 @@ _build/run >& "${PHOSH_LOG}" &
PHOSH_PID=$!
echo "Phosh's PID is $PHOSH_PID"
sleep 1 # give it some time to start
sleep "${TIMEOUT}" # give it some time to start
echo -n "Checking if phosh is alive..."
kill -0 $PHOSH_PID
......@@ -62,7 +98,7 @@ echo "yes."
kill -15 $PHOSH_PID
echo -n "Checking if phosh shutted down..."
sleep 1
sleep "${TIMEOUT}"
! kill -0 $PHOSH_PID >&/dev/null
echo "yes."
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment