[PATCH mtd-utils] mtd: tests: check erase block count in page test

Stefan Agner stefan at agner.ch
Sat Mar 3 14:39:46 PST 2018


When there is only a single erase block, the cross erase test
does not report sensible errors. Warn in case there is only
a single erase block instead of executing the test.

Signed-off-by: Stefan Agner <stefan at agner.ch>
---
 tests/mtd-tests/nandpagetest.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tests/mtd-tests/nandpagetest.c b/tests/mtd-tests/nandpagetest.c
index c6812df..115cedb 100644
--- a/tests/mtd-tests/nandpagetest.c
+++ b/tests/mtd-tests/nandpagetest.c
@@ -551,8 +551,12 @@ int main(int argc, char **argv)
 	}
 	printf("verified %u eraseblocks\n", i);
 
-	if (crosstest())
-		goto out;
+	if (ebcnt > 1) {
+		if (crosstest())
+			goto out;
+	} else {
+		printf("skipping erasecrosstest, 2 erase blocks needed\n");
+	}
 
 	if (erasecrosstest())
 		goto out;
-- 
2.16.2




More information about the linux-mtd mailing list