diff options
author | Miquel Raynal <miquel.raynal@bootlin.com> | 2024-08-26 11:46:24 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2024-10-08 08:14:42 +0200 |
commit | 4bcf49043e7c59284c9dfd41c67d10b7b925e840 (patch) | |
tree | faf9465bb91812ce3b92b24c35cbf31542b14b89 /tests | |
parent | 8e64d114e1016ba90bce54dc37d91277f0f2f282 (diff) |
mtd-tests: nandbiterrs: Add support for testing continuous reads
In order to trigger a continuous read, the user needs to request at
least two pages at the same time. So far the tool would only read single
pages, so let's extend its capabilities to test continuous read output
when the -c option is passed.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/mtd-tests/nandbiterrs.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/tests/mtd-tests/nandbiterrs.c b/tests/mtd-tests/nandbiterrs.c index 30954f5..424a95f 100644 --- a/tests/mtd-tests/nandbiterrs.c +++ b/tests/mtd-tests/nandbiterrs.c @@ -63,6 +63,7 @@ #define MODE_INCREMENTAL 0x02 #define MODE_OVERWRITE 0x04 #define PAGE_ERASED 0x08 +#define CONTINUOUS_READ 0x10 static int peb = -1, page = -1, max_overwrite = -1, seed = -1; static const char *mtddev; @@ -81,6 +82,7 @@ static const struct option options[] = { { "erased", no_argument, NULL, 'e' }, { "writes", required_argument, NULL, 'w' }, { "incremental", no_argument, NULL, 'i' }, + { "continuous", no_argument, NULL, 'c' }, { "overwrite", no_argument, NULL, 'o' }, { NULL, 0, NULL, 0 }, }; @@ -95,7 +97,8 @@ static NORETURN void usage(int status) " -b, --peb <num> Use this physical erase block\n" " -p, --page <num> Use this page within the erase block\n" " -s, --seed <num> Specify seed for PRNG\n" - " -e, --erased Test erased pages instead of written pages\n\n" + " -e, --erased Test erased pages instead of written pages\n" + " -c, --continuous Use two consecutive pages (incremental test only)\n\n" "Options controling test mode:\n" " -i, --incremental Manually insert bit errors until ECC fails\n" " -o, --overwrite Rewrite page until bits flip and ECC fails\n\n" @@ -124,7 +127,7 @@ static void process_options(int argc, char **argv) int c; while (1) { - c = getopt_long(argc, argv, "hkb:p:s:eiow:", options, NULL); + c = getopt_long(argc, argv, "hkb:p:s:eiow:c", options, NULL); if (c == -1) break; @@ -175,6 +178,9 @@ static void process_options(int argc, char **argv) case 'e': flags |= PAGE_ERASED; break; + case 'c': + flags |= CONTINUOUS_READ; + break; case 'h': usage(EXIT_SUCCESS); default: @@ -193,6 +199,9 @@ static void process_options(int argc, char **argv) if (!(flags & (MODE_OVERWRITE|MODE_INCREMENTAL))) errmsg_die("No test mode specified!"); + if (flags & CONTINUOUS_READ && !(flags & MODE_INCREMENTAL)) + errmsg_die("Use --continuous with --incremental only!"); + if ((max_overwrite > 0) && !(flags & MODE_OVERWRITE)) errmsg_die("Write count specified but mode is not --overwrite!"); @@ -461,7 +470,10 @@ int main(int argc, char **argv) pagesize = mtd.subpage_size; pagecount = mtd.eb_size / pagesize; - bs = pagesize; + if (!(flags & CONTINUOUS_READ)) + bs = pagesize; + else + bs = 2 * pagesize; if (peb >= mtd.eb_cnt) return errmsg("Physical erase block %d is out of range!", peb); |