tests: Kill the test-selection-getter clients.

This removes a confusing warning in the CI logs.
This commit is contained in:
Emmanuel Lepage Vallee 2021-10-27 19:38:21 -07:00
parent bb65181e61
commit 4f645fd07f
2 changed files with 35 additions and 6 deletions

View File

@ -8,6 +8,8 @@ local lgi = require("lgi")
local Gio = lgi.Gio
local GdkPixbuf = lgi.GdkPixbuf
local pids = {}
local lua_executable = os.getenv("LUA")
if lua_executable == nil or lua_executable == "" then
lua_executable = "lua"
@ -53,8 +55,9 @@ runner.run_steps{
-- Clear the clipboard to get to a known state
function()
spawn.with_line_callback({ lua_executable, "-e", acquire_and_clear_clipboard },
local pid = spawn.with_line_callback({ lua_executable, "-e", acquire_and_clear_clipboard },
{ exit = function() continue = true end })
table.insert(pids, pid)
return true
end,
@ -84,13 +87,15 @@ runner.run_steps{
-- Now set the clipboard to some text
continue = false
spawn.with_line_callback({ lua_executable, "-e", acquire_clipboard_text },
local pid = spawn.with_line_callback({ lua_executable, "-e", acquire_clipboard_text },
{ stdout = function(line)
assert(line == "initialisation done",
"Unexpected line: " .. line)
continue = true
end })
table.insert(pids, pid)
return true
end,
@ -148,13 +153,15 @@ runner.run_steps{
-- Now set the clipboard to an image
continue = false
spawn.with_line_callback({ lua_executable, "-e", acquire_clipboard_pixbuf },
local pid = spawn.with_line_callback({ lua_executable, "-e", acquire_clipboard_pixbuf },
{ stdout = function(line)
assert(line == "initialisation done",
"Unexpected line: " .. line)
continue = true
end })
table.insert(pids, pid)
return true
end,
@ -194,6 +201,12 @@ runner.run_steps{
return
end
-- There are now "windows", so they have no "clients", however,
-- they talk to X11 and wont exit by themselves and must be killed.
for _, pid in ipairs(pids) do
awesome.kill(pid, 9)
end
return true
end,
}

View File

@ -3,6 +3,8 @@
local runner = require("_runner")
local spawn = require("awful.spawn")
local pids = {}
local lua_executable = os.getenv("LUA")
if lua_executable == nil or lua_executable == "" then
lua_executable = "lua"
@ -67,8 +69,11 @@ runner.run_steps{
-- Clear the clipboard to get to a known state
function()
check_state(0, 0)
spawn.with_line_callback({ lua_executable, "-e", acquire_and_clear_clipboard },
local pid = spawn.with_line_callback({ lua_executable, "-e", acquire_and_clear_clipboard },
{ exit = function() continue = true end })
table.insert(pids, pid)
return true
end,
@ -86,13 +91,15 @@ runner.run_steps{
-- Set the clipboard
continue = false
spawn.with_line_callback({ lua_executable, "-e", acquire_clipboard },
local pid = spawn.with_line_callback({ lua_executable, "-e", acquire_clipboard },
{ stdout = function(line)
assert(line == "initialisation done",
"Unexpected line: " .. line)
continue = true
end })
table.insert(pids, pid)
return true
end,
@ -105,9 +112,11 @@ runner.run_steps{
-- Now clear the clipboard again
continue = false
spawn.with_line_callback({ lua_executable, "-e", acquire_and_clear_clipboard },
local pid = spawn.with_line_callback({ lua_executable, "-e", acquire_and_clear_clipboard },
{ exit = function() continue = true end })
table.insert(pids, pid)
return true
end,
@ -118,6 +127,13 @@ runner.run_steps{
end
check_state(2, 1)
-- There are now "windows", so they have no "clients", however,
-- they talk to X11 and wont exit by themselves and must be killed.
for _, pid in ipairs(pids) do
awesome.kill(pid, 9)
end
return true
end
}