Merge pull request #1973 from blueyed/tests-error-on-warnings

Tests: check-integration: error on warnings
This commit is contained in:
Daniel Hahler 2017-08-15 17:59:30 +02:00 committed by GitHub
commit e9adb28af6
3 changed files with 41 additions and 19 deletions

View file

@ -395,11 +395,10 @@ add_executable(test-gravity tests/test-gravity.c)
target_link_libraries(test-gravity target_link_libraries(test-gravity
${AWESOME_COMMON_REQUIRED_LDFLAGS} ${AWESOME_REQUIRED_LDFLAGS}) ${AWESOME_COMMON_REQUIRED_LDFLAGS} ${AWESOME_REQUIRED_LDFLAGS})
add_custom_target(check-integration add_custom_target(check-integration
sh -c "CMAKE_BINARY_DIR='${CMAKE_BINARY_DIR}' ${CMAKE_SOURCE_DIR}/tests/run.sh" ${CMAKE_COMMAND} -E env CMAKE_BINARY_DIR='${CMAKE_BINARY_DIR}' ./tests/run.sh \$\${TEST_RUN_ARGS:--W}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMENT "Running integration tests" COMMENT "Running integration tests"
USES_TERMINAL USES_TERMINAL)
VERBATIM)
add_dependencies(check-integration test-gravity) add_dependencies(check-integration test-gravity)
add_custom_target(check-themes add_custom_target(check-themes
${CMAKE_SOURCE_DIR}/tests/themes/run.sh ${CMAKE_SOURCE_DIR}/tests/themes/run.sh

View file

@ -15,8 +15,29 @@ set -e
export SHELL=/bin/sh export SHELL=/bin/sh
export HOME=/dev/null export HOME=/dev/null
VERBOSE=${VERBOSE-0} # Parse options.
if [ "$VERBOSE" = 1 ]; then usage() {
cat >&2 <<EOF
Usage: $0 [-W] [testfile]...
-v: verbose mode
-W: warnings become errors
-h: show this help
EOF
exit "$1"
}
fail_on_warning=
verbose=${VERBOSE:-0}
while getopts vWh opt; do
case $opt in
v) verbose=1 ;;
W) fail_on_warning=1 ;;
h) usage 0 ;;
*) usage 64 ;;
esac
done
shift $((OPTIND-1))
if [[ $verbose ]]; then
set -x set -x
fi fi
@ -101,9 +122,7 @@ awesome_log=$tmp_files/_awesome_test.log
echo "awesome_log: $awesome_log" echo "awesome_log: $awesome_log"
wait_until_success() { wait_until_success() {
if [ "$VERBOSE" = 1 ]; then if [[ $verbose ]]; then set +x; fi
set +x
fi
wait_count=60 # 60*0.05s => 3s. wait_count=60 # 60*0.05s => 3s.
while true; do while true; do
set +e set +e
@ -126,9 +145,7 @@ wait_until_success() {
fi fi
sleep 0.05 sleep 0.05
done done
if [ "$VERBOSE" = 1 ]; then if [[ $verbose ]]; then set -x; fi
set -x
fi
} }
# Wait for DISPLAY to be available, and setup xrdb, # Wait for DISPLAY to be available, and setup xrdb,
@ -242,9 +259,15 @@ for f in $tests; do
esac esac
# Parse any error from the log. # Parse any error from the log.
error="$(grep --color -o --binary-files=text -E \ pattern='.*[Ee]rror.*|.*assertion failed.*|^Step .* failed:'
'.*[Ee]rror.*|.*assertion failed.*|^Step .* failed:' "$awesome_log" || if [[ $fail_on_warning ]]; then
true)" pattern+='|^.{19} W: awesome:.*'
fi
error="$(grep --color -o --binary-files=text -E "$pattern" "$awesome_log" || true)"
if [[ $fail_on_warning ]]; then
# Filter out ignored warnings.
error="$(echo "$error" | grep -vE '.{19} W: awesome: (a_glib_poll|Cannot reliably detect EOF)' || true)"
fi
if [[ -n "$error" ]]; then if [[ -n "$error" ]]; then
color_red color_red
echo "===> ERROR running $f <===" echo "===> ERROR running $f <==="

View file

@ -15,12 +15,12 @@ tests_dir="$(dirname -- "$0")/.."
config_file="$build_dir/test-themes-awesomerc.lua" config_file="$build_dir/test-themes-awesomerc.lua"
for theme in themes/*/theme.lua; do for theme_file in themes/*/theme.lua; do
echo "== Testing $theme ==" echo "==== Testing theme: $theme_file ===="
theme=${theme%/*} theme_name=${theme_file%/*}
theme=${theme##*/} theme_name=${theme_name##*/}
sed "s~default/theme~$theme/theme~g" "awesomerc.lua" > "$config_file" sed "s~default/theme~$theme_name/theme~g" "awesomerc.lua" > "$config_file"
# Set CMAKE_BINARY_DIR for out-of-tree builds. # Set CMAKE_BINARY_DIR for out-of-tree builds.
CMAKE_BINARY_DIR="$PWD" \ CMAKE_BINARY_DIR="$PWD" \