ubi: Add six fault injection type for testing
authorZhaoLong Wang <wangzhaolong1@huawei.com>
Tue, 26 Dec 2023 01:01:11 +0000 (09:01 +0800)
committerRichard Weinberger <richard@nod.at>
Sat, 6 Jan 2024 22:41:40 +0000 (23:41 +0100)
commit7cd8d1f8475d83c8871917430a2daf362c68e742
treeb27963949e320354528562eaae0b260e71763dd8
parente30948f7c0730d9fb2271ff3eadd43eda4e44740
ubi: Add six fault injection type for testing

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@huawei.com>
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
drivers/mtd/ubi/debug.c
drivers/mtd/ubi/debug.h
drivers/mtd/ubi/io.c
drivers/mtd/ubi/ubi.h