diff options
Diffstat (limited to 'recipes-test/ddt-runner/files/scripts/acp3448v2/flash')
| -rwxr-xr-x | recipes-test/ddt-runner/files/scripts/acp3448v2/flash | 45 |
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 | |||
| 5 | if part_num=`cat /proc/mtd | grep -c 'mtd'`; then | ||
| 6 | echo "PASS: show $part_num partitions" | ||
| 7 | else | ||
| 8 | echo "FAIL: show $part_num partitions" | ||
| 9 | fi | ||
| 10 | |||
| 11 | for((part=0; part<$part_num-1; part++)); | ||
| 12 | do | ||
| 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 | ||
| 18 | done | ||
| 19 | |||
| 20 | let "test_part=part_num-2" | ||
| 21 | |||
| 22 | if [ $(flash_erase -j /dev/mtd${test_part} 0 0 | grep -c '100 % complete') ]; then | ||
| 23 | echo "PASS: erase and format partition ${test_part}" | ||
| 24 | else | ||
| 25 | echo "FAIL: erase and format partition ${test_part}" | ||
| 26 | fi | ||
| 27 | |||
| 28 | mkdir -p /mnt/flash | ||
| 29 | mount -t jffs2 /dev/mtdblock${test_part} /mnt/flash | ||
| 30 | if [ $? -eq 0 ]; then | ||
| 31 | echo "PASS: mount partition ${test_part} as /mnt/flash" | ||
| 32 | else | ||
| 33 | echo "FAIL: mount partition ${test_part} as /mnt/flash" | ||
| 34 | fi | ||
| 35 | |||
| 36 | cd /mnt/flash | ||
| 37 | touch test | ||
| 38 | if [ $(ls | grep -c 'test') ]; then | ||
| 39 | echo "PASS: touch a file on partition ${test_part}" | ||
| 40 | else | ||
| 41 | echo "FAIL: touch a file on partition ${test_part}" | ||
| 42 | fi | ||
| 43 | |||
| 44 | cd ~ | ||
| 45 | umount /mnt/flash | ||
