diff options
author | Martin Pitt <martinpitt@gnome.org> | 2012-10-16 11:40:36 +0200 |
---|---|---|
committer | Martin Pitt <martinpitt@gnome.org> | 2012-10-16 11:49:37 +0200 |
commit | 4a71400a3ca74baee69f9e90f124fcfd2bcf10b6 (patch) | |
tree | 35517d391f3f2d97c756f98fab31091e684a11ce /test | |
parent | 9f80a98aeb422538500fba4ba73c8841fc361f28 (diff) | |
download | gvfs-4a71400a3ca74baee69f9e90f124fcfd2bcf10b6.tar.gz |
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.
Diffstat (limited to 'test')
-rwxr-xr-x | test/gvfs-test | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/test/gvfs-test b/test/gvfs-test index 38edba42..cfccb3c8 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): |