tests/themes/run.sh: use themes from source dir (#1994)

This makes it easier to track their coverage.
This commit is contained in:
Daniel Hahler 2017-08-16 13:27:49 +02:00 committed by GitHub
parent cdaf0dd294
commit ef04fa688e
2 changed files with 15 additions and 13 deletions

View File

@ -401,12 +401,11 @@ add_custom_target(check-integration
USES_TERMINAL)
add_dependencies(check-integration test-gravity)
add_custom_target(check-themes
${CMAKE_SOURCE_DIR}/tests/themes/run.sh
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
${CMAKE_COMMAND} -E env CMAKE_BINARY_DIR='${CMAKE_BINARY_DIR}' ./tests/themes/run.sh
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Testing themes"
USES_TERMINAL
DEPENDS generated_icons generate_awesomerc ${PROJECT_AWE_NAME}
VERBATIM)
DEPENDS generated_icons generate_awesomerc ${PROJECT_AWE_NAME})
list(APPEND CHECK_TARGETS check-themes)
add_custom_target(check-requires

View File

@ -6,14 +6,19 @@
set -e
if ! [ -f CMakeCache.txt ]; then
echo 'This should be run from the build directory (expected CMakeCache.txt).' >&2
if ! [ -f CMakeLists.txt ]; then
echo 'This should be run from the source directory (expected CMakeLists.txt).' >&2
exit 64
fi
build_dir="$PWD"
tests_dir="$(dirname -- "$0")/.."
source_dir="$PWD"
config_file="$build_dir/test-themes-awesomerc.lua"
config_file="$(mktemp)"
# Cleanup on errors / aborting.
cleanup() {
rm "$config_file" || true
}
trap "cleanup" 0 2 3 15
for theme_file in themes/*/theme.lua; do
echo "==== Testing theme: $theme_file ===="
@ -22,10 +27,8 @@ for theme_file in themes/*/theme.lua; do
sed "s~default/theme~$theme_name/theme~g" "awesomerc.lua" > "$config_file"
# Set CMAKE_BINARY_DIR for out-of-tree builds.
CMAKE_BINARY_DIR="$PWD" \
AWESOME_RC_FILE="$config_file" \
AWESOME_THEMES_PATH="$PWD/themes" \
AWESOME_THEMES_PATH="$source_dir/themes" \
AWESOME_ICON_PATH="$PWD/icons" \
"$tests_dir/run.sh" themes/tests.lua
"$source_dir/tests/run.sh" themes/tests.lua
done