diff --git a/lib/menubar/utils.lua b/lib/menubar/utils.lua index 293d6c117..5f1a77661 100644 --- a/lib/menubar/utils.lua +++ b/lib/menubar/utils.lua @@ -285,19 +285,23 @@ end -- @tparam table callback.programs Paths of found .desktop files. function utils.parse_dir(dir_path, callback) + local function get_readable_path(file) + return file:get_path() or file:get_uri() + end + local function parser(file, programs) -- Except for "NONE" there is also NOFOLLOW_SYMLINKS local query = gio.FILE_ATTRIBUTE_STANDARD_NAME .. "," .. gio.FILE_ATTRIBUTE_STANDARD_TYPE local enum, err = file:async_enumerate_children(query, gio.FileQueryInfoFlags.NONE) if not enum then - gdebug.print_error(err) + gdebug.print_warning(get_readable_path(file) .. ": " .. tostring(err)) return end local files_per_call = 100 -- Actual value is not that important while true do local list, enum_err = enum:async_next_files(files_per_call) if enum_err then - gdebug.print_error(enum_err) + gdebug.print_error(get_readable_path(file) .. ": " .. tostring(enum_err)) return end for _, info in ipairs(list) do diff --git a/tests/run.sh b/tests/run.sh index 57fd162cf..e4700ac9d 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -261,7 +261,7 @@ for f in $tests; do esac # Parse any error from the log. - pattern='.*[Ee]rror.*|.*assertion failed.*|^Step .* failed:' + pattern='.*[Ee]rror.*|.*assertion failed.*|^Step .* failed:|^.{19} E: awesome: .*|.*luaA_panic.*' if [[ $fail_on_warning ]]; then pattern+='|^.{19} W: awesome:.*' fi diff --git a/tests/test-menubar.lua b/tests/test-menubar.lua index 6c31c3535..0eb5d43e3 100644 --- a/tests/test-menubar.lua +++ b/tests/test-menubar.lua @@ -27,12 +27,12 @@ end -- word "error" appears in our output, the test is considered to have failed. do local gdebug = require("gears.debug") - local orig_error = gdebug.print_error - function gdebug.print_error(msg) + local orig_warning = gdebug.print_warning + function gdebug.print_warning(msg) msg = tostring(msg) - if (msg ~= "Error opening directory '/dev/null/.local/share/applications': Not a directory") and + if (not msg:match("/dev/null/.local/share/applications")) and (not msg:match("No such file or directory")) then - orig_error(msg) + orig_warning(msg) end end end diff --git a/tests/themes/run.sh b/tests/themes/run.sh index 21c7d1dbf..8d5a1f2c5 100755 --- a/tests/themes/run.sh +++ b/tests/themes/run.sh @@ -7,11 +7,22 @@ set -e if ! [ -f CMakeLists.txt ]; then - echo 'This should be run from the source directory (expected CMakeLists.txt).' >&2 - exit 64 + echo 'This should be run from the source directory (expected CMakeLists.txt).' >&2 + exit 64 fi source_dir="$PWD" +# 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 + config_file="$(mktemp)" # Cleanup on errors / aborting. @@ -21,14 +32,14 @@ cleanup() { trap "cleanup" 0 2 3 15 for theme_file in themes/*/theme.lua; do - echo "==== Testing theme: $theme_file ====" - theme_name=${theme_file%/*} - theme_name=${theme_name##*/} + echo "==== Testing theme: $theme_file ====" + theme_name=${theme_file%/*} + theme_name=${theme_name##*/} - sed "s~default/theme~$theme_name/theme~g" "awesomerc.lua" > "$config_file" + sed "s~default/theme~$theme_name/theme~g" "awesomerc.lua" > "$config_file" - AWESOME_RC_FILE="$config_file" \ - AWESOME_THEMES_PATH="$source_dir/themes" \ - AWESOME_ICON_PATH="$PWD/icons" \ - "$source_dir/tests/run.sh" themes/tests.lua + AWESOME_RC_FILE="$config_file" \ + AWESOME_THEMES_PATH="$build_dir/themes" \ + AWESOME_ICON_PATH="$PWD/icons" \ + "$source_dir/tests/run.sh" themes/tests.lua done