From 8e221522f717f664bdf9d9298c7fa2c3a492b1f2 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Tue, 31 May 2016 23:46:23 +0200 Subject: [PATCH 1/2] Travis: kill awesome after max. 60s per test file This is required for when the test setup fails already, e.g. because of an assertion error at the top of a test file. --- tests/run.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/run.sh b/tests/run.sh index bb52bdf27..e0936635e 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -189,6 +189,8 @@ start_awesome() { # Count errors. errors=0 +# Seconds after when awesome gets killed. +timeout_stale=60 for f in $tests; do echo "== Running $f ==" @@ -204,6 +206,13 @@ for f in $tests; do # Send the test file to awesome. cat $f | DISPLAY=$D "$AWESOME_CLIENT" 2>&1 + # Kill awesome after 1 minute (e.g. with errors during test setup). + (sleep $timeout_stale + if [ "$(ps -o comm= $awesome_pid)" = "${AWESOME##*/}" ]; then + echo "Killing (stale?!) awesome (PID $awesome_pid) after $timeout_stale seconds." + kill $awesome_pid + fi) & + # Tail the log and quit, when awesome quits. tail -n 100000 -f --pid $awesome_pid $awesome_log From eaa80fef9a8de522f9b907b6e00101166b2db92a Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Tue, 31 May 2016 23:48:50 +0200 Subject: [PATCH 2/2] tests/run: clarify timeout in wait_until_success Ref: https://github.com/awesomeWM/awesome/pull/937#discussion-diff-65313945 --- tests/run.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/run.sh b/tests/run.sh index e0936635e..21909e1cb 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -103,7 +103,7 @@ wait_until_success() { if [ "$CI" = true ]; then set +x fi - max_wait=60 + wait_count=60 # 60*0.05s => 3s. while true; do set +e eval reply="\$($2)" @@ -112,8 +112,8 @@ wait_until_success() { if [ $ret = 0 ]; then break fi - max_wait=$(expr $max_wait - 1 || true) - if [ "$max_wait" -lt 0 ]; then + wait_count=$(expr $wait_count - 1 || true) + if [ "$wait_count" -lt 0 ]; then echo "Error: failed to $1!" echo "Last reply: $reply." if [ -f "$awesome_log" ]; then