diff --git a/CMakeLists.txt b/CMakeLists.txt index 523b0f7a1..84218c454 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -395,11 +395,10 @@ add_executable(test-gravity tests/test-gravity.c) target_link_libraries(test-gravity ${AWESOME_COMMON_REQUIRED_LDFLAGS} ${AWESOME_REQUIRED_LDFLAGS}) 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} COMMENT "Running integration tests" - USES_TERMINAL - VERBATIM) + USES_TERMINAL) add_dependencies(check-integration test-gravity) add_custom_target(check-themes ${CMAKE_SOURCE_DIR}/tests/themes/run.sh diff --git a/tests/run.sh b/tests/run.sh index 2a1266e7d..b9ee03752 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -15,8 +15,29 @@ set -e export SHELL=/bin/sh export HOME=/dev/null -VERBOSE=${VERBOSE-0} -if [ "$VERBOSE" = 1 ]; then +# Parse options. +usage() { + cat >&2 < 3s. while true; do set +e @@ -126,9 +145,7 @@ wait_until_success() { fi sleep 0.05 done - if [ "$VERBOSE" = 1 ]; then - set -x - fi + if [[ $verbose ]]; then set -x; fi } # Wait for DISPLAY to be available, and setup xrdb, @@ -242,9 +259,15 @@ for f in $tests; do esac # Parse any error from the log. - error="$(grep --color -o --binary-files=text -E \ - '.*[Ee]rror.*|.*assertion failed.*|^Step .* failed:' "$awesome_log" || - true)" + pattern='.*[Ee]rror.*|.*assertion failed.*|^Step .* failed:' + if [[ $fail_on_warning ]]; then + 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 color_red echo "===> ERROR running $f <===" diff --git a/tests/themes/run.sh b/tests/themes/run.sh index b49f82364..41a2a6b42 100755 --- a/tests/themes/run.sh +++ b/tests/themes/run.sh @@ -15,12 +15,12 @@ tests_dir="$(dirname -- "$0")/.." config_file="$build_dir/test-themes-awesomerc.lua" -for theme in themes/*/theme.lua; do - echo "== Testing $theme ==" - theme=${theme%/*} - theme=${theme##*/} +for theme_file in themes/*/theme.lua; do + echo "==== Testing theme: $theme_file ====" + theme_name=${theme_file%/*} + 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. CMAKE_BINARY_DIR="$PWD" \