summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pitt <martinpitt@gnome.org>2012-09-07 07:52:51 +0200
committerMartin Pitt <martinpitt@gnome.org>2012-09-07 07:53:10 +0200
commitd5a14503880dd412535bfba1554ddb7d0fb1ba03 (patch)
tree46d300d410947f7c359766004b00e7754aade9a1
parent1ade23e892a1d33c7a388ed7d1ecb3a969e1474f (diff)
integration-tests: Check handling of existing mount points
udisks tracks its mounts in /run/udisks2/mounted-fs, so udisks generated mount points should be reused across daemon restarts, but manually created mount points should not be. See https://bugs.freedesktop.org/show_bug.cgi?id=54487
-rwxr-xr-xsrc/tests/integration-test57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/tests/integration-test b/src/tests/integration-test
index 17954dc..517b4bf 100755
--- a/src/tests/integration-test
+++ b/src/tests/integration-test
@@ -734,6 +734,63 @@ class FS(UDisksTestCase):
self.client.settle()
self.assertEqual(fs.get_property('mount-points'), [])
+ def test_existing_manual_mount_point(self):
+ '''fs: does not reuse existing manual mount point'''
+
+ self.mkfs('ext4', 'udiskstest')
+ fs = self.udisks_filesystem()
+
+ # mount it, determine mount path, and unmount again
+ mount_path = fs.call_mount_sync(no_options, None)
+ self.assertTrue(mount_path.endswith('udiskstest'))
+
+ self.retry_busy(fs.call_unmount_sync, no_options, None)
+ self.client.settle()
+ self.assertEqual(fs.get_property('mount-points'), [])
+
+ # cleans up mountpoint
+ self.assertFalse(os.path.exists(mount_path))
+
+ # now manually create the mount point
+ os.mkdir(mount_path)
+
+ # now this should use mount_path + '1'
+ try:
+ new_mount_path = fs.call_mount_sync(no_options, None)
+ self.retry_busy(fs.call_unmount_sync, no_options, None)
+ self.client.settle()
+ self.assertEqual(fs.get_property('mount-points'), [])
+ self.assertEqual(new_mount_path, mount_path + '1')
+ finally:
+ os.rmdir(mount_path)
+
+ def test_existing_udisks_mount_point(self):
+ '''fs: reuses existing udisks mount point'''
+
+ self.mkfs('ext4', 'udiskstest')
+ fs = self.udisks_filesystem()
+
+ # mount it, determine mount path
+ mount_path = fs.call_mount_sync(no_options, None)
+ self.assertTrue(mount_path.endswith('udiskstest'))
+
+ # stop the daemon (happens during a package upgrade)
+ UDisksTestCase.stop_daemon()
+
+ # mount should still be there; unmount it manually
+ self.assertTrue(self.is_mountpoint(mount_path))
+ subprocess.check_call(['umount', mount_path])
+
+ # restart daemon, mount again; this should use the same mount point as
+ # before
+ UDisksTestCase.start_daemon()
+ fs = self.udisks_filesystem()
+ new_mount_path = fs.call_mount_sync(no_options, None)
+ self.retry_busy(fs.call_unmount_sync, no_options, None)
+ self.client.settle()
+ self.assertEqual(fs.get_property('mount-points'), [])
+ self.assertEqual(new_mount_path, mount_path)
+
def _do_fs_check(self, type):
'''Run checks for a particular file system.'''