diff options
author | Bogdan Oprescu <bogdan.oprescu@enea.com> | 2023-11-15 11:09:08 +0200 |
---|---|---|
committer | Bogdan Oprescu <bogdan.oprescu@enea.com> | 2023-11-16 14:26:36 +0200 |
commit | 6da9d81e77b2f56a91a697ac474473e787a58ccf (patch) | |
tree | 170e6a5acc14673fc466a7405d7cc35673bed507 /recipes-test/ddt-runner/files/scripts/t1042rdb/usb | |
parent | 2283105d0abe9efa216b018e0d34100e4544ce78 (diff) | |
download | meta-enea-daisy-enea-231026.tar.gz |
T1042RDB: Adding ddt testsdaisy-enea-231026
Signed-off-by: Bogdan Oprescu <bogdan.oprescu@enea.com>
Diffstat (limited to 'recipes-test/ddt-runner/files/scripts/t1042rdb/usb')
-rwxr-xr-x | recipes-test/ddt-runner/files/scripts/t1042rdb/usb | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/recipes-test/ddt-runner/files/scripts/t1042rdb/usb b/recipes-test/ddt-runner/files/scripts/t1042rdb/usb new file mode 100755 index 0000000..017287f --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/t1042rdb/usb | |||
@@ -0,0 +1,48 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | #This script is to test usb devices on p2041rdb target | ||
4 | # | ||
5 | |||
6 | USB_DISK=`ls /dev/sd*[1-9] | sort | tail -n 1` | ||
7 | |||
8 | usbutils_is_installed=`which lsusb` | ||
9 | if [ -z $usbutils_is_installed ]; then | ||
10 | echo "FAIL: Cannot find lsusb" | ||
11 | exit 1 | ||
12 | else | ||
13 | echo "PASS: usbutils found" | ||
14 | fi | ||
15 | |||
16 | usbdev_num=`lsusb | grep -v root\ hub | wc -l` | ||
17 | if [ $usbdev_num -eq 0 ]; then | ||
18 | echo "FAIL: USB device is not connected" | ||
19 | exit 1 | ||
20 | else | ||
21 | echo "PASS: $usbdev_num USB device(s) connected" | ||
22 | fi | ||
23 | |||
24 | lsusb | grep -v root\ hub | ||
25 | mkdir -p /mnt/usb_ehci | ||
26 | mount $USB_DISK /mnt/usb_ehci | ||
27 | if [ $? -ne 0 ]; then | ||
28 | echo "FAIL: Mount USB device failed" | ||
29 | exit 1 | ||
30 | else | ||
31 | echo "PASS: Mount USB device succeed" | ||
32 | fi | ||
33 | |||
34 | echo "Begin test usb device..." | ||
35 | dd if=/dev/urandom of=/mnt/usb_ehci/testfile bs=1M count=50 | ||
36 | if [ $? -ne 0 ]; then | ||
37 | echo "FAIL: test failed" | ||
38 | rm -f /mnt/usb_ehci_testfile | ||
39 | umount /mnt/usb_ehci | ||
40 | rm -fr /mnt/usb_ehci | ||
41 | exit 1 | ||
42 | fi | ||
43 | |||
44 | echo "PASS: test succeed" | ||
45 | rm -f /mnt/usb_ehci_testfile | ||
46 | umount /mnt/usb_ehci | ||
47 | rm -fr /mnt/usb_ehci | ||
48 | exit 0 | ||