rofi/test/run_test.sh

47 lines
864 B
Bash
Raw Normal View History

#!/usr/bin/env bash
XPID=
2016-01-05 15:46:43 +00:00
FPID=
function create_fake_x ( )
{
2014-08-30 18:53:35 +00:00
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 &
XPID=$!
2016-01-07 20:27:20 +00:00
sleep 1;
if [ -x "$(which fluxbox 2>/dev/null)" ]; then
timeout -k 30s 30s fluxbox &>test-x-logs/fluxbox-:$1.log &
FPID=$!
sleep 1
fi
}
function destroy_fake_x ( )
{
if [ -n "${XPID}" ]
then
2016-01-05 15:46:43 +00:00
echo "Stopping fake X: ${XPID} - ${FPID}"
if [ -n "${FPID}" ]; then
kill ${FPID}
echo " wait flux"
wait ${FPID}
fi
kill ${XPID}
2016-01-08 21:17:00 +00:00
echo "wait x"
wait ${XPID}
fi
}
if [ -n "$3" ]
then
2014-08-30 18:53:35 +00:00
export PATH=$3:$PATH
fi
create_fake_x "$1"
"$2" "$4"
RES=$?
destroy_fake_x
exit ${RES}