Skip to content

Commit c44dce6

Browse files
committed
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
1 parent 98855ca commit c44dce6

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

qubes/tests/integ/basic.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ async def _test_clipboard(
619619
p = await testvm1.run("cat > /tmp/source.txt", stdin=subprocess.PIPE)
620620
await p.communicate(test_string.encode())
621621
window_title = "user@{}".format(testvm1.name)
622-
await testvm1.run(
622+
p = await testvm1.run(
623623
"zenity --text-info "
624624
"--filename=/tmp/source.txt "
625625
"--editable "
@@ -639,7 +639,7 @@ async def _test_clipboard(
639639
await asyncio.sleep(5)
640640
subprocess.check_call(["xdotool", "key", "ctrl+shift+c", "Escape"])
641641

642-
await self.wait_for_window_coro(window_title, show=False)
642+
await p.communicate()
643643

644644
clipboard_content = (
645645
open("/var/run/qubes/qubes-clipboard.bin", "r").read().strip()
@@ -718,14 +718,14 @@ def test_000_clipboard(self):
718718
spawn.find_executable("xdotool"), "xdotool not installed"
719719
)
720720
def test_001_clipboard_64k(self):
721-
test_string = "test123abc" * 6400
721+
test_string = "test123ab\n" * 6400
722722
self.loop.run_until_complete(self._test_clipboard(test_string))
723723

724724
@unittest.skipUnless(
725725
spawn.find_executable("xdotool"), "xdotool not installed"
726726
)
727727
def test_002_clipboard_200k_truncated(self):
728-
test_string = "test123abc" * 20000
728+
test_string = "test123ab\n" * 20000
729729
self.loop.run_until_complete(
730730
self._test_clipboard(
731731
test_string, expect_content="", expect_source_name=""
@@ -736,7 +736,7 @@ def test_002_clipboard_200k_truncated(self):
736736
spawn.find_executable("xdotool"), "xdotool not installed"
737737
)
738738
def test_002_clipboard_200k(self):
739-
test_string = "test123abc" * 20000
739+
test_string = "test123ab\n" * 20000
740740
self.loop.run_until_complete(
741741
self._test_clipboard(
742742
test_string, set_features={"gui-max-clipboard-size": 200_000}
@@ -747,7 +747,7 @@ def test_002_clipboard_200k(self):
747747
spawn.find_executable("xdotool"), "xdotool not installed"
748748
)
749749
def test_002_clipboard_300k(self):
750-
test_string = "test123abc" * 30000
750+
test_string = "test123ab\n" * 30000
751751
self.loop.run_until_complete(
752752
self._test_clipboard(
753753
test_string,

0 commit comments

Comments
 (0)