test: make race condition on xterm close less likely

xterm is very fast on closing when application inside terminates. It is
so fast with closing on keydown event that xdotool do not manage to send
keyup event, resulting in xdotool crash. Add a little more time for
that.
This commit is contained in:
Marek Marczykowski-Górecki 2017-10-28 23:25:48 +02:00
parent 07d4f4b340
commit 45af0913f2
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -147,8 +147,11 @@ class TC_20_DispVMMixin(object):
self.assertTrue(dispvm.is_running()) self.assertTrue(dispvm.is_running())
try: try:
window_title = 'user@%s' % (dispvm.name,) window_title = 'user@%s' % (dispvm.name,)
# close xterm on Return, but after short delay, to allow
# xdotool to send also keyup event
p.stdin.write("xterm -e " p.stdin.write("xterm -e "
"\"sh -c 'echo \\\"\033]0;{}\007\\\";read x;'\"\n". "\"sh -c 'echo \\\"\033]0;{}\007\\\";read x;"
"sleep 0.1;'\"\n".
format(window_title).encode()) format(window_title).encode())
self.loop.run_until_complete(p.stdin.drain()) self.loop.run_until_complete(p.stdin.drain())
self.wait_for_window(window_title) self.wait_for_window(window_title)