#!/bin/sh # # mtd-test-suite # # The MTD subsystem includes a set of tests which you may run to verify your # flash hardware and drivers. The tests are available in the drivers/mtd/tests # directory of the linux kernel source codes. You may compile the tests as # kernel modules by enabling them in the kernel configuration menu by marking: # "Memory Technology Device (MTD) support" -> "MTD tests support" # (or the MTD_TESTS symbol in the .config file). # # The MTD test-suite contains the following tests: # * mtd_speedtest: measures and reports read/write/erase speed of the MTD # device. # * mtd_stresstest: performs random read/write/erase operations and validates # the MTD device I/O capabilities. # * mtd_readtest: this tests reads whole MTD device, one NAND page at a time # including OOB (or 512 bytes at a time in case of flashes like NOR) and # checks that reading works properly. # * mtd_pagetest: relevant only for NAND flashes, tests NAND page writing and # reading in different sizes and order; this test was originally # developed for testing the OneNAND driver, so it might be a little # OneNAND-oriented, but must work on any NAND flash. # * mtd_oobtest: relevant only for NAND flashes, tests that the OOB area I/O # works properly by writing data to different offsets and verifying it. # * mtd_subpagetest: relevant only for NAND flashes, tests sub-page I/O. # * mtd_torturetest: this test is designed to wear out flash eraseblocks. It # repeatedly writes and erases the same group of eraseblocks until an # I/O error happens, so be careful! The test supports a number of # options (see modinfo mtd_torturetest) which allow you to set the # amount of eraseblocks to torture and how the torturing is done. You # may limit the amount of torturing cycles using the cycles_count module # parameter. It may be very god idea to run this test for some time and # validate your flash driver and HW, providing you have a spare device. # For example, we caught rather rare and nasty DMA issues on an OMAP2 # board with OneNAND flash, just by running this tests for few hours. # * mtd_nandecctest: a simple test that checks correctess of the built-in # software ECC for 256 and 512-byte buffers; this test is not # driver-specific but tests general NAND support code. (NOT APPLICABLE) # # We assume that the mtd4 is available for test. MTD=$1 MTD_TESTS="mtd_oobtest mtd_pagetest mtd_readtest mtd_speedtest mtd_stresstest mtd_subpagetest mtd_torturetest" # Assure all mtd test modules are removed modprobe -r ${MTD_TESTS} # Run test suite for test in ${MTD_TESTS}; do case "$test" in "mtd_torturetest" ) # clean the kernel ring buffer dmesg -c > /dev/null echo "MTD subsystem $test ..." modprobe ${test} dev=${MTD} cycles_count=1 # print out the messages dmesg ;; * ) # clean the kernel ring buffer dmesg -c > /dev/null echo "MTD subsystem $test ..." modprobe ${test} dev=${MTD} # print out the messages dmesg ;; esac done # Remove all mtd test modules modprobe -r ${MTD_TESTS} exit 0