Silence warnings in examples (#944)
There was a problem that the examples were considered to have failed as soon as
they produced any kind of output, but there were legitimate cases of warnings
being printed that triggered these checks. Commit 4819be4f4f
used a
regular expression to detect and ignore this warnings.
This commit reverts the above commit and instead silences the warnings by
monkey-patching the function that prints the warnings into a no-op.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
efb8e65b15
commit
ffe64727fe
|
@ -106,32 +106,6 @@ function(escape_code path escaped_content pre_header post_header)
|
|||
set(${post_header} ${example_post_header} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Only gears.debug.print_warning are allowed on stderr, everything else will
|
||||
# trigger a build failure to catch regressions and problem early.
|
||||
function(check_for_problems stderr result)
|
||||
|
||||
# If there is nothing to check, return
|
||||
if (TEST_ERROR STREQUAL "")
|
||||
set(${result} 0 PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
string(REGEX REPLACE "\n" ";" error_lines "${stderr}")
|
||||
|
||||
foreach (LINE ${error_lines})
|
||||
|
||||
# gears.debug.print_warning lines look like:
|
||||
# yyyy-mm-dd hh:mm:ss W: message content
|
||||
if (NOT ${LINE} MATCHES "^[0-9 :-]+ W:")
|
||||
set(${result} 1 PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
endforeach()
|
||||
|
||||
set(${result} 0 PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Execute a lua file.
|
||||
function(run_test test_path namespace template escaped_content)
|
||||
|
||||
|
@ -159,8 +133,7 @@ function(run_test test_path namespace template escaped_content)
|
|||
)
|
||||
|
||||
# If there is something on stderr, exit
|
||||
check_for_problems("${TEST_ERROR}" problems_found)
|
||||
if (${problems_found})
|
||||
if (NOT TEST_ERROR STREQUAL "")
|
||||
message("${TEST_OUTPUT}")
|
||||
message("${TEST_ERROR}")
|
||||
message(FATAL_ERROR ${test_path} " A test failed, bye")
|
||||
|
|
|
@ -22,6 +22,9 @@ pcall(function()
|
|||
require("luacov.runner")(luacovpath)
|
||||
end)
|
||||
|
||||
-- Silence debug warnings
|
||||
require("gears.debug").print_warning = function() end
|
||||
|
||||
local color = require( "gears.color" )
|
||||
local shape = require( "gears.shape" )
|
||||
local beautiful = require( "beautiful" )
|
||||
|
|
|
@ -10,6 +10,9 @@ pcall(function()
|
|||
require("luacov.runner")(luacovpath)
|
||||
end)
|
||||
|
||||
-- Silence debug warnings
|
||||
require("gears.debug").print_warning = function() end
|
||||
|
||||
local function get_surface(p)
|
||||
local img = cairo.SvgSurface.create(p, 288, 76)
|
||||
return cairo.Context(img)
|
||||
|
|
|
@ -15,5 +15,8 @@ pcall(function()
|
|||
require("luacov.runner")(luacovpath)
|
||||
end)
|
||||
|
||||
-- Silence debug warnings
|
||||
require("gears.debug").print_warning = function() end
|
||||
|
||||
-- Execute the test
|
||||
loadfile(file_path)()
|
||||
|
|
|
@ -21,6 +21,9 @@ pcall(function()
|
|||
require("luacov.runner")(luacovpath)
|
||||
end)
|
||||
|
||||
-- Silence debug warnings
|
||||
require("gears.debug").print_warning = function() end
|
||||
|
||||
-- Let the test request a size and file format
|
||||
local before, after = loadfile(file_path)()
|
||||
|
||||
|
|
|
@ -21,6 +21,9 @@ pcall(function()
|
|||
require("luacov.runner")(luacovpath)
|
||||
end)
|
||||
|
||||
-- Silence debug warnings
|
||||
require("gears.debug").print_warning = function() end
|
||||
|
||||
-- Create a generic rectangle widget to show layout disposition
|
||||
local function generic_widget(text)
|
||||
return {
|
||||
|
|
|
@ -19,6 +19,9 @@ pcall(function()
|
|||
require("luacov.runner")(luacovpath)
|
||||
end)
|
||||
|
||||
-- Silence debug warnings
|
||||
require("gears.debug").print_warning = function() end
|
||||
|
||||
-- This is the main widget the tests will use as top level
|
||||
local container = wibox.layout.fixed.vertical()
|
||||
|
||||
|
|
Loading…
Reference in New Issue