summaryrefslogtreecommitdiffstats
path: root/recipes-test/ddt-runner/files/scripts/acp3448v2/flash
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-test/ddt-runner/files/scripts/acp3448v2/flash')
-rwxr-xr-xrecipes-test/ddt-runner/files/scripts/acp3448v2/flash45
1 files changed, 45 insertions, 0 deletions
diff --git a/recipes-test/ddt-runner/files/scripts/acp3448v2/flash b/recipes-test/ddt-runner/files/scripts/acp3448v2/flash
new file mode 100755
index 0000000..30c5d06
--- /dev/null
+++ b/recipes-test/ddt-runner/files/scripts/acp3448v2/flash
@@ -0,0 +1,45 @@
1#!/bin/sh
2#
3# This script is used to test flash driver function.
4
5if part_num=`cat /proc/mtd | grep -c 'mtd'`; then
6 echo "PASS: show $part_num partitions"
7else
8 echo "FAIL: show $part_num partitions"
9fi
10
11for((part=0; part<$part_num-1; part++));
12do
13 if [ $(mtd_debug info /dev/mtd$part | grep -c 'mtd.type') ]; then
14 echo "PASS: show partition $part debug info"
15 else
16 echo "FAIL: show partition $part debug info"
17 fi
18done
19
20let "test_part=part_num-2"
21
22if [ $(flash_erase -j /dev/mtd${test_part} 0 0 | grep -c '100 % complete') ]; then
23 echo "PASS: erase and format partition ${test_part}"
24else
25 echo "FAIL: erase and format partition ${test_part}"
26fi
27
28mkdir -p /mnt/flash
29mount -t jffs2 /dev/mtdblock${test_part} /mnt/flash
30if [ $? -eq 0 ]; then
31 echo "PASS: mount partition ${test_part} as /mnt/flash"
32else
33 echo "FAIL: mount partition ${test_part} as /mnt/flash"
34fi
35
36cd /mnt/flash
37touch test
38if [ $(ls | grep -c 'test') ]; then
39 echo "PASS: touch a file on partition ${test_part}"
40else
41 echo "FAIL: touch a file on partition ${test_part}"
42fi
43
44cd ~
45umount /mnt/flash