1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

tests: Better logging

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
This commit is contained in:
Quentin Glidic 2017-07-27 17:30:39 +02:00
parent 6300f6b1a5
commit e854260ef8
No known key found for this signature in database
GPG key ID: AC203F96E2C34BB7
2 changed files with 35 additions and 17 deletions

View file

@ -31,14 +31,20 @@ rm -f core
display=200
for test in "${tests[@]}"; do
echo "Test ${test}"
${MESON_SOURCE_ROOT}/test/run_test.sh ${display} ${MESON_SOURCE_ROOT}/test/${test}.sh ${MESON_BUILD_ROOT} ${MESON_SOURCE_ROOT}
log_prefix=test-x-logs/${display}
echo -n "Test ${test}: "
${MESON_SOURCE_ROOT}/test/run_test.sh ${display} ${log_prefix} ${MESON_SOURCE_ROOT}/test/${test}.sh ${MESON_BUILD_ROOT} ${MESON_SOURCE_ROOT} &> ${log_prefix}-wrapper.log
ret=$?
if [[ -f core ]]; then
echo "COREDUMP"
echo "bt" | gdb ./rofi core
more ${log_prefix}*.log | cat
exit ${ret}
elif [[ ${ret} != 0 ]]; then
echo "FAIL"
more ${log_prefix}*.log | cat
exit ${ret}
fi
echo "PASS"
display=$(( ${display} + 1 ))
done

View file

@ -5,13 +5,16 @@ FPID=
function create_fake_x ( )
{
export DISPLAY=":$1"
echo "Starting fake X: ${DISPLAY}"
Xvfb +extension XINERAMA +xinerama -screen 0 1280x1024x24 -screen 1 800x600x24 ${DISPLAY} &>test-x-logs/xserver-:$1.log &
echo -n "Starting fake X for display ${DISPLAY}: "
Xvfb +extension XINERAMA +xinerama -screen 0 1280x1024x24 -screen 1 800x600x24 ${DISPLAY} &>$2-server.log &
XPID=$!
echo "pid ${XPID}"
sleep 1;
if [ -x "$(which fluxbox 2>/dev/null)" ]; then
timeout -k 30s 30s fluxbox &>test-x-logs/fluxbox-:$1.log &
echo -n "Starting fluxbox for display ${DISPLAY}: "
timeout -k 30s 30s fluxbox &>$2-fluxbox.log &
FPID=$!
echo "pid ${FPID}"
sleep 1
fi
}
@ -20,27 +23,36 @@ function destroy_fake_x ( )
{
if [ -n "${XPID}" ]
then
echo "Stopping fake X: ${XPID} - ${FPID}"
if [ -n "${FPID}" ]; then
kill ${FPID}
echo " wait flux"
wait ${FPID}
echo -n "Stopping fluxbox for display ${DISPLAY} (pid ${FPID}): "
if kill ${FPID} &>$1-kill-fluxbox.log; then
echo -n " killed... "
wait ${FPID} &>$1-wait-fluxbox.log
echo "stopped"
else
echo -n " failed to kill"
fi
fi
echo -n "Stopping fake X for display ${DISPLAY} (pid ${XPID}): "
if kill ${XPID} &>$1-kill-X.log; then
echo -n " killed... "
wait ${XPID} &>$1-wait-X.log
echo "stopped"
else
echo -n " failed to kill"
fi
kill ${XPID}
echo "wait x"
wait ${XPID}
fi
}
if [ -n "$3" ]
if [ -n "$4" ]
then
export PATH=$3:$PATH
export PATH=$4:$PATH
fi
create_fake_x "$1"
"$2" "$4"
create_fake_x "$1" "$2"
"$3" "$5" &> "$2-test.log"
RES=$?
destroy_fake_x
destroy_fake_x "$2"
exit ${RES}