From c44dce657d80e4003d79d773353e9403f056fabf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sun, 15 Dec 2024 06:51:13 +0100 Subject: [PATCH] tests: fix clipboard test First of all, wait for the zenity process to finish, do not leak it. But then, adjust the test string to not be a single long line - zenity often hangs on a single 300k line. Fixes QubesOS/qubes-issues#9646 --- qubes/tests/integ/basic.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/qubes/tests/integ/basic.py b/qubes/tests/integ/basic.py index 54be7b0b3..70f030153 100644 --- a/qubes/tests/integ/basic.py +++ b/qubes/tests/integ/basic.py @@ -619,7 +619,7 @@ async def _test_clipboard( p = await testvm1.run("cat > /tmp/source.txt", stdin=subprocess.PIPE) await p.communicate(test_string.encode()) window_title = "user@{}".format(testvm1.name) - await testvm1.run( + p = await testvm1.run( "zenity --text-info " "--filename=/tmp/source.txt " "--editable " @@ -639,7 +639,7 @@ async def _test_clipboard( await asyncio.sleep(5) subprocess.check_call(["xdotool", "key", "ctrl+shift+c", "Escape"]) - await self.wait_for_window_coro(window_title, show=False) + await p.communicate() clipboard_content = ( open("/var/run/qubes/qubes-clipboard.bin", "r").read().strip() @@ -718,14 +718,14 @@ def test_000_clipboard(self): spawn.find_executable("xdotool"), "xdotool not installed" ) def test_001_clipboard_64k(self): - test_string = "test123abc" * 6400 + test_string = "test123ab\n" * 6400 self.loop.run_until_complete(self._test_clipboard(test_string)) @unittest.skipUnless( spawn.find_executable("xdotool"), "xdotool not installed" ) def test_002_clipboard_200k_truncated(self): - test_string = "test123abc" * 20000 + test_string = "test123ab\n" * 20000 self.loop.run_until_complete( self._test_clipboard( test_string, expect_content="", expect_source_name="" @@ -736,7 +736,7 @@ def test_002_clipboard_200k_truncated(self): spawn.find_executable("xdotool"), "xdotool not installed" ) def test_002_clipboard_200k(self): - test_string = "test123abc" * 20000 + test_string = "test123ab\n" * 20000 self.loop.run_until_complete( self._test_clipboard( test_string, set_features={"gui-max-clipboard-size": 200_000} @@ -747,7 +747,7 @@ def test_002_clipboard_200k(self): spawn.find_executable("xdotool"), "xdotool not installed" ) def test_002_clipboard_300k(self): - test_string = "test123abc" * 30000 + test_string = "test123ab\n" * 30000 self.loop.run_until_complete( self._test_clipboard( test_string,