Merge pull request #393 from psychon/ci-script-improvements
Ci script improvements Closes https://github.com/awesomeWM/awesome/pull/393.
This commit is contained in:
commit
d1bb53de18
86
tests/run.sh
86
tests/run.sh
|
@ -36,6 +36,7 @@ XEPHYR=Xephyr
|
||||||
XVFB=Xvfb
|
XVFB=Xvfb
|
||||||
AWESOME=$root_dir/build/awesome
|
AWESOME=$root_dir/build/awesome
|
||||||
RC_FILE=$root_dir/build/awesomerc.lua
|
RC_FILE=$root_dir/build/awesomerc.lua
|
||||||
|
AWESOME_CLIENT="$root_dir/utils/awesome-client"
|
||||||
D=:5
|
D=:5
|
||||||
SIZE=1024x768
|
SIZE=1024x768
|
||||||
|
|
||||||
|
@ -50,9 +51,6 @@ else
|
||||||
# ( sleep 1; kill -USR1 $xserver_pid ) &
|
# ( sleep 1; kill -USR1 $xserver_pid ) &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use a separate D-Bus session; sets $DBUS_SESSION_BUS_PID.
|
|
||||||
eval $(DISPLAY="$D" dbus-launch --sh-syntax --exit-with-session)
|
|
||||||
|
|
||||||
cd $root_dir/build
|
cd $root_dir/build
|
||||||
|
|
||||||
LUA_PATH="$(lua -e 'print(package.path)');lib/?.lua;lib/?/init.lua"
|
LUA_PATH="$(lua -e 'print(package.path)');lib/?.lua;lib/?/init.lua"
|
||||||
|
@ -62,47 +60,68 @@ XDG_CONFIG_HOME="./"
|
||||||
export LUA_PATH
|
export LUA_PATH
|
||||||
export XDG_CONFIG_HOME
|
export XDG_CONFIG_HOME
|
||||||
|
|
||||||
awesome_log=/tmp/_awesome_test.log
|
|
||||||
echo "awesome_log: $awesome_log"
|
|
||||||
|
|
||||||
cd - >/dev/null
|
cd - >/dev/null
|
||||||
|
|
||||||
|
# Cleanup on errors / aborting.
|
||||||
kill_childs() {
|
cleanup() {
|
||||||
for p in $awesome_pid $xserver_pid; do
|
for p in $awesome_pid $xserver_pid; do
|
||||||
kill -TERM $p 2>/dev/null || true
|
kill -TERM $p 2>/dev/null || true
|
||||||
done
|
done
|
||||||
|
rm -rf $tmp_files || true
|
||||||
}
|
}
|
||||||
# Cleanup on errors / aborting.
|
trap "cleanup" 0 2 3 15
|
||||||
set_trap() {
|
|
||||||
trap "kill_childs" 0 2 3 15
|
|
||||||
}
|
|
||||||
set_trap
|
|
||||||
|
|
||||||
# Wait for DISPLAY to be available, and setup xrdb,
|
tmp_files=$(mktemp -d)
|
||||||
# for awesome's xresources backend / queries.
|
awesome_log=$tmp_files/_awesome_test.log
|
||||||
max_wait=60
|
echo "awesome_log: $awesome_log"
|
||||||
while true; do
|
|
||||||
|
wait_until_success() {
|
||||||
|
if [ "$CI" = true ]; then
|
||||||
|
set +x
|
||||||
|
fi
|
||||||
|
max_wait=60
|
||||||
|
while true; do
|
||||||
set +e
|
set +e
|
||||||
reply="$(echo "Xft.dpi: 96" | DISPLAY="$D" xrdb 2>&1)"
|
eval reply="\$($2)"
|
||||||
ret=$?
|
ret=$?
|
||||||
set -e
|
set -e
|
||||||
if [ $ret = 0 ]; then
|
if [ $ret = 0 ]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
max_wait=$(expr $max_wait - 1)
|
max_wait=$(expr $max_wait - 1 || true)
|
||||||
if [ "$max_wait" -lt 0 ]; then
|
if [ "$max_wait" -lt 0 ]; then
|
||||||
echo "Error: failed to setup xrdb!"
|
echo "Error: failed to $1!"
|
||||||
echo "Last reply: $reply."
|
echo "Last reply: $reply."
|
||||||
|
if [ -f "$awesome_log" ]; then
|
||||||
echo "Log:"
|
echo "Log:"
|
||||||
cat "$awesome_log"
|
cat "$awesome_log"
|
||||||
|
fi
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
sleep 0.05
|
sleep 0.05
|
||||||
done
|
done
|
||||||
|
if [ "$CI" = true ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Wait for DISPLAY to be available, and setup xrdb,
|
||||||
|
# for awesome's xresources backend / queries.
|
||||||
|
wait_until_success "setup xrdb" "echo 'Xft.dpi: 96' | DISPLAY='$D' xrdb 2>&1"
|
||||||
|
|
||||||
AWESOME_CLIENT="$root_dir/utils/awesome-client"
|
# Use a separate D-Bus session; sets $DBUS_SESSION_BUS_PID.
|
||||||
|
eval $(DISPLAY="$D" dbus-launch --sh-syntax --exit-with-session)
|
||||||
|
|
||||||
|
# Not in Travis?
|
||||||
|
if [ "$CI" != true ]; then
|
||||||
|
# Prepare a config file pointing to a working theme
|
||||||
|
RC_FILE=$tmp_files/awesomerc.lua
|
||||||
|
THEME_FILE=$tmp_files/theme.lua
|
||||||
|
sed -e "s:beautiful.init(\"@AWESOME_THEMES_PATH@/default/theme.lua\"):beautiful.init('$THEME_FILE'):" $root_dir/awesomerc.lua > $RC_FILE
|
||||||
|
sed -e "s:@AWESOME_THEMES_PATH@/default/titlebar:$root_dir/build/themes/default/titlebar:" \
|
||||||
|
-e "s:@AWESOME_THEMES_PATH@:$root_dir/themes/:" \
|
||||||
|
-e "s:@AWESOME_ICON_PATH@:$root_dir/icons:" $root_dir/themes/default/theme.lua > $THEME_FILE
|
||||||
|
fi
|
||||||
|
|
||||||
# Start awesome.
|
# Start awesome.
|
||||||
start_awesome() {
|
start_awesome() {
|
||||||
|
@ -113,26 +132,7 @@ start_awesome() {
|
||||||
cd - >/dev/null
|
cd - >/dev/null
|
||||||
|
|
||||||
# Wait until the interface for awesome-client is ready (D-Bus interface).
|
# Wait until the interface for awesome-client is ready (D-Bus interface).
|
||||||
client_reply=
|
wait_until_success "wait for awesome startup via awesome-client" "echo 'return 1' | DISPLAY=$D '$AWESOME_CLIENT' 2>&1"
|
||||||
max_wait=50
|
|
||||||
while true; do
|
|
||||||
set +e
|
|
||||||
client_reply=$(echo 'return 1' | DISPLAY=$D "$AWESOME_CLIENT" 2>&1)
|
|
||||||
ret=$?
|
|
||||||
set -e
|
|
||||||
if [ $ret = 0 ]; then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
max_wait=$(expr $max_wait - 1 || true)
|
|
||||||
if [ "$max_wait" -lt 0 ] || ! kill -0 $awesome_pid ; then
|
|
||||||
echo "Error: did not receive a successful reply via awesome-client!"
|
|
||||||
echo "Last reply: $client_reply."
|
|
||||||
echo "Log:"
|
|
||||||
cat "$awesome_log"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
sleep 0.1
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Count errors.
|
# Count errors.
|
||||||
|
@ -153,7 +153,7 @@ for f in $tests; do
|
||||||
cat $f | DISPLAY=$D "$AWESOME_CLIENT" 2>&1
|
cat $f | DISPLAY=$D "$AWESOME_CLIENT" 2>&1
|
||||||
|
|
||||||
# Tail the log and quit, when awesome quits.
|
# Tail the log and quit, when awesome quits.
|
||||||
tail -f --pid $awesome_pid $awesome_log
|
tail -n 100000 -f --pid $awesome_pid $awesome_log
|
||||||
|
|
||||||
if grep -q -E '^Error|assertion failed' $awesome_log; then
|
if grep -q -E '^Error|assertion failed' $awesome_log; then
|
||||||
echo "===> ERROR running $f! <==="
|
echo "===> ERROR running $f! <==="
|
||||||
|
|
Loading…
Reference in New Issue