diff options
| author | Adrian Dudau <adrian.dudau@enea.com> | 2013-12-12 17:36:38 +0100 |
|---|---|---|
| committer | Adrian Dudau <adrian.dudau@enea.com> | 2013-12-12 17:36:38 +0100 |
| commit | 2a7348129a42f21095fcd62e47a035f78d254130 (patch) | |
| tree | 544dc8019a8f8cb684ace8674193605e607f9964 /recipes-test/ddt-runner/files/scripts/p2041rdb/usb | |
| download | meta-enea-master.tar.gz | |
Migrated from the internal git server on the dora-enea branch
Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
Diffstat (limited to 'recipes-test/ddt-runner/files/scripts/p2041rdb/usb')
| -rwxr-xr-x | recipes-test/ddt-runner/files/scripts/p2041rdb/usb | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/recipes-test/ddt-runner/files/scripts/p2041rdb/usb b/recipes-test/ddt-runner/files/scripts/p2041rdb/usb new file mode 100755 index 0000000..017287f --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/p2041rdb/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 | ||
