2017-08-10 12:16:27 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Test all themes.
|
|
|
|
# This should be run via `make check-themes` (or manually from the build
|
|
|
|
# directory).
|
2019-01-11 17:04:23 +01:00
|
|
|
#
|
|
|
|
# It uses tests/run.sh internally, which handles coverage.
|
2017-08-10 12:16:27 +02:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2017-08-16 13:27:49 +02:00
|
|
|
if ! [ -f CMakeLists.txt ]; then
|
2017-08-20 22:53:51 +02:00
|
|
|
echo 'This should be run from the source directory (expected CMakeLists.txt).' >&2
|
|
|
|
exit 64
|
2017-08-10 12:16:27 +02:00
|
|
|
fi
|
2017-08-16 13:27:49 +02:00
|
|
|
source_dir="$PWD"
|
2017-08-10 12:16:27 +02:00
|
|
|
|
2017-08-20 22:53:22 +02:00
|
|
|
# Either the build dir is passed in $CMAKE_BINARY_DIR or we guess based on $PWD
|
|
|
|
# Same as in tests/run.sh.
|
|
|
|
build_dir="$CMAKE_BINARY_DIR"
|
|
|
|
if [ -z "$build_dir" ]; then
|
|
|
|
if [ -d "$source_dir/build" ]; then
|
|
|
|
build_dir="$source_dir/build"
|
|
|
|
else
|
|
|
|
build_dir="$source_dir"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2017-08-16 13:27:49 +02:00
|
|
|
config_file="$(mktemp)"
|
|
|
|
|
|
|
|
# Cleanup on errors / aborting.
|
|
|
|
cleanup() {
|
|
|
|
rm "$config_file" || true
|
|
|
|
}
|
|
|
|
trap "cleanup" 0 2 3 15
|
2017-08-10 12:16:27 +02:00
|
|
|
|
2017-08-13 12:06:12 +02:00
|
|
|
for theme_file in themes/*/theme.lua; do
|
2017-08-20 22:53:51 +02:00
|
|
|
echo "==== Testing theme: $theme_file ===="
|
|
|
|
theme_name=${theme_file%/*}
|
|
|
|
theme_name=${theme_name##*/}
|
2017-08-10 12:16:27 +02:00
|
|
|
|
2017-08-20 22:53:51 +02:00
|
|
|
sed "s~default/theme~$theme_name/theme~g" "awesomerc.lua" > "$config_file"
|
2017-08-10 12:16:27 +02:00
|
|
|
|
2017-08-20 22:53:51 +02:00
|
|
|
AWESOME_RC_FILE="$config_file" \
|
|
|
|
AWESOME_THEMES_PATH="$build_dir/themes" \
|
|
|
|
AWESOME_ICON_PATH="$PWD/icons" \
|
2017-11-18 01:52:48 +01:00
|
|
|
"$source_dir/tests/run.sh" "$source_dir/tests/themes/tests.lua"
|
2017-08-10 12:16:27 +02:00
|
|
|
done
|