From f070c4e060ae686adfc8c6fa78181d1d940a6184 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Tue, 21 Jul 2015 13:09:07 +0200 Subject: [PATCH] tests: wait until DISPLAY is ready; xrdb might complain/abort --- tests/run.sh | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/tests/run.sh b/tests/run.sh index 5ed9f7ba3..d0437f371 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -79,14 +79,35 @@ set_trap() { } set_trap +# Wait for DISPLAY to be available, and setup xrdb, +# for awesome's xresources backend / queries. +max_wait=60 +while true; do + set +e + reply="$(echo "Xft.dpi: 96" | DISPLAY="$D" xrdb 2>&1)" + ret=$? + set -e + if [ $ret = 0 ]; then + break + fi + max_wait=$(expr $max_wait - 1) + if [ "$max_wait" -lt 0 ]; then + echo "Error: failed to setup xrdb!" + echo "Last reply: $reply." + echo "Log:" + cat "$awesome_log" + exit 1 + fi + sleep 0.05 +done + + AWESOME_CLIENT="$root_dir/utils/awesome-client" # Start awesome. start_awesome() { export DISPLAY="$D" cd $root_dir/build - # Setup xrdb, for awesome's xresources backend / queries. - echo "Xft.dpi: 96" | DISPLAY="$D" xrdb DISPLAY="$D" "$AWESOME" -c "$RC_FILE" $AWESOME_OPTIONS > $awesome_log 2>&1 & awesome_pid=$! cd - >/dev/null