diff --git a/tests/funcs/filter.sh b/tests/funcs/filter.sh index 8d632f34..6d1185f6 100644 --- a/tests/funcs/filter.sh +++ b/tests/funcs/filter.sh @@ -56,8 +56,11 @@ t_filter_dmesg() re="$re|scoutfs .*: all clients recovered" re="$re|scoutfs .* error: client rid.*lock recovery timed out" - # some tests mount w/o options + # we test bad devices and options re="$re|scoutfs .* error: Required mount option \"metadev_path\" not found" + re="$re|scoutfs .* error: meta_super META flag not set" + re="$re|scoutfs .* error: could not open metadev:.*" + re="$re|scoutfs .* error: Unknown or malformed option,.*" # in debugging kernels we can slow things down a bit re="$re|hrtimer: interrupt took .*" diff --git a/tests/golden/basic-bad-mounts b/tests/golden/basic-bad-mounts new file mode 100644 index 00000000..6c84453f --- /dev/null +++ b/tests/golden/basic-bad-mounts @@ -0,0 +1,6 @@ +== prepare devices, mount point, and logs +== bad devices, bad options +== swapped devices +== both meta devices +== both data devices +== good volume, bad option and good options diff --git a/tests/sequence b/tests/sequence index b86452dd..40c82e52 100644 --- a/tests/sequence +++ b/tests/sequence @@ -1,5 +1,6 @@ export-get-name-parent.sh basic-block-counts.sh +basic-bad-mounts.sh inode-items-updated.sh simple-inode-index.sh simple-staging.sh diff --git a/tests/tests/basic-bad-mounts.sh b/tests/tests/basic-bad-mounts.sh new file mode 100644 index 00000000..f7bd80c8 --- /dev/null +++ b/tests/tests/basic-bad-mounts.sh @@ -0,0 +1,36 @@ + +mount_fail() +{ + local mnt=${!#} + + echo "mounting $@" >> $T_TMP.mount.out + mount -t scoutfs "$@" >> $T_TMP.mount.out 2>&1 + if [ $? == 0 ]; then + umount "$mnt" || t_fail "couldn't unmount" + t_fail "bad mount succeeded" + fi +} + +echo "== prepare devices, mount point, and logs" +SCR="/mnt/scoutfs.extra" +mkdir -p "$SCR" +> $T_TMP.mount.out +scoutfs mkfs -f -Q 0,127.0.0.1,53000 "$T_EX_META_DEV" "$T_EX_DATA_DEV" > $T_TMP.mkfs.out 2>&1 \ + || t_fail "mkfs failed" + +echo "== bad devices, bad options" +mount_fail -o _bad /dev/null /dev/null "$SCR" + +echo "== swapped devices" +mount_fail -o metadev_path=$T_EX_DATA_DEV,quorum_slot_nr=0 "$T_EX_META_DEV" "$SCR" + +echo "== both meta devices" +mount_fail -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$T_EX_META_DEV" "$SCR" + +echo "== both data devices" +mount_fail -o metadev_path=$T_EX_DATA_DEV,quorum_slot_nr=0 "$T_EX_DATA_DEV" "$SCR" + +echo "== good volume, bad option and good options" +mount_fail -o _bad,metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$T_EX_DATA_DEV" "$SCR" + +t_pass