1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-11 13:50:48 -05:00
rofi/test/run_test.sh
a1346054 c62137f8ab
Simple maintenance improvements (#1370)
* rofi moved to libera.chat

* unify some theme headers and whitespace

* consistently use the same hashbang for bash

* improve obsolete way of testing equality

see https://github.com/koalaman/shellcheck/wiki/SC2268 for explanation

* use consistent function definitions in bash scripts

* remove duplicated author and fix whitespace

* quote all variables in scripts

fixes many warnings identified through shellcheck

* fix whitespace in scripts

* fix whitespace in non-source files

* fix spelling in non-source files

* fix whitespace and indentation in source files

* fix spelling in source files
2021-08-14 13:03:16 +02:00

58 lines
1.4 KiB
Bash
Executable file

#!/usr/bin/env bash
XPID=
FPID=
create_fake_x()
{
export DISPLAY=":$1"
echo -n "Starting fake X for display ${DISPLAY}: "
Xvfb -nolisten tcp +extension XINERAMA +xinerama -screen 0 1280x1024x24 "${DISPLAY}" &>$2-server.log &
XPID=$!
echo "pid ${XPID}"
sleep 1
if [ -x "$(which fluxbox 2>/dev/null)" ]; then
echo -n "Starting fluxbox for display ${DISPLAY}: "
timeout -k 30s 30s fluxbox &>$2-fluxbox.log &
FPID=$!
echo "pid ${FPID}"
sleep 1
fi
}
destroy_fake_x()
{
if [ -n "${XPID}" ]
then
if [ -n "${FPID}" ]; then
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
fi
}
if [ -n "$4" ]
then
export PATH=$4:$PATH
fi
create_fake_x "$1" "$2"
"$3" "$5" &> "$2-test.log"
RES=$?
destroy_fake_x "$2"
exit "${RES}"