summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/tests
Commit message (Collapse)AuthorAgeFilesLines
* mtd: tests: don't use mtd0 as a defaultWolfram Sang2011-10-307-7/+55
| | | | | | | | | | | mtd tests may erase the mtd device, so force the user to specify which mtd device to test by using the module parameter. Disable the default (using mtd0) since this may destroy a vital part of the flash if the module is inserted accidently or carelessly. Reported-by: Roland Kletzing <devzero@web.de> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@intel.com>
* mtd: utilize `mtd_is_*()' functionsBrian Norris2011-09-216-25/+25
| | | | | Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
* mtd: rename MTD_OOB_* to MTD_OPS_*Brian Norris2011-09-112-13/+13
| | | | | | | | | | These modes are not necessarily for OOB only. Particularly, MTD_OOB_RAW affected operations on in-band page data as well. To clarify these options and to emphasize that their effect is applied per-operation, we change the primary prefix to MTD_OPS_. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
* mtd: tests: ignore corrected bitflips in OOB on mtd_readtestBrian Norris2011-09-111-1/+2
| | | | | | | | read_oob may now return ECC error codes. If the code is -EUCLEAN, then we can safely ignore the error as a corrected bitflip. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
* mtd: speedtest: fix integer overflowDavid Lambert2011-03-111-7/+7
| | | | | | | | | 32-bit integers used in 'calc_speed()' may overflow and lead to incorrect results. Use 64-bit integers instead. Signed-off-by: David Lambert <dave@lambsys.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: tests: add multiblock erase test to the mtd_speedtestRoman Tereshonkov2011-03-111-2/+57
| | | | | | | | | | New multiblock erase speed test is added to mtd_speedtest. It consists of 2-, 4-, 8-, 16-, 32- and 64-blocks at once multiblock erase tests. Signed-off-by: Roman Tereshonkov <roman.tereshonkov@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: tests: add count parameter to mtd_speedtestAdrian Hunter2011-03-111-2/+13
| | | | | | | | | | | | | By default mtd_speedtest uses all the eraseblocks of the MTD partition being tested. For large partitions a smaller number is sufficient and makes running the test quicker. For that reason, add a parameter 'count' to specify the maximum number of eraseblocks to use for testing. Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: tests: print correct valuesRoman Tereshonkov2011-03-111-5/+5
| | | | | | | | | The ebcnt and pgcnt variable initialization is moved before printk which uses them. Signed-off-by: Roman Tereshonkov <roman.tereshonkov@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: tests: return -1 if verify failedRoel Kluin2010-08-021-5/+4
| | | | | | Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* drivers/mtd: Use kzallocJulia Lawall2010-05-135-10/+5
| | | | | | | | | | | | | | | | | | | | | | Use kzalloc rather than the combination of kmalloc and memset. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression x,size,flags; statement S; @@ -x = kmalloc(size,flags); +x = kzalloc(size,flags); if (x == NULL) S -memset(x, 0, size); // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* include cleanup: Update gfp.h and slab.h includes to prepare for breaking ↵Tejun Heo2010-03-308-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | implicit slab.h inclusion from percpu.h percpu.h is included by sched.h and module.h and thus ends up being included when building most .c files. percpu.h includes slab.h which in turn includes gfp.h making everything defined by the two files universally available and complicating inclusion dependencies. percpu.h -> slab.h dependency is about to be removed. Prepare for this change by updating users of gfp and slab facilities include those headers directly instead of assuming availability. As this conversion needs to touch large number of source files, the following script is used as the basis of conversion. http://userweb.kernel.org/~tj/misc/slabh-sweep.py The script does the followings. * Scan files for gfp and slab usages and update includes such that only the necessary includes are there. ie. if only gfp is used, gfp.h, if slab is used, slab.h. * When the script inserts a new include, it looks at the include blocks and try to put the new include such that its order conforms to its surrounding. It's put in the include block which contains core kernel includes, in the same order that the rest are ordered - alphabetical, Christmas tree, rev-Xmas-tree or at the end if there doesn't seem to be any matching order. * If the script can't find a place to put a new include (mostly because the file doesn't have fitting include block), it prints out an error message indicating which .h file needs to be added to the file. The conversion was done in the following steps. 1. The initial automatic conversion of all .c files updated slightly over 4000 files, deleting around 700 includes and adding ~480 gfp.h and ~3000 slab.h inclusions. The script emitted errors for ~400 files. 2. Each error was manually checked. Some didn't need the inclusion, some needed manual addition while adding it to implementation .h or embedding .c file was more appropriate for others. This step added inclusions to around 150 files. 3. The script was run again and the output was compared to the edits from #2 to make sure no file was left behind. 4. Several build tests were done and a couple of problems were fixed. e.g. lib/decompress_*.c used malloc/free() wrappers around slab APIs requiring slab.h to be added manually. 5. The script was run on all .h files but without automatically editing them as sprinkling gfp.h and slab.h inclusions around .h files could easily lead to inclusion dependency hell. Most gfp.h inclusion directives were ignored as stuff from gfp.h was usually wildly available and often used in preprocessor macros. Each slab.h inclusion directive was examined and added manually as necessary. 6. percpu.h was updated not to include slab.h. 7. Build test were done on the following configurations and failures were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my distributed build env didn't work with gcov compiles) and a few more options had to be turned off depending on archs to make things build (like ipr on powerpc/64 which failed due to missing writeq). * x86 and x86_64 UP and SMP allmodconfig and a custom test config. * powerpc and powerpc64 SMP allmodconfig * sparc and sparc64 SMP allmodconfig * ia64 SMP allmodconfig * s390 SMP allmodconfig * alpha SMP allmodconfig * um on x86_64 SMP allmodconfig 8. percpu.h modifications were reverted so that it could be applied as a separate patch and serve as bisection point. Given the fact that I had only a couple of failures from tests on step 6, I'm fairly confident about the coverage of this conversion patch. If there is a breakage, it's likely to be something in one of the arch headers which should be easily discoverable easily on most builds of the specific arch. Signed-off-by: Tejun Heo <tj@kernel.org> Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
* mtd: tests: fix read, speed and stress tests on NOR flashMorten Thunberg Svendsen2010-01-133-3/+16
| | | | | | | | | | Before using block_isbad() check if mtd->block_isbad() is defined. Calculating pgcnt must be done using pgsize defined to 512 on NOR and mtd->writesize for NAND, not using mtd->writesize directly. Signed-off-by: Morten Thunberg Svendsen <mts.doredevelopment@gmail.com> Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: make pagetest workArtem Bityutskiy2009-11-301-0/+1
| | | | | | | | | The mtd_pagetest test did not initialize the pgsize variable, which basically means it did not work. This problem was reported by Török Edwin <edwintorok@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: add nand_ecc test moduleAkinobu Mita2009-11-302-0/+88
| | | | | | | | | | | | | | | | This module tests NAND ECC functions. The test is simple. 1. Create a 256 or 512 bytes block of data filled with random bytes (data) 2. Duplicate the data block and inject single bit error (error_data) 3. Try to correct error_data 4. Compare data and error_data Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Acked-by: Vimal Singh <vimalsingh@ti.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: cleanup mtd_oobtestAkinobu Mita2009-10-171-14/+4
| | | | | | | | | | | - Remove unnecessary memset for bbt All entries will be initialized at a few lines below - Remove unnecessary initialization for mtd->erasesize - Use write_whole_device() Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* mtd: tests: fix read buffer overflowsRoel Kluin2009-09-042-7/+7
| | | | | | | | Check whether index is within bounds before testing the element. Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* trivial: NULL noise: drivers/mtd/tests/mtd_*test.cHannes Eder2009-03-302-13/+13
| | | | | | | | | | | | | | | | | | | | | Fix this sparse warnings: drivers/mtd/tests/mtd_oobtest.c:139:33: warning: Using plain integer as NULL pointer drivers/mtd/tests/mtd_oobtest.c:192:33: warning: Using plain integer as NULL pointer drivers/mtd/tests/mtd_oobtest.c:219:41: warning: Using plain integer as NULL pointer drivers/mtd/tests/mtd_oobtest.c:284:25: warning: Using plain integer as NULL pointer drivers/mtd/tests/mtd_oobtest.c:525:25: warning: Using plain integer as NULL pointer drivers/mtd/tests/mtd_oobtest.c:545:25: warning: Using plain integer as NULL pointer drivers/mtd/tests/mtd_oobtest.c:569:33: warning: Using plain integer as NULL pointer drivers/mtd/tests/mtd_oobtest.c:589:33: warning: Using plain integer as NULL pointer drivers/mtd/tests/mtd_oobtest.c:613:33: warning: Using plain integer as NULL pointer drivers/mtd/tests/mtd_oobtest.c:633:33: warning: Using plain integer as NULL pointer drivers/mtd/tests/mtd_oobtest.c:673:41: warning: Using plain integer as NULL pointer drivers/mtd/tests/mtd_oobtest.c:701:33: warning: Using plain integer as NULL pointer drivers/mtd/tests/mtd_readtest.c:74:41: warning: Using plain integer as NULL pointer Signed-off-by: Hannes Eder <hannes@hanneseder.net> Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* [MTD] [TESTS] Fix some size_t printk format warningsDavid Woodhouse2009-01-052-4/+4
| | | | Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
* MTD: add MTD tests to compilationArtem Bityutskiy2008-12-101-0/+7
| | | | | | Add MTD tests to Kconfig and Makefiles. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* MTD: tests: add mtd_torturetestArtem Bityutskiy2008-12-101-0/+530
| | | | | | | This test is designed to work for very long time and it tries to wear few eraseblocks. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* MTD: tests: add mtd_subpagetestArtem Bityutskiy2008-12-081-0/+525
| | | | | | This tests makes sure sub-pages on NAND MTD device work fine. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* MTD: tests: add mtd_stresstestArtem Bityutskiy2008-12-081-0/+330
| | | | | | This test just performs random operations on random eraseblocks. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* MTD: tests: add mtd_speedtestArtem Bityutskiy2008-12-081-0/+502
| | | | | | This test examines I/O speed of the flash device. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* MTD: tests: add mtd_readtestArtem Bityutskiy2008-12-081-0/+253
| | | | | | A simple tests which reads whole MTD device one page at a time. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* MTD: tests: add mtd_pagetestArtem Bityutskiy2008-12-081-0/+632
| | | | | | This test checks that NAND pages read/write work fine. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
* MTD: tests: add mtd_oobtestArtem Bityutskiy2008-12-081-0/+742
This test checks that OOB of a NAND MTD device works fine. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>