示例#1
0
 def test_device_not_compatible(self):
     utils.filesystem.mount(self.NTFS_DEVICE, self.NTFS_MOUNTPOINT)
     test_manager = DriveMonitor(self.NTFS_MOUNTPOINT, self.NTFS_DEVICE)
     time.sleep(self.SHORT_SLEEP)
     self.assertTrue(test_manager.is_DeviceNotCompatible(),
                     msg="Current state: {}".format(test_manager.state))
     test_manager.stop()
示例#2
0
 def test_format_invalid_unmounted(self):
     test_manager = DriveMonitor(self.NTFS_MOUNTPOINT, self.NTFS_DEVICE)
     time.sleep(self.SHORT_SLEEP)
     self.assertTrue(test_manager.is_InvalidDevice(),
                     msg="Current state: {}".format(test_manager.state))
     self.format_invalid(test_manager)
     test_manager.stop()
示例#3
0
 def test_device_ok(self):
     utils.filesystem.mount(self.VFAT_DEVICE, self.VFAT_MOUNTPOINT)
     test_manager = DriveMonitor(self.VFAT_MOUNTPOINT, self.VFAT_DEVICE)
     time.sleep(self.SHORT_SLEEP)
     self.assertTrue(test_manager.is_DeviceOk(),
                     msg="Current state: {}".format(test_manager.state))
     test_manager.stop()
示例#4
0
 def test_read_only_fs(self):
     test_manager = DriveMonitor(self.VFAT_RO_MOUNTPOINT,
                                 self.VFAT_RO_DEVICE)
     time.sleep(self.SHORT_SLEEP)
     utils.filesystem.mount(self.VFAT_RO_DEVICE, self.VFAT_RO_MOUNTPOINT)
     time.sleep(self.SHORT_SLEEP)
     self.assertTrue(test_manager.is_DeviceReadOnly(),
                     msg="Current state: {}".format(test_manager.state))
     test_manager.stop()
示例#5
0
 def test_no_space_left(self):
     utils.filesystem.mount(self.VFAT_DEVICE, self.VFAT_MOUNTPOINT)
     utils.filesystem.create_file(
         os.path.join(self.VFAT_MOUNTPOINT, "tfile"), 5)
     test_manager = DriveMonitor(self.VFAT_MOUNTPOINT, self.VFAT_DEVICE)
     time.sleep(self.LONG_SLEEP)
     self.assertTrue(test_manager.is_NotEnoughMemory(),
                     msg="Current state: {}".format(test_manager.state))
     test_manager.stop()
示例#6
0
 def test_format_exfat(self):
     test_manager = DriveMonitor(self.NTFS_MOUNTPOINT, self.NTFS_DEVICE)
     time.sleep(self.SHORT_SLEEP)
     self.assertTrue(test_manager.is_InvalidDevice(),
                     msg="Current state: {}".format(test_manager.state))
     test_manager.format_drive("exfat")
     time.sleep(self.SHORT_SLEEP)
     if 'fuseblk' in test_manager.SUPPORTED_FILESYSTEMS:
         self.assertTrue(test_manager.is_DeviceOk(),
                         msg="Current state: {}".format(test_manager.state))
     else:
         self.assertTrue(test_manager.is_DeviceNotCompatible(),
                         msg="Current state: {}".format(test_manager.state))
     test_manager.stop()
示例#7
0
 def test_format_read_only_fs(self):
     os.chmod(self.VFAT_RO_DEVICE, 0o444)
     test_manager = DriveMonitor(self.VFAT_RO_MOUNTPOINT,
                                 self.VFAT_RO_DEVICE)
     time.sleep(self.SHORT_SLEEP)
     self.assertTrue(test_manager.is_InvalidDevice(),
                     msg="Current state: {}".format(test_manager.state))
     time.sleep(self.SHORT_SLEEP)
     test_manager.format_drive()
     time.sleep(self.LONG_SLEEP)
     self.assertTrue(test_manager.is_DeviceReadOnly(),
                     msg="Current state: {}".format(test_manager.state))
     utils.filesystem.unmount(self.VFAT_RO_MOUNTPOINT)
     os.remove(self.VFAT_RO_DEVICE)
     time.sleep(self.SHORT_SLEEP)
     self.assertTrue(test_manager.is_NoDeviceDetected(),
                     msg="Current state: {}".format(test_manager.state))
     test_manager.stop()
示例#8
0
 def test_format_then_full(self):
     utils.filesystem.mount(self.VFAT_DEVICE, self.VFAT_MOUNTPOINT)
     test_manager = DriveMonitor(self.VFAT_MOUNTPOINT, self.VFAT_DEVICE)
     time.sleep(self.LONG_SLEEP)
     self.assertTrue(test_manager.is_Ok(),
                     msg="Current state: {}".format(test_manager.state))
     test_manager.format_drive()
     time.sleep(self.SHORT_SLEEP)
     self.assertTrue(test_manager.is_Ok(),
                     msg="Current state: {}".format(test_manager.state))
     try:
         utils.filesystem.create_file(
             os.path.join(self.VFAT_MOUNTPOINT, "tfile"), 19.9)
     except:
         pass
     time.sleep(self.LONG_SLEEP)
     self.assertTrue(test_manager.is_NotEnoughMemory(),
                     msg="Current state: {}".format(test_manager.state))
     test_manager.stop()
示例#9
0
 def test_good_cluster_size(self):
     utils.filesystem.create_block_device(
         self.VFAT_DEVICE,
         "vfat",
         additional_params=["-F", "32", "-s", "64", "-S", "512"])
     self.cluster_size = 0
     signal("device_warn_cluster{}".format(self.VFAT_MOUNTPOINT)).connect(
         self.warn_cluster)
     test_manager = DriveMonitor(self.VFAT_MOUNTPOINT, self.VFAT_DEVICE)
     time.sleep(self.SHORT_SLEEP)
     utils.filesystem.mount(self.VFAT_DEVICE, self.VFAT_MOUNTPOINT)
     time.sleep(self.SHORT_SLEEP)
     self.assertTrue(test_manager.is_DeviceOk(),
                     msg="Current state: {}".format(test_manager.state))
     self.assertTrue(
         (self.cluster_size == 0),
         msg="Small Cluster size should not be detected: {}".format(
             self.cluster_size))
     signal("device_warn_cluster{}".format(
         self.VFAT_MOUNTPOINT)).disconnect(self.warn_cluster)
     test_manager.stop()
示例#10
0
 def test_invalid_device(self):
     test_manager = DriveMonitor("/tmp/tmountpoint", self.NTFS_DEVICE)
     time.sleep(self.SHORT_SLEEP)
     self.assertTrue(test_manager.is_InvalidDevice(),
                     msg="Current state: {}".format(test_manager.state))
     test_manager.stop()
示例#11
0
 def test_nodevice(self):
     test_manager = DriveMonitor("/tmp/tmountpoint", "/tmp/nodev")
     time.sleep(self.SHORT_SLEEP)
     self.assertTrue(test_manager.is_NoDeviceDetected())
     test_manager.stop()
示例#12
0
 def test_format_nodev(self):
     test_manager = DriveMonitor("/tmp/tmountpoint", "/tmp/nodev")
     self.assertTrue(test_manager.is_NoDeviceDetected())
     self.assertRaises(IOError, test_manager.format_drive,
                       SETTINGS.sdcard_filesystem)
     test_manager.stop()