1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-25 13:55:34 -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 display=200
for test in "${tests[@]}"; do for test in "${tests[@]}"; do
echo "Test ${test}" log_prefix=test-x-logs/${display}
${MESON_SOURCE_ROOT}/test/run_test.sh ${display} ${MESON_SOURCE_ROOT}/test/${test}.sh ${MESON_BUILD_ROOT} ${MESON_SOURCE_ROOT} 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=$? ret=$?
if [[ -f core ]]; then if [[ -f core ]]; then
echo "COREDUMP"
echo "bt" | gdb ./rofi core echo "bt" | gdb ./rofi core
more ${log_prefix}*.log | cat
exit ${ret} exit ${ret}
elif [[ ${ret} != 0 ]]; then elif [[ ${ret} != 0 ]]; then
echo "FAIL"
more ${log_prefix}*.log | cat
exit ${ret} exit ${ret}
fi fi
echo "PASS"
display=$(( ${display} + 1 )) display=$(( ${display} + 1 ))
done done

View file

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