[gvfs] gvfs-test: Robustify Smb.test_anonymous
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] gvfs-test: Robustify Smb.test_anonymous
- Date: Tue, 16 Oct 2012 09:49:54 +0000 (UTC)
commit 4a71400a3ca74baee69f9e90f124fcfd2bcf10b6
Author: Martin Pitt <martinpitt gnome org>
Date: Tue Oct 16 11:40:36 2012 +0200
gvfs-test: Robustify Smb.test_anonymous
gvfs-mount may hang indefinitely if it unexpectedly asks for credentials when
trying to do an anoymous mount. Time out after 5 seconds instead.
test/gvfs-test | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/test/gvfs-test b/test/gvfs-test
index 38edba4..cfccb3c 100755
--- a/test/gvfs-test
+++ b/test/gvfs-test
@@ -465,7 +465,21 @@ class Smb(GvfsTestCase):
'''smb:// anonymous'''
uri = 'smb://%s/myfiles' % os.uname()[1]
- subprocess.check_call(['gvfs-mount', uri])
+
+ # ensure that this does not ask for any credentials
+ mount = subprocess.Popen(['gvfs-mount', uri])
+ timeout = 50
+ while timeout > 0:
+ time.sleep(0.1)
+ timeout -= 1
+ if mount.poll() is not None:
+ self.assertEqual(mount.returncode, 0, 'gvfs-mount %s failed' % uri)
+ break
+ else:
+ mount.terminate()
+ mount.wait()
+ self.fail('timed out waiting for gvfs-mount %s' % uri)
+
self.do_mount_check(uri, False)
def test_authenticated(self):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]