summaryrefslogtreecommitdiffstats
path: root/recipes-test/ddt-runner/files/scripts/p4080ds/sdhc
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-test/ddt-runner/files/scripts/p4080ds/sdhc')
-rwxr-xr-xrecipes-test/ddt-runner/files/scripts/p4080ds/sdhc65
1 files changed, 65 insertions, 0 deletions
diff --git a/recipes-test/ddt-runner/files/scripts/p4080ds/sdhc b/recipes-test/ddt-runner/files/scripts/p4080ds/sdhc
new file mode 100755
index 0000000..31a7c2f
--- /dev/null
+++ b/recipes-test/ddt-runner/files/scripts/p4080ds/sdhc
@@ -0,0 +1,65 @@
1#!/bin/sh
2# This script is used to test sdhc functionality for p4080ds.
3# The content of SD will be lost by running this test case.
4
5SDHC_DEVICE="/dev/mmcblk0"
6SDHC_DEVICE_PART="/dev/mmcblk0p1"
7SFDISK=`which sfdisk`
8
9if [ -e $SDHC_DEVICE ]; then
10 echo "PASS: $SDHC_DEVICE device exists"
11else
12 echo "FAIL: $SDHC_DEVICE does not exist"
13 exit 1
14fi
15
16if [ -e $SDHC_DEVICE_PART ]; then
17 echo "PASS: $SDHC_DEVICE_PART device exists"
18elif [ ! -z $SFDISK ]; then
19
20 echo "Try to create a partition"
21
22$SFDISK $SDHC_DEVICE << EOF
23,,L
24EOF
25
26 if [ -e $SDHC_DEVICE_PART ]; then
27 echo "PASS: $SDHC_DEVICE_PART device exists"
28 else
29 echo "FAIL: $SDHC_DEVICE_PART does not exist"
30 exit 1
31 fi
32
33else
34 echo "FAIL: $SDHC_DEVICE_PART does not exist"
35 exit 1
36fi
37
38mount |grep mmcblk0p1
39if [ $? -eq 0 ]; then
40 umount $SDHC_DEVICE_PART
41fi
42
43/sbin/mkfs.ext2 $SDHC_DEVICE_PART
44if [ $? -ne 0 ]; then
45 echo "FAIL: format $SDHC_DEVICE_PART fail"
46 exit 1
47else
48 mkdir -p /mnt/sdhc
49 mount $SDHC_DEVICE_PART /mnt/sdhc
50 if [ $? -ne 0 ]; then
51 echo "FAIL: mount $SDHC_DEVICE_PART fail"
52 exit 1
53 else
54 cp /bin/busybox /mnt/sdhc
55 ls /mnt/sdhc |grep busybox
56 if [ $? -ne 0 ]; then
57 echo "FAIL: read or write $SDHC_DEVICE_PART fail"
58 exit 1
59 else
60 umount $SDHC_DEVICE_PART
61 echo "PASS: read or write $SDHC_DEVICE_PART success"
62 fi
63 fi
64fi
65