diff options
Diffstat (limited to 'test-cli/test/tests/qusbdual.py')
-rw-r--r-- | test-cli/test/tests/qusbdual.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test-cli/test/tests/qusbdual.py b/test-cli/test/tests/qusbdual.py index fcbb9aa..05b22c3 100644 --- a/test-cli/test/tests/qusbdual.py +++ b/test-cli/test/tests/qusbdual.py @@ -32,12 +32,14 @@ class Qusbdual(unittest.TestCase): try: p = sh.grep(sh.lsblk("-So", "NAME,VENDOR"), "Linux") except sh.ErrorReturnCode: + sh.modprobe("-r", "g_mass_storage") self.fail("failed: could not find any mass storage gadget") device = p.stdout.decode().split(" ")[0] # mount the mass storage gadget sh.mkdir("-p", "/mnt/station_ramdisk/hdd_gadget") p = sh.mount("-o", "ro", "/dev/" + device, "/mnt/station_ramdisk/hdd_gadget") if p.exit_code != 0: + sh.modprobe("-r", "g_mass_storage") self.fail("failed: Unable to mount the mass storage gadget.") # execute test for i in range(int(self.__repetitions)): @@ -49,11 +51,13 @@ class Qusbdual(unittest.TestCase): except sh.ErrorReturnCode as e: sh.umount("/mnt/station_ramdisk/hdd_gadget") sh.rmdir("/mnt/station_ramdisk/hdd_gadget") + sh.modprobe("-r", "g_mass_storage") self.fail("failed: Unable to copy files through USB.") # check if the device is still mounted if not os.path.ismount("/mnt/station_ramdisk/hdd_gadget"): sh.rm("/mnt/station_ramdisk/hdd_gadget/*") sh.rmdir("/mnt/station_ramdisk/hdd_gadget") + sh.modprobe("-r", "g_mass_storage") self.fail("failed: USB device unmounted during/after copying files.") # Check md5 try: @@ -61,6 +65,7 @@ class Qusbdual(unittest.TestCase): except sh.ErrorReturnCode as e: sh.umount("/mnt/station_ramdisk/hdd_gadget") sh.rmdir("/mnt/station_ramdisk/hdd_gadget") + sh.modprobe("-r", "g_mass_storage") self.fail("failed: Unable to calculate MD5 of the copied file.") newmd5 = p.stdout.decode().split(" ")[0] with open('/mnt/station_ramdisk/hdd_gadget/usb-test.bin.md5', 'r') as outfile: @@ -69,12 +74,14 @@ class Qusbdual(unittest.TestCase): if newmd5 != oldmd5: sh.umount("/mnt/station_ramdisk/hdd_gadget") sh.rmdir("/mnt/station_ramdisk/hdd_gadget") + sh.modprobe("-r", "g_mass_storage") self.fail("failed: MD5 check failed.") # delete copied files sh.rm("-f", "/mnt/station_nfsdisk/usb-test.bin", "/mnt/station_nfsdisk/usb-test.bin.md5") # Finish sh.umount("/mnt/station_ramdisk/hdd_gadget") sh.rmdir("/mnt/station_ramdisk/hdd_gadget") + sh.modprobe("-r", "g_mass_storage") def getresults(self): return self.__resultlist |