Merge pull request #1376 from Elv13/disable_wibox_in_tests

tests: Add a very dirty hack to break wibox for multiscreen tests
This commit is contained in:
Emmanuel Lepage Vallée 2017-02-07 11:38:33 -05:00 committed by GitHub
commit fe4d6404a6
3 changed files with 31 additions and 2 deletions

View File

@ -517,6 +517,29 @@ local function add_steps(real_steps, new_steps)
end
end
-- This is a very ugly hack to speed up the test. Luacov get exponentially
-- slower / more memory hungry when it has more work to do in a single test.
-- A lot of that work is building wibars and widgets for those screen. This
-- has value when tried once (already covered by the test-screen-changes suit),
-- but not done 180 times in a row. This code monkey-patch `wibox` with the
-- intent of breaking it without causing errors. This way it stops doing too
-- many things (resulting in a faster luacov execution)
function module.disable_wibox()
local awful = require("awful")
setmetatable(wibox, {
__call = function() return {
geometry = function()
return{x=0, y=0, width=0, height=0}
end,
set_widget = function() end,
setup = function() return {} end
}
end })
awful.wibar = wibox
end
return setmetatable(module, {
__call = function(_,...) return add_steps(...) end
})

View File

@ -146,6 +146,8 @@ table.insert(steps, function()
return true
end)
local multi_screen_steps = {}
-- Add a test client on each screen.
@ -321,7 +323,9 @@ table.insert(multi_screen_steps, function()
return true
end)
require("_multi_screen")(steps, multi_screen_steps)
local ms = require("_multi_screen")
ms.disable_wibox()
ms(steps, multi_screen_steps)
require("_runner").run_steps(steps)

View File

@ -239,7 +239,9 @@ table.insert(multi_screen_steps, function()
return true
end)
require("_multi_screen")(steps, multi_screen_steps)
local ms = require("_multi_screen")
ms.disable_wibox()
ms(steps, multi_screen_steps)
require("_runner").run_steps(steps)