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 Gio = lgi.Gio
local GdkPixbuf = lgi.GdkPixbuf local GdkPixbuf = lgi.GdkPixbuf
local pids = {}
local lua_executable = os.getenv("LUA") local lua_executable = os.getenv("LUA")
if lua_executable == nil or lua_executable == "" then if lua_executable == nil or lua_executable == "" then
lua_executable = "lua" lua_executable = "lua"
@ -53,8 +55,9 @@ runner.run_steps{
-- Clear the clipboard to get to a known state -- Clear the clipboard to get to a known state
function() 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 }) { exit = function() continue = true end })
table.insert(pids, pid)
return true return true
end, end,
@ -84,13 +87,15 @@ runner.run_steps{
-- Now set the clipboard to some text -- Now set the clipboard to some text
continue = false 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) { stdout = function(line)
assert(line == "initialisation done", assert(line == "initialisation done",
"Unexpected line: " .. line) "Unexpected line: " .. line)
continue = true continue = true
end }) end })
table.insert(pids, pid)
return true return true
end, end,
@ -148,13 +153,15 @@ runner.run_steps{
-- Now set the clipboard to an image -- Now set the clipboard to an image
continue = false 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) { stdout = function(line)
assert(line == "initialisation done", assert(line == "initialisation done",
"Unexpected line: " .. line) "Unexpected line: " .. line)
continue = true continue = true
end }) end })
table.insert(pids, pid)
return true return true
end, end,
@ -194,6 +201,12 @@ runner.run_steps{
return return
end 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 return true
end, end,
} }

View File

@ -3,6 +3,8 @@
local runner = require("_runner") local runner = require("_runner")
local spawn = require("awful.spawn") local spawn = require("awful.spawn")
local pids = {}
local lua_executable = os.getenv("LUA") local lua_executable = os.getenv("LUA")
if lua_executable == nil or lua_executable == "" then if lua_executable == nil or lua_executable == "" then
lua_executable = "lua" lua_executable = "lua"
@ -67,8 +69,11 @@ runner.run_steps{
-- Clear the clipboard to get to a known state -- Clear the clipboard to get to a known state
function() function()
check_state(0, 0) 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 }) { exit = function() continue = true end })
table.insert(pids, pid)
return true return true
end, end,
@ -86,13 +91,15 @@ runner.run_steps{
-- Set the clipboard -- Set the clipboard
continue = false 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) { stdout = function(line)
assert(line == "initialisation done", assert(line == "initialisation done",
"Unexpected line: " .. line) "Unexpected line: " .. line)
continue = true continue = true
end }) end })
table.insert(pids, pid)
return true return true
end, end,
@ -105,9 +112,11 @@ runner.run_steps{
-- Now clear the clipboard again -- Now clear the clipboard again
continue = false 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 }) { exit = function() continue = true end })
table.insert(pids, pid)
return true return true
end, end,
@ -118,6 +127,13 @@ runner.run_steps{
end end
check_state(2, 1) 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 return true
end end
} }