tests: Break wibox for multiscreen tests (on purpose)

This commit add an option to shim the whole wibox module when
running multi-screen tests. This is intended to lower the test
runtime when coverage is enabled.

In theory, most of that code is already covered by the
test-screen-changes suit.

This makes the coverage builds about twice as fast. This is
necessary because there is a large number of timeouts due to
limited resources on the Travis build system.
This commit is contained in:
Emmanuel Lepage Vallee 2017-01-10 00:11:43 -05:00
parent c1cd968803
commit 83e176fa32
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
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, { return setmetatable(module, {
__call = function(_,...) return add_steps(...) end __call = function(_,...) return add_steps(...) end
}) })

View File

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

View File

@ -239,7 +239,9 @@ table.insert(multi_screen_steps, function()
return true return true
end) 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) require("_runner").run_steps(steps)