From: Sheng Yong <shengyo...@xiaomi.com>

Signed-off-by: Sheng Yong <shengyo...@xiaomi.com>
---
 tests/f_sb_errors/README    |  5 +++++
 tests/f_sb_errors/expect.in |  7 +++++++
 tests/f_sb_errors/script    | 22 ++++++++++++++++++++++
 3 files changed, 34 insertions(+)
 create mode 100644 tests/f_sb_errors/README
 create mode 100644 tests/f_sb_errors/expect.in
 create mode 100644 tests/f_sb_errors/script

diff --git a/tests/f_sb_errors/README b/tests/f_sb_errors/README
new file mode 100644
index 000000000000..df118e825aac
--- /dev/null
+++ b/tests/f_sb_errors/README
@@ -0,0 +1,5 @@
+1. create f2fs image
+2. inject s_stop_reason in super block
+3. fsck -a detects error and clear the error
+4. inject s_errors in super block
+5. fsck -a detects error and clear the error
diff --git a/tests/f_sb_errors/expect.in b/tests/f_sb_errors/expect.in
new file mode 100644
index 000000000000..7985a28e59ab
--- /dev/null
+++ b/tests/f_sb_errors/expect.in
@@ -0,0 +1,7 @@
+Info: Automatic fix mode enabled.
+Info: checkpoint stop reason: fault_inject(1)
+Info: Automatic fix mode enabled.
+Info: fs errors: fail_decompression
+Info: Automatic fix mode enabled.
+Info: No error was reported
+Info: Force to fix corruption
diff --git a/tests/f_sb_errors/script b/tests/f_sb_errors/script
new file mode 100644
index 000000000000..d625900192ff
--- /dev/null
+++ b/tests/f_sb_errors/script
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+DESC="superblock[1] with s_stop_reason and s_errors"
+
+. $TOPDIR/tests/helpers
+
+cleanup
+make_f2fs > $LOG
+
+$INJECT --sb 1 --mb s_stop_reason --idx 1 --val 1 $META >> $LOG
+$FSCK $FSCK_OPTS -a $META > $OUT
+
+$INJECT --sb 1 --mb s_errors --idx 0 --val 2 $META >> $LOG
+$FSCK $FSCK_OPTS -a $META >> $OUT
+
+# both -a and -f cannot detect errors
+$FSCK $FSCK_OPTS -a $META >> $OUT
+echo "" >> $OUT
+$FSCK $FSCK_OPTS -f $META >> $OUT
+cat $OUT >> $LOG
+
+check_result
-- 
2.43.0



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to