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).
This commit is contained in:
Daniel Hahler 2017-07-09 22:29:51 +02:00 committed by GitHub
parent fc1ba35366
commit fb18a1d159
1 changed files with 8 additions and 6 deletions

View File

@ -91,9 +91,6 @@ 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
if [ -n "$DO_COVERAGE" ] && [ "$DO_COVERAGE" != 0 ]; then
mv "$RC_FILE.coverage.bak" "$RC_FILE"
fi
rm -rf "$tmp_files" || true rm -rf "$tmp_files" || true
} }
trap "cleanup" 0 2 3 15 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_THEMES_PATH="$source_dir/themes"
export AWESOME_ICON_PATH="$source_dir/icons" 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 if [ -n "$DO_COVERAGE" ] && [ "$DO_COVERAGE" != 0 ]; then
cp -a "$RC_FILE" "$RC_FILE.coverage.bak" # Handle old filename of config files (useful for git-bisect).
sed -i "1 s~^~require('luacov.runner')('$source_dir/.luacov'); \0~" "$RC_FILE" 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 fi
# Start awesome. # Start awesome.