From 4f645fd07f51daffa3eb4a0e10ad9ef02b477684 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Wed, 27 Oct 2021 19:38:21 -0700 Subject: [PATCH] tests: Kill the test-selection-getter clients. This removes a confusing warning in the CI logs. --- tests/test-selection-getter.lua | 19 ++++++++++++++++--- tests/test-selection-watcher.lua | 22 +++++++++++++++++++--- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/tests/test-selection-getter.lua b/tests/test-selection-getter.lua index 9d919355..afac4703 100644 --- a/tests/test-selection-getter.lua +++ b/tests/test-selection-getter.lua @@ -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, } diff --git a/tests/test-selection-watcher.lua b/tests/test-selection-watcher.lua index 3721a67f..2e9d6a64 100644 --- a/tests/test-selection-watcher.lua +++ b/tests/test-selection-watcher.lua @@ -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 }