mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 14:00:29 +01:00
tools: fix waiting for the tool to quit in the options test
Just use the wait() timeout directly instead of sleep and kill. This allows us to have a longer timeout and still get fast handling where the tool immediately exits, but less failure when running on busy machines. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
80a52c28df
commit
32bf9f2990
2 changed files with 7 additions and 5 deletions
|
|
@ -610,7 +610,7 @@ if get_option('buildtype') == 'debug' or get_option('buildtype') == 'debugoptimi
|
|||
test('tool-option-parsing',
|
||||
find_program('tools/test-tool-option-parsing.py'),
|
||||
args : ['--tool-path', libinput_tool.full_path()],
|
||||
timeout : 120)
|
||||
timeout : 240)
|
||||
endif
|
||||
|
||||
# the libinput tools check whether we execute from the builddir, this is
|
||||
|
|
|
|||
|
|
@ -41,12 +41,14 @@ class TestLibinputTool(unittest.TestCase):
|
|||
args.insert(1, self.subtool)
|
||||
|
||||
with subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) as p:
|
||||
time.sleep(0.1)
|
||||
p.send_signal(3) # SIGQUIT
|
||||
p.wait()
|
||||
try:
|
||||
p.wait(0.7)
|
||||
except subprocess.TimeoutExpired:
|
||||
p.send_signal(3) # SIGQUIT
|
||||
stdout, stderr = p.communicate(timeout=2)
|
||||
if p.returncode == -3:
|
||||
p.returncode = 0
|
||||
return p.returncode, p.stdout.read().decode('UTF-8'), p.stderr.read().decode('UTF-8')
|
||||
return p.returncode, stdout.decode('UTF-8'), stderr.decode('UTF-8')
|
||||
|
||||
def run_command_success(self, args):
|
||||
rc, stdout, stderr = self.run_command(args)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue