[gvfs/wip/oholy/test-timeouts] test: Add timeouts




commit 1463af3eb2b466ea9fca63e6abf8e9bffd43a8e1
Author: Ondrej Holy <oholy redhat com>
Date:   Wed Mar 23 09:46:07 2022 +0100

    test: Add timeouts

 test/gvfs-test | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/test/gvfs-test b/test/gvfs-test
index 8beb7266..99a0f4eb 100755
--- a/test/gvfs-test
+++ b/test/gvfs-test
@@ -128,7 +128,11 @@ class GvfsTestCase(unittest.TestCase):
 
         prog = subprocess.Popen(argv, stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE, universal_newlines=True)
-        (out, err) = prog.communicate()
+        try:
+            (out, err) = prog.communicate(timeout=30)
+        except subprocess.TimeoutExpired:
+            proc.kill()
+
         return (prog.returncode, out, err)
 
     def program_out_err(self, argv):
@@ -510,7 +514,7 @@ Subsystem sftp %(sftp_server)s
 
         # mount it
         uri = 'sftp://localhost:22222'
-        subprocess.check_call(['gio', 'mount', uri])
+        subprocess.check_call(['gio', 'mount', uri], timeout=30)
 
         self.do_mount_check(uri)
 
@@ -538,7 +542,7 @@ Subsystem sftp %(sftp_server)s
 
     def do_mount_check(self, uri):
         # appears in gio mount list
-        (out, err) = self.program_out_err(['gio', 'mount', '-li'])
+        (out, err) = self.program_out_err(['gio', 'mount', '-li'], timeout=30)
         try:
             self.assertRegex(out, 'Mount\(\d+\):.*localhost -> %s' % uri)
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]