tests/fprintd: Use output checker in FPrintdUtilsTest

This commit is contained in:
Marco Trevisan (Treviño)
2021-01-27 23:59:15 +01:00
parent f4d2e905bd
commit 59c2dc5df2

View File

@ -36,6 +36,7 @@ import dbusmock
import gi import gi
gi.require_version('FPrint', '2.0') gi.require_version('FPrint', '2.0')
from gi.repository import GLib, Gio, FPrint from gi.repository import GLib, Gio, FPrint
from output_checker import OutputChecker
import cairo import cairo
try: try:
@ -2832,20 +2833,23 @@ class FPrintdUtilsTest(FPrintdVirtualStorageDeviceBaseTest):
if os.path.exists(valgrind): if os.path.exists(valgrind):
argv.insert(2, '--suppressions=%s' % valgrind) argv.insert(2, '--suppressions=%s' % valgrind)
self.valgrind = True self.valgrind = True
output = OutputChecker()
self.utils_proc[name] = subprocess.Popen(argv, self.utils_proc[name] = subprocess.Popen(argv,
env=env, env=env,
stdout=None, stdout=output.fd,
stderr=subprocess.STDOUT) stderr=subprocess.STDOUT)
output.writer_attached()
self.addCleanup(self.utils_proc[name].wait) self.addCleanup(self.utils_proc[name].wait)
self.addCleanup(self.utils_proc[name].terminate) self.addCleanup(self.utils_proc[name].terminate)
return self.utils_proc[name] self.addCleanup(output.assert_closed)
return self.utils_proc[name], output
def test_vanished_client_operation_is_cancelled(self): def test_vanished_client_operation_is_cancelled(self):
self.device.Claim('(s)', self.get_current_user()) self.device.Claim('(s)', self.get_current_user())
self.enroll_image('whorl') self.enroll_image('whorl')
self.device.Release() self.device.Release()
verify = self.util_start('verify') verify, output = self.util_start('verify')
time.sleep(1) time.sleep(1)
verify.terminate() verify.terminate()
self.assertLess(verify.wait(), 128) self.assertLess(verify.wait(), 128)