Skip to contentSkip to conversation

mtd-tests: flash_speed: minor fixes

PATCH Applied Gabor Juhos 2 participants 4 messages Jul 23, 2025 – Nov 28, 2025 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

cover mtd-tests: flash_speed: minor fixes

The series contains two small patches for the flash_speed test. The first one prevents running destructive tests if those are not enabled. The second one fixes a presumable copy&paste issue in an error message.

---
Gabor Juhos (2):
mtd-tests: flash_speed: really skip destructive tests
mtd-tests: flash_speed: fix error message in read_eraseblock()

 tests/mtd-tests/flash_speed.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

---
base-commit: 77981a2888c711268b0e7f32af6af159c2288e23
change-id: 20250722-flash_speed-fixes-a1e93dda7781

Best regards,

Signature · 6 lines
Gabor Juhos <[email protected]>


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
#1 lore raw

PATCH 1/2 mtd-tests: flash_speed: really skip destructive tests

Although both the 'multi-block erase' and the 'read-while-write latency' tests are destructive, but those are executed irregardless of whether destructive mode is enabled or not.

Change the code to skip these tests if the DESTRUCTIVE flag is not set to avoid unexpected behaviour.

---
 tests/mtd-tests/flash_speed.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/mtd-tests/flash_speed.c +2 -2
index 11f396c597153632432bdbe6f22369b1a4bb8579..ee162891d5c9288ffb9d09eb2c649db027eedcba 100644
@@ -490,7 +490,7 @@ int main(int argc, char **argv)
 	}
 
 	/* Multi-block erase all eraseblocks */
-	if (!skip) {
+	if (flags & DESTRUCTIVE && !skip) {
 		for (k = 1; k < 7; ++k) {
 			blocks = 1 << k;
 			printf("Testing %dx multi-block erase speed\n", blocks);
@@ -518,7 +518,7 @@ int main(int argc, char **argv)
 	/* Write a page and immediately after try to read another page. Report
 	 * the latency difference when performed on different banks (NOR only).
 	 */
-	if (speb >= 0 && mtd.subpage_size == 1) {
+	if (flags & DESTRUCTIVE && speb >= 0 && mtd.subpage_size == 1) {
 		long rww_duration_w, rww_latency_end;
 		long rww_duration_rnw, rww_duration_r_end;
 		bool rww_r_end_first;
Signature · 6 lines
2.50.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
#2 lore raw

PATCH 2/2 mtd-tests: flash_speed: fix error message in read_eraseblock()

In reply to Gabor Juhos

Replace 'write' with 'read' in the error message of the read_eraseblock() function to indicate the correct direction of the operation.

---
 tests/mtd-tests/flash_speed.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/mtd-tests/flash_speed.c +1 -1
index ee162891d5c9288ffb9d09eb2c649db027eedcba..3319452194a54124a7f691994b41043fe0413229 100644
@@ -190,7 +190,7 @@ static int read_eraseblock(int ebnum)
 {
 	int err = mtd_read(&mtd, fd, ebnum, 0, iobuf, mtd.eb_size);
 	if (err)
-		fprintf(stderr, "Error writing block %d!\n", ebnum);
+		fprintf(stderr, "Error reading block %d!\n", ebnum);
 	return err;
 }
 
Signature · 6 lines
2.50.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/