diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2020-10-24 00:29:45 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2020-10-24 01:42:16 +0200 |
commit | be94410446d381ab0512d347421a921c7966a10e (patch) | |
tree | b126b159f8be4d624c55452dfb8ff582376b7d6a | |
parent | 8c2779ba349e5ced3c9ea440929a6808ca443bf4 (diff) | |
download | lvm2-be94410446d381ab0512d347421a921c7966a10e.tar.gz |
tests: fsadm test continue after fs repair
Test case where filesystem has been corrected via fsck.
In such case fsck returns '1' as success and should be
handled in a same way as '0' since fs is correct.
-rw-r--r-- | test/shell/fsadm.sh | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/test/shell/fsadm.sh b/test/shell/fsadm.sh index 8141da42c..3e7f9083c 100644 --- a/test/shell/fsadm.sh +++ b/test/shell/fsadm.sh @@ -61,7 +61,8 @@ cleanup_mounted_and_teardown() fscheck_ext3() { - fsck.ext3 -p -F -f "$dev_vg_lv" + # fsck with result code '1' is success + fsck.ext3 -p -F -f "$dev_vg_lv" || test "$?" -eq 1 } fscheck_xfs() @@ -113,6 +114,30 @@ if check_missing ext2; then fscheck_ext3 lvresize -f -L20M $vg_lv + + if which debugfs ; then + mkfs.ext2 -b4096 -j "$dev_vg_lv" + mount "$dev_vg_lv" "$mount_dir" + touch "$mount_dir/file" + umount "$mount_dir" + # generate a 'repariable' corruption + # so fsck returns code 1 (fs repaired) + debugfs -R "clri file" -w "$dev_vg_lv" + + fsadm -v -f check "$dev_vg_lv" + + # corrupting again + mount "$dev_vg_lv" "$mount_dir" + touch "$mount_dir/file" + umount "$mount_dir" + debugfs -R "clri file" -w "$dev_vg_lv" + + mount "$dev_vg_lv" "$mount_dir" + fsadm -v -y --lvresize resize $vg_lv 10M + lvresize -L+10M -y -r -n $vg_lv + umount "$mount_dir" 2>/dev/null || true + fscheck_ext3 + fi fi if check_missing ext3; then |