Exemplo n.º 1
0
 def test_invalid_mountinfo(self):
     line = "20 1 252:1 / / rw,relatime - ext4 /dev/mapper/vg0-root" "rw,errors=remount-ro,data=ordered"
     elements = line.split()
     for i in range(len(elements) + 1):
         lines = [" ".join(elements[0:i])]
         if i < 10:
             expected = None
         else:
             expected = ("/dev/mapper/vg0-root", "ext4", "/")
         self.assertEqual(expected, util.parse_mount_info("/", lines))
Exemplo n.º 2
0
 def test_invalid_mountinfo(self):
     line = ("20 1 252:1 / / rw,relatime - ext4 /dev/mapper/vg0-root"
             "rw,errors=remount-ro,data=ordered")
     elements = line.split()
     for i in range(len(elements) + 1):
         lines = [' '.join(elements[0:i])]
         if i < 10:
             expected = None
         else:
             expected = ('/dev/mapper/vg0-root', 'ext4', '/')
         self.assertEqual(expected, util.parse_mount_info('/', lines))
Exemplo n.º 3
0
    def test_raring_btrfs_root(self):
        lines = helpers.readResource('mountinfo_raring_btrfs.txt').splitlines()

        expected = ('/dev/vda1', 'btrfs', '/')
        self.assertEqual(expected, util.parse_mount_info('/', lines))
        self.assertEqual(expected, util.parse_mount_info('/usr', lines))
        self.assertEqual(expected, util.parse_mount_info('/usr/bin', lines))
        self.assertEqual(expected, util.parse_mount_info('/boot', lines))
        self.assertEqual(expected, util.parse_mount_info('/boot/grub', lines))

        expected = ('/dev/vda1', 'btrfs', '/home')
        self.assertEqual(expected, util.parse_mount_info('/home', lines))
        self.assertEqual(expected, util.parse_mount_info('/home/me', lines))

        expected = ('tmpfs', 'tmpfs', '/run')
        self.assertEqual(expected, util.parse_mount_info('/run', lines))

        expected = ('none', 'tmpfs', '/run/lock')
        self.assertEqual(expected, util.parse_mount_info('/run/lock', lines))
Exemplo n.º 4
0
    def test_raring_btrfs_root(self):
        lines = self.readResource('mountinfo_raring_btrfs.txt').splitlines()

        expected = ('/dev/vda1', 'btrfs', '/')
        self.assertEqual(expected, util.parse_mount_info('/', lines))
        self.assertEqual(expected, util.parse_mount_info('/usr', lines))
        self.assertEqual(expected, util.parse_mount_info('/usr/bin', lines))
        self.assertEqual(expected, util.parse_mount_info('/boot', lines))
        self.assertEqual(expected, util.parse_mount_info('/boot/grub', lines))

        expected = ('/dev/vda1', 'btrfs', '/home')
        self.assertEqual(expected, util.parse_mount_info('/home', lines))
        self.assertEqual(expected, util.parse_mount_info('/home/me', lines))

        expected = ('tmpfs', 'tmpfs', '/run')
        self.assertEqual(expected, util.parse_mount_info('/run', lines))

        expected = ('none', 'tmpfs', '/run/lock')
        self.assertEqual(expected, util.parse_mount_info('/run/lock', lines))
Exemplo n.º 5
0
    def test_raring_btrfs_root(self):
        lines = self.readResource("mountinfo_raring_btrfs.txt").splitlines()

        expected = ("/dev/vda1", "btrfs", "/")
        self.assertEqual(expected, util.parse_mount_info("/", lines))
        self.assertEqual(expected, util.parse_mount_info("/usr", lines))
        self.assertEqual(expected, util.parse_mount_info("/usr/bin", lines))
        self.assertEqual(expected, util.parse_mount_info("/boot", lines))
        self.assertEqual(expected, util.parse_mount_info("/boot/grub", lines))

        expected = ("/dev/vda1", "btrfs", "/home")
        self.assertEqual(expected, util.parse_mount_info("/home", lines))
        self.assertEqual(expected, util.parse_mount_info("/home/me", lines))

        expected = ("tmpfs", "tmpfs", "/run")
        self.assertEqual(expected, util.parse_mount_info("/run", lines))

        expected = ("none", "tmpfs", "/run/lock")
        self.assertEqual(expected, util.parse_mount_info("/run/lock", lines))
Exemplo n.º 6
0
    def test_precise_ext4_root(self):

        lines = helpers.readResource('mountinfo_precise_ext4.txt').splitlines()

        expected = ('/dev/mapper/vg0-root', 'ext4', '/')
        self.assertEqual(expected, util.parse_mount_info('/', lines))
        self.assertEqual(expected, util.parse_mount_info('/usr', lines))
        self.assertEqual(expected, util.parse_mount_info('/usr/bin', lines))

        expected = ('/dev/md0', 'ext4', '/boot')
        self.assertEqual(expected, util.parse_mount_info('/boot', lines))
        self.assertEqual(expected, util.parse_mount_info('/boot/grub', lines))

        expected = ('/dev/mapper/vg0-root', 'ext4', '/')
        self.assertEqual(expected, util.parse_mount_info('/home', lines))
        self.assertEqual(expected, util.parse_mount_info('/home/me', lines))

        expected = ('tmpfs', 'tmpfs', '/run')
        self.assertEqual(expected, util.parse_mount_info('/run', lines))

        expected = ('none', 'tmpfs', '/run/lock')
        self.assertEqual(expected, util.parse_mount_info('/run/lock', lines))
Exemplo n.º 7
0
    def test_precise_ext4_root(self):

        lines = self.readResource('mountinfo_precise_ext4.txt').splitlines()

        expected = ('/dev/mapper/vg0-root', 'ext4', '/')
        self.assertEqual(expected, util.parse_mount_info('/', lines))
        self.assertEqual(expected, util.parse_mount_info('/usr', lines))
        self.assertEqual(expected, util.parse_mount_info('/usr/bin', lines))

        expected = ('/dev/md0', 'ext4', '/boot')
        self.assertEqual(expected, util.parse_mount_info('/boot', lines))
        self.assertEqual(expected, util.parse_mount_info('/boot/grub', lines))

        expected = ('/dev/mapper/vg0-root', 'ext4', '/')
        self.assertEqual(expected, util.parse_mount_info('/home', lines))
        self.assertEqual(expected, util.parse_mount_info('/home/me', lines))

        expected = ('tmpfs', 'tmpfs', '/run')
        self.assertEqual(expected, util.parse_mount_info('/run', lines))

        expected = ('none', 'tmpfs', '/run/lock')
        self.assertEqual(expected, util.parse_mount_info('/run/lock', lines))
Exemplo n.º 8
0
    def test_precise_ext4_root(self):

        lines = self.readResource("mountinfo_precise_ext4.txt").splitlines()

        expected = ("/dev/mapper/vg0-root", "ext4", "/")
        self.assertEqual(expected, util.parse_mount_info("/", lines))
        self.assertEqual(expected, util.parse_mount_info("/usr", lines))
        self.assertEqual(expected, util.parse_mount_info("/usr/bin", lines))

        expected = ("/dev/md0", "ext4", "/boot")
        self.assertEqual(expected, util.parse_mount_info("/boot", lines))
        self.assertEqual(expected, util.parse_mount_info("/boot/grub", lines))

        expected = ("/dev/mapper/vg0-root", "ext4", "/")
        self.assertEqual(expected, util.parse_mount_info("/home", lines))
        self.assertEqual(expected, util.parse_mount_info("/home/me", lines))

        expected = ("tmpfs", "tmpfs", "/run")
        self.assertEqual(expected, util.parse_mount_info("/run", lines))

        expected = ("none", "tmpfs", "/run/lock")
        self.assertEqual(expected, util.parse_mount_info("/run/lock", lines))
Exemplo n.º 9
0
 def test_parse_mount_info_with_opts(self):
     result = util.parse_mount_info('/', MOUNT_INFO, LOG, True)
     self.assertEqual(('/dev/sda1', 'btrfs', '/', 'ro,relatime'), result)
Exemplo n.º 10
0
 def test_parse_mount_info_no_opts_arg(self):
     result = util.parse_mount_info('/home', MOUNT_INFO, LOG, False)
     self.assertEqual(('/dev/sda2', 'xfs', '/home'), result)
Exemplo n.º 11
0
 def test_parse_mount_info_with_opts(self):
     result = util.parse_mount_info('/', MOUNT_INFO, LOG, True)
     self.assertEqual(
         ('/dev/sda1', 'btrfs', '/', 'ro,relatime'),
         result
     )
Exemplo n.º 12
0
 def test_parse_mount_info_no_opts_arg(self):
     result = util.parse_mount_info('/home', MOUNT_INFO, LOG, False)
     self.assertEqual(('/dev/sda2', 'xfs', '/home'), result)