#!/bin/sh # # This script is used to test flash driver functionality. I removed the write # operations since all partition are in use in p2041rdb and there might be # possibility of corrupting data even if we backup in test script. if part_num=`cat /proc/mtd | grep -c 'mtd'`; then echo "PASS: show $part_num partitions" else echo "FAIL: show $part_num partitions" exit 1 fi for((part=0; part<$part_num; part++)); do if [ $(mtd_debug info /dev/mtd$part | grep -c 'mtd.type') ]; then echo "PASS: show partition $part debug info" else echo "FAIL: show partition $part debug info" exit 1 fi done READ_TEST=`find / -name mtd_readtest.ko -print` if [ ! -e $READ_TEST ]; then echo "FAIL: $READ_TEST does not exist" exit 1 else echo "PASS: $READ_TEST exists" fi for((part=0; part<$part_num; part++)); do dmesg -c insmod $READ_TEST dev=$part finish=`dmesg | grep -c 'mtd_readtest: finished'` if [ $finish -eq 1 ]; then echo "PASS: read test $part" else echo "FAIL: read test $part" rmmod $READ_TEST exit 1 fi rmmod $READ_TEST done