From 98e762e5f72c32b286428de4b341da811076638c Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Thu, 24 Aug 2017 22:53:27 +0200 Subject: [PATCH 1/7] fix(tests: menubar): ignore warning about opening applications dir in /dev/null --- tests/test-menubar.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test-menubar.lua b/tests/test-menubar.lua index 6c31c353..0eb5d43e 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 From 960f59b228574131b448a063fef539159104bd08 Mon Sep 17 00:00:00 2001 From: actionless Date: Mon, 21 Aug 2017 14:22:50 +0200 Subject: [PATCH 2/7] fix(menubar: utils: parse_dir): print warning instead of error if directory can't be opened --- lib/menubar/utils.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/menubar/utils.lua b/lib/menubar/utils.lua index 293d6c11..e89a0c18 100644 --- a/lib/menubar/utils.lua +++ b/lib/menubar/utils.lua @@ -290,14 +290,14 @@ function utils.parse_dir(dir_path, callback) 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(dir_path .. ": " .. 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_warning(dir_path .. ": " .. tostring(enum_err)) return end for _, info in ipairs(list) do From 0a75f09d1d5ccbd39a9dcebf33acfa6be60e5501 Mon Sep 17 00:00:00 2001 From: actionless Date: Mon, 21 Aug 2017 15:12:38 +0200 Subject: [PATCH 3/7] fix(menubar: utils: parse_dir): print to log the current failed directory instead of the root one --- lib/menubar/utils.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/menubar/utils.lua b/lib/menubar/utils.lua index e89a0c18..5f1a7766 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_warning(dir_path .. ": " .. tostring(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_warning(dir_path .. ": " .. tostring(enum_err)) + gdebug.print_error(get_readable_path(file) .. ": " .. tostring(enum_err)) return end for _, info in ipairs(list) do From e1da4b030f2bb49366e6175809da292fd427aba0 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 20 Aug 2017 22:53:22 +0200 Subject: [PATCH 4/7] tests/themes/run.sh: use themes from build dir --- tests/themes/run.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/themes/run.sh b/tests/themes/run.sh index 21c7d1db..788403f9 100755 --- a/tests/themes/run.sh +++ b/tests/themes/run.sh @@ -12,6 +12,17 @@ if ! [ -f CMakeLists.txt ]; then 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. @@ -28,7 +39,7 @@ for theme_file in themes/*/theme.lua; do sed "s~default/theme~$theme_name/theme~g" "awesomerc.lua" > "$config_file" AWESOME_RC_FILE="$config_file" \ - AWESOME_THEMES_PATH="$source_dir/themes" \ + AWESOME_THEMES_PATH="$build_dir/themes" \ AWESOME_ICON_PATH="$PWD/icons" \ "$source_dir/tests/run.sh" themes/tests.lua done From 6e53143401da1a693ec1ff8500f55f6ecfc6ed14 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 20 Aug 2017 22:53:51 +0200 Subject: [PATCH 5/7] tests/themes/run.sh: whitespace: sw=4 --- tests/themes/run.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/themes/run.sh b/tests/themes/run.sh index 788403f9..8d5a1f2c 100755 --- a/tests/themes/run.sh +++ b/tests/themes/run.sh @@ -7,8 +7,8 @@ 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" @@ -32,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="$build_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 From 162cf1854c8054ed44d20da51397c26eb6811f88 Mon Sep 17 00:00:00 2001 From: actionless Date: Sat, 19 Aug 2017 23:24:53 +0200 Subject: [PATCH 6/7] fix(tests: run.sh): add one more error log pattern --- tests/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run.sh b/tests/run.sh index 57fd162c..442ce176 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: .*' if [[ $fail_on_warning ]]; then pattern+='|^.{19} W: awesome:.*' fi From 596b7443e74ce231161db0702d9e37c1b5efa744 Mon Sep 17 00:00:00 2001 From: actionless Date: Mon, 21 Aug 2017 14:51:25 +0200 Subject: [PATCH 7/7] feat(tests: run.sh): treat luaA_panic as an error --- tests/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run.sh b/tests/run.sh index 442ce176..e4700ac9 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:|^.{19} E: awesome: .*' + pattern='.*[Ee]rror.*|.*assertion failed.*|^Step .* failed:|^.{19} E: awesome: .*|.*luaA_panic.*' if [[ $fail_on_warning ]]; then pattern+='|^.{19} W: awesome:.*' fi