コード例 #1
0
 def test_rootdev_from_cmdline_with_root_with_label(self):
     """When cmdline root contains a LABEL, our root is disk/by-label."""
     self.assertEqual(
         '/dev/disk/by-label/unique',
         util.rootdev_from_cmdline('asdf root=LABEL=unique'))
コード例 #2
0
 def test_rootdev_from_cmdline_with_root_with_uuid(self):
     """When cmdline root contains a UUID, our root is disk/by-uuid."""
     self.assertEqual(
         '/dev/disk/by-uuid/adsfdsaf-adsf',
         util.rootdev_from_cmdline('asdf root=UUID=adsfdsaf-adsf'))
コード例 #3
0
 def test_rootdev_from_cmdline_with_root_startswith_dev(self):
     """Return the cmdline root when the path starts with /dev."""
     self.assertEqual(
         '/dev/this', util.rootdev_from_cmdline('asdf root=/dev/this'))
コード例 #4
0
 def test_rootdev_from_cmdline_with_root_without_dev_prefix(self):
     """Add /dev prefix to cmdline root when the path lacks the prefix."""
     self.assertEqual(
         '/dev/this', util.rootdev_from_cmdline('asdf root=this'))
コード例 #5
0
 def test_rootdev_from_cmdline_with_root_with_uuid(self):
     """When cmdline root contains a UUID, our root is disk/by-uuid."""
     self.assertEqual(
         '/dev/disk/by-uuid/adsfdsaf-adsf',
         util.rootdev_from_cmdline('asdf root=UUID=adsfdsaf-adsf'))
コード例 #6
0
 def test_rootdev_from_cmdline_with_root_with_label(self):
     """When cmdline root contains a LABEL, our root is disk/by-label."""
     self.assertEqual(
         '/dev/disk/by-label/unique',
         util.rootdev_from_cmdline('asdf root=LABEL=unique'))
コード例 #7
0
 def test_rootdev_from_cmdline_with_root_without_dev_prefix(self):
     """Add /dev prefix to cmdline root when the path lacks the prefix."""
     self.assertEqual(
         '/dev/this', util.rootdev_from_cmdline('asdf root=this'))
コード例 #8
0
 def test_rootdev_from_cmdline_with_root_startswith_dev(self):
     """Return the cmdline root when the path starts with /dev."""
     self.assertEqual(
         '/dev/this', util.rootdev_from_cmdline('asdf root=/dev/this'))
コード例 #9
0
 def test_rootdev_from_cmdline_with_no_root(self):
     """Return None from rootdev_from_cmdline when root is not present."""
     invalid_cases = [
         'BOOT_IMAGE=/adsf asdfa werasef  root adf', 'BOOT_IMAGE=/adsf', '']
     for case in invalid_cases:
         self.assertIsNone(util.rootdev_from_cmdline(case))