Re: [PATCH v4 3/5] ubi: Add six fault injection type for testing

From: Zhihao Cheng
Date: Fri Nov 03 2023 - 07:36:46 EST


在 2023/11/3 14:55, ZhaoLong Wang 写道:
This commit adds six fault injection type for testing to cover the
abnormal path of the UBI driver.

Inject the following faults when the UBI reads the LEB:
+----------------------------+-----------------------------------+
| Interface name | emulate behavior |
+----------------------------+-----------------------------------+
| emulate_eccerr | ECC error |
+----------------------------+-----------------------------------+
| emulate_read_failure | read failure |
|----------------------------+-----------------------------------+
| emulate_io_ff | read content as all FF |
|----------------------------+-----------------------------------+
| emulate_io_ff_bitflips | content FF with MTD err reported |
+----------------------------+-----------------------------------+
| emulate_bad_hdr | bad leb header |
|----------------------------+-----------------------------------+
| emulate_bad_hdr_ebadmsg | bad header with ECC err |
+----------------------------+-----------------------------------+

Signed-off-by: ZhaoLong Wang <wangzhaolong1@xxxxxxxxxx>
---
drivers/mtd/ubi/debug.c | 30 +++++++
drivers/mtd/ubi/debug.h | 172 ++++++++++++++++++++++++++++++++++++++--
drivers/mtd/ubi/io.c | 76 +++++++++++++++++-
drivers/mtd/ubi/ubi.h | 30 ++++---
4 files changed, 287 insertions(+), 21 deletions(-)

Reviewed-by: Zhihao Cheng <chengzhihao1@xxxxxxxxxx>