From: Martin Pitt Date: Mon, 27 Sep 2010 15:05:20 +0000 (+0200) Subject: testsuite: LVM: fix naming assumptions X-Git-Tag: upstream/2.1.2~593 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cb9263122e90391bd9fe4a2d8859c596030ecdda;p=platform%2Fupstream%2Fudisks2.git testsuite: LVM: fix naming assumptions The LVM tests previously assumed that LVM devices had their primary device node in /dev/mapper/. However, under the current udev rule device names should match the kernel name, i. e. /dev/dm-*, and /dev/mapper/ should merely contain symlinks. Drop the /dev/mapper/* assumptions and just check whether there is a by-id/ symlink with the LV name. --- diff --git a/tests/run b/tests/run index 67787fe..5902375 100755 --- a/tests/run +++ b/tests/run @@ -1226,16 +1226,20 @@ class LVM(UDisksTestCase): 'org.freedesktop.UDisks', lvname), dbus.PROPERTIES_IFACE) # the LV is a real volume which should be shown, but not automounted - self.assert_(lv_props.Get(I_D, 'DeviceFile').startswith('/dev/mapper/')) + self.assert_(lv_props.Get(I_D, 'DeviceFile').startswith('/dev/dm-')) self.assertEqual(lv_props.Get(I_D, 'DevicePresentationHide'), False) self.assertEqual(lv_props.Get(I_D, 'DevicePresentationNopolicy'), True) - # ensure that we have a UUID + # ensure that we have a by-name and a by-UUID link found_uuid = False + found_name = False for i in lv_props.Get(I_D, 'DeviceFileById'): if 'uuid-LVM' in i: found_uuid = True + if 'udtestlv1' in i: + found_name = True self.assert_(found_uuid, 'no by-uuid found in ' + str(i)) + self.assert_(found_uuid, 'no by-name found in ' + str(i)) def test_single_lv_raid(self): '''LVM: Single LV, RAID-1''' @@ -1271,7 +1275,6 @@ class LVM(UDisksTestCase): 'org.freedesktop.UDisks', o), dbus.PROPERTIES_IFACE) if o == real_lv_obj: - self.assert_(props.Get(I_D, 'DeviceFile').startswith('/dev/mapper/')) # never hide the real LV self.assertEqual(props.Get(I_D, 'DevicePresentationHide'), False) self.assertEqual(props.Get(I_D, 'IdUsage'), 'filesystem') @@ -1327,7 +1330,7 @@ class LVM(UDisksTestCase): dev_objpath) dev_p = dbus.Interface(dev_obj, dbus.PROPERTIES_IFACE) - self.assertEqual(dev_p.Get(I_D, 'DeviceFile'), devname) + self.assertEqual(dev_p.Get(I_D, 'DeviceFile'), os.path.realpath(devname)) self.assertEqual(dev_p.Get(I_D, 'DeviceIsPartition'), False) self.assertEqual(dev_p.Get(I_D, 'PartitionScheme'), '') self.assertEqual(dev_p.Get(I_D, 'DeviceIsPartitionTable'), True) @@ -1338,7 +1341,6 @@ class LVM(UDisksTestCase): self.manager_iface.FindDeviceByDeviceFile(devname + 'p1')) p1_p = dbus.Interface(p1_obj, dbus.PROPERTIES_IFACE) - self.assertEqual(p1_p.Get(I_D, 'DeviceFile'), devname + 'p1') self.assertEqual(p1_p.Get(I_D, 'DeviceIsPartition'), True) self.assertEqual(p1_p.Get(I_D, 'DeviceIsPartitionTable'), False) self.assertEqual(p1_p.Get(I_D, 'DevicePresentationHide'), False) @@ -1354,7 +1356,6 @@ class LVM(UDisksTestCase): self.manager_iface.FindDeviceByDeviceFile(devname + 'p2')) p1_p = dbus.Interface(p1_obj, dbus.PROPERTIES_IFACE) - self.assertEqual(p1_p.Get(I_D, 'DeviceFile'), devname + 'p2') self.assertEqual(p1_p.Get(I_D, 'DeviceIsPartition'), True) self.assertEqual(p1_p.Get(I_D, 'DeviceIsPartitionTable'), False) self.assertEqual(p1_p.Get(I_D, 'DevicePresentationHide'), False)