From fb18a1d1595f84786aa876cf316852fbd162de9b Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 9 Jul 2017 22:29:51 +0200 Subject: [PATCH] tests/run.sh: use temporary RC_FILE again (#1910) This was changed in ec9a981d for no good reason, and using a temporary file removes the requirement to restore it on exit. And it is necessary in case the original file is not writable (e.g. in case of a read-only Docker mount). --- tests/run.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/run.sh b/tests/run.sh index fe902978c..138c1291d 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -91,9 +91,6 @@ cleanup() { for p in $awesome_pid $xserver_pid; do kill -TERM "$p" 2>/dev/null || true done - if [ -n "$DO_COVERAGE" ] && [ "$DO_COVERAGE" != 0 ]; then - mv "$RC_FILE.coverage.bak" "$RC_FILE" - fi rm -rf "$tmp_files" || true } trap "cleanup" 0 2 3 15 @@ -168,10 +165,15 @@ RC_FILE=${source_dir}/awesomerc.lua export AWESOME_THEMES_PATH="$source_dir/themes" export AWESOME_ICON_PATH="$source_dir/icons" -# Inject coverage runner to RC file, which will be restored on exit/cleanup. +# Inject coverage runner via temporary RC file. if [ -n "$DO_COVERAGE" ] && [ "$DO_COVERAGE" != 0 ]; then - cp -a "$RC_FILE" "$RC_FILE.coverage.bak" - sed -i "1 s~^~require('luacov.runner')('$source_dir/.luacov'); \0~" "$RC_FILE" + # Handle old filename of config files (useful for git-bisect). + if [ -f "${RC_FILE}.in" ]; then + RC_FILE="${RC_FILE}.in" + fi + sed "1 s~^~require('luacov.runner')('$source_dir/.luacov'); \0~" \ + "$RC_FILE" > "$tmp_files/awesomerc.lua" + RC_FILE=$tmp_files/awesomerc.lua fi # Start awesome.