#!/bin/sh # # This script is used to test flash driver functionality. I removed the tests # which include write operations since all partition are in use in bsc9131rdb # 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: $part_num partitions found" else echo "FAIL: $part_num partitions found" 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 > NULL modprobe $READ_TEST dev=$part bad_num=`dmesg | grep -c 'bad'` if [ $bad_num -eq 0 ]; then echo "PASS: read test for partition $part" else echo "FAIL: read test for partition $part" fi rmmod $READ_TEST done