diff --git a/tests/_multi_screen.lua b/tests/_multi_screen.lua index bc42b175..ddd578e5 100644 --- a/tests/_multi_screen.lua +++ b/tests/_multi_screen.lua @@ -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 }) diff --git a/tests/test-awful-client.lua b/tests/test-awful-client.lua index 3cec2a0a..70d7e040 100644 --- a/tests/test-awful-client.lua +++ b/tests/test-awful-client.lua @@ -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) diff --git a/tests/test-awful-tag.lua b/tests/test-awful-tag.lua index 727359d0..9b99a91d 100644 --- a/tests/test-awful-tag.lua +++ b/tests/test-awful-tag.lua @@ -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)