Merge pull request #1345 from psychon/test-runner-speed2

Test runner speedup
This commit is contained in:
Daniel Hahler 2017-01-03 02:13:44 +01:00 committed by GitHub
commit 9d69825766
8 changed files with 120 additions and 79 deletions

13
luaa.c
View File

@ -54,6 +54,7 @@
#include <basedir_fs.h>
#include <xcb/xcb_atom.h>
#include <xcb/xcb_aux.h>
#include <unistd.h> /* for gethostname() */
@ -214,6 +215,17 @@ luaA_kill(lua_State *L)
return 1;
}
/** Synchronize with the X11 server. This is needed in the test suite to avoid
* some race conditions. You should never need to use this function.
* @function sync
*/
static int
luaA_sync(lua_State *L)
{
xcb_aux_sync(globalconf.connection);
return 0;
}
/** Load an image from a given path.
*
* @param name The file name.
@ -647,6 +659,7 @@ luaA_init(xdgHandle* xdg, string_array_t *searchpath)
{ "xkb_get_group_names", luaA_xkb_get_group_names},
{ "xrdb_get_value", luaA_xrdb_get_value},
{ "kill", luaA_kill},
{ "sync", luaA_sync},
{ NULL, NULL }
};

View File

@ -32,7 +32,7 @@ end)
runner.run_steps = function(steps)
-- Setup timer/timeout to limit waiting for signal and quitting awesome.
-- This would be common for all tests.
local t = timer({timeout=0.1})
local t = timer({timeout=0})
local wait=20
local step=1
local step_count=0
@ -64,6 +64,7 @@ runner.run_steps = function(steps)
step = step+1
step_count = 0
wait = 5
t.timeout = 0
t:again()
return
end
@ -78,6 +79,7 @@ runner.run_steps = function(steps)
else
wait = wait-1
if wait > 0 then
t.timeout = 0.1
t:again()
else
io.stderr:write("Error: timeout waiting for signal in step "

View File

@ -228,7 +228,7 @@ for f in $tests; do
grep -q -E '[Ee]rror|assertion failed' "$awesome_log"; then
echo "===> ERROR running $f <==="
grep --color -o --binary-files=text -E '.*[Ee]rror.*|.*assertion failed.*' "$awesome_log" || true
((errors++))
((++errors))
fi
done

View File

@ -58,6 +58,7 @@ local steps = {
assert(not old_c.ontop)
get_callback({modkey}, "t")()
awesome.sync()
return true
end,
@ -75,6 +76,7 @@ local steps = {
assert(t.master_width_factor == 0.5)
get_callback({modkey}, "l")()
awesome.sync()
return true
end,
@ -89,6 +91,7 @@ local steps = {
assert(t.master_count == 1)
get_callback({modkey, "Shift"}, "h")()
awesome.sync()
return true
end,
@ -104,6 +107,7 @@ local steps = {
get_callback({modkey, "Control"}, "h")()
get_callback({modkey, "Shift" }, "l")()
awesome.sync()
return true
end,
@ -118,6 +122,7 @@ local steps = {
assert(t.index == 1)
get_callback({modkey, }, "Right")()
awesome.sync()
return true
end,

View File

@ -214,7 +214,12 @@ table.insert(multi_screen_steps, function()
for _, c in ipairs(client.get()) do
c:kill()
end
if #client.get() == 0 then
return true
end
end)
table.insert(multi_screen_steps, function()
for i=1, screen.count() do
local s = screen[i]
test_client("screen"..i, nil, {
@ -240,6 +245,16 @@ end
for _, c in ipairs(client.get()) do
c:kill()
end
return true
end)
table.insert(multi_screen_steps, function()
if #client.get() == 0 then
return true
end
end)
table.insert(multi_screen_steps, function()
if screen.count() < 2 then return true end

View File

@ -82,6 +82,7 @@ table.insert(steps, function()
awful.placement.centered(mouse)
root.fake_input("button_press", 1)
awesome.sync()
return true
end)
@ -94,10 +95,11 @@ end)
-- Test a button release
table.insert(steps, function()
root.fake_input("button_release", 1)
assert(button._private.image ~= img)
root.fake_input("button_release", 1)
awesome.sync()
return true
end)
@ -106,6 +108,7 @@ table.insert(steps, function()
assert(button._private.image == img)
root.fake_input("button_press", 1)
awesome.sync()
return true
end)
@ -123,6 +126,7 @@ assert(button._private.image ~= img)
-- test if the button is released when the mouse move out
awful.placement.right(mouse--[[, {parent = w}]])
root.fake_input("button_release", 1)
awesome.sync()
return true
end)

View File

@ -63,10 +63,12 @@ local steps = {
y = 0,
width = 100,
height = 100
}}
}
}
}
-- Wait for the previous c:kill() to be done
if #client.get() == 0 then
return true
end
end,
function(count)
if count == 1 then

View File

@ -62,7 +62,7 @@ local steps = {
-- Wait for one iteration so that gears.timer handles other delayed
-- calls (= the tasklist updates)
second_call = true
else
elseif #client.get() == 0 then
assert(#objs == 1)
-- Test that we have a client and that it's invalid (tostring()