summaryrefslogtreecommitdiff
path: root/test-cli/test
diff options
context:
space:
mode:
authorHector Fernandez <hector@iatec.biz>2020-07-07 17:27:33 +0200
committerHector Fernandez <hector@iatec.biz>2020-07-07 17:27:33 +0200
commit907b96801230e04d02575a3732a73e452089637b (patch)
tree361ef65c4845ac34954cbdd6082dc38aefcda282 /test-cli/test
parenta0b900477098a435b5e434512c491f6bf0365b80 (diff)
downloadboard-907b96801230e04d02575a3732a73e452089637b.zip
board-907b96801230e04d02575a3732a73e452089637b.tar.gz
board-907b96801230e04d02575a3732a73e452089637b.tar.bz2
After USBLOOP test, g_mass_storage must be stopped so the board can be rebooted correctly.
Diffstat (limited to 'test-cli/test')
-rw-r--r--test-cli/test/tests/qusbdual.py7
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