tests: move coverage setup into tests/run.sh

This allows for `DO_COVERAGE=1 make check` with local tests (where
`CI=true` is not given).
It uses the new environment variables to configure the default theme,
instead of creating a temporary config/theme.
This commit is contained in:
Daniel Hahler 2017-01-05 01:06:49 +01:00
parent 83a118e421
commit ec9a981dd7
2 changed files with 11 additions and 15 deletions

View File

@ -168,7 +168,6 @@ script:
(make check-unit-coverage \ (make check-unit-coverage \
&& do_codecov unittests \ && do_codecov unittests \
&& sed -i "1 s~^~require('luacov.runner')('$PWD/.luacov'); \0~" build/awesomerc.lua \
&& tests/run.sh \ && tests/run.sh \
&& do_codecov functionaltests) && do_codecov functionaltests)
ret=$? ret=$?

View File

@ -59,7 +59,6 @@ if ! [ -x "$AWESOME" ]; then
echo "$AWESOME is not executable." >&2 echo "$AWESOME is not executable." >&2
exit 1 exit 1
fi fi
RC_FILE=$build_dir/awesomerc.lua
AWESOME_CLIENT="$source_dir/utils/awesome-client" AWESOME_CLIENT="$source_dir/utils/awesome-client"
D=:5 D=:5
SIZE="${TESTS_SCREEN_SIZE:-1024x768}" SIZE="${TESTS_SCREEN_SIZE:-1024x768}"
@ -90,6 +89,9 @@ 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
@ -160,19 +162,14 @@ wait_until_success "setup xrdb" "printf 'Xft.dpi: 96
# Use a separate D-Bus session; sets $DBUS_SESSION_BUS_PID. # Use a separate D-Bus session; sets $DBUS_SESSION_BUS_PID.
eval "$(DISPLAY="$D" dbus-launch --sh-syntax --exit-with-session)" eval "$(DISPLAY="$D" dbus-launch --sh-syntax --exit-with-session)"
# Not in Travis? RC_FILE=${source_dir}/awesomerc.lua
if [ "$CI" != true ]; then export AWESOME_THEMES_PATH="$source_dir/themes"
# Prepare a config file pointing to a working theme export AWESOME_ICON_PATH="$source_dir/icons"
# Handle old filename of config files (useful for git-bisect).
if [ -f "$source_dir/awesomerc.lua.in" ]; then # Inject coverage runner to RC file, which will be restored on exit/cleanup.
SED_IN=.in if [ -n "$DO_COVERAGE" ] && [ "$DO_COVERAGE" != 0 ]; then
fi cp -a "$RC_FILE" "$RC_FILE.coverage.bak"
RC_FILE=$tmp_files/awesomerc.lua sed -i "1 s~^~require('luacov.runner')('$source_dir/.luacov'); \0~" "$RC_FILE"
THEME_FILE=$tmp_files/theme.lua
sed -e "s:.*beautiful.init(.*default/theme.lua.*:beautiful.init('$THEME_FILE'):" "$source_dir/awesomerc.lua$SED_IN" > "$RC_FILE"
sed -e "s:@AWESOME_THEMES_PATH@/default/titlebar:$build_dir/themes/default/titlebar:" \
-e "s:@AWESOME_THEMES_PATH@:$source_dir/themes/:" \
-e "s:@AWESOME_ICON_PATH@:$source_dir/icons:" "$source_dir/themes/default/theme.lua$SED_IN" > "$THEME_FILE"
fi fi
# Start awesome. # Start awesome.