From 09256fdf15db99ad681ae77e70f66fc9b871ce11 Mon Sep 17 00:00:00 2001 From: Andy Grover Date: Wed, 21 Oct 2020 10:38:23 -0700 Subject: [PATCH] scoutfs-tests: Changes for use of separate block devices for meta and data Add -z option to run-tests.sh to specify metadata device. Do a bunch of things twice. Fix up setup-error-teardown test. Signed-off-by: Andy Grover [zab@versity.com: minor arg message fixes, golden output] --- tests/funcs/fs.sh | 4 +- tests/golden/setup-error-teardown | 2 +- tests/run-tests.sh | 79 ++++++++++++++++++----------- tests/tests/setup-error-teardown.sh | 4 +- tests/tests/xfstests.sh | 2 +- 5 files changed, 56 insertions(+), 35 deletions(-) diff --git a/tests/funcs/fs.sh b/tests/funcs/fs.sh index 11691cb9..d24f818e 100644 --- a/tests/funcs/fs.sh +++ b/tests/funcs/fs.sh @@ -106,7 +106,7 @@ t_mount() test "$nr" -lt "$T_NR_MOUNTS" || \ t_fail "fs nr $nr invalid" - eval t_quiet mount -t scoutfs \$T_O$nr \$T_B$nr \$T_M$nr + eval t_quiet mount -t scoutfs \$T_O$nr \$T_DB$nr \$T_M$nr } t_umount() @@ -116,7 +116,7 @@ t_umount() test "$nr" -lt "$T_NR_MOUNTS" || \ t_fail "fs nr $nr invalid" - eval t_quiet umount \$T_B$i + eval t_quiet umount \$T_DB$i } # diff --git a/tests/golden/setup-error-teardown b/tests/golden/setup-error-teardown index d3b081ff..feb3544c 100644 --- a/tests/golden/setup-error-teardown +++ b/tests/golden/setup-error-teardown @@ -1 +1 @@ -== interrupt waiting mount with no options +== interrupt waiting mount diff --git a/tests/run-tests.sh b/tests/run-tests.sh index af799b31..7167bea4 100755 --- a/tests/run-tests.sh +++ b/tests/run-tests.sh @@ -36,12 +36,12 @@ show_help() cat << EOF $(basename $0) options: -a | Abort after the first test failure, leave fs mounted. - -d | Specify the storage device path that contains the + -D | Specify the filesystem's data device path that contains the | file system to be tested. Will be clobbered by -m mkfs. - -D | Dump accumulated ftrace buffer to the console on oops. -E | Exclude tests whose file name matches the regular expression. | Can be provided multiple times -e | Specify an extra storage device for testing. Will be clobbered. + -F | Dump accumulated ftrace buffer to the console on oops. -I | Include tests whose file name matches the regular expression. | By default all tests are run. If this is provided then | only tests matching will be run. Can be provided multiple @@ -49,12 +49,14 @@ $(basename $0) options: -i | Force removing and inserting the built scoutfs.ko module. -K | scouts-kmod-dev git repo. Used to build kernel module. -k | Branch to checkout in scoutfs-kmod-dev repo. + -M | Specify the filesystem's meta data device path that contains + | the file system to be tested. Will be clobbered by -m mkfs. -m | Run mkfs on the device before mounting and running | tests. Implies unmounting existing mounts first. -n | The number of devices and mounts to test. - -p | Exit script after preparing mounts only, don't run tests. -P | Output trace events with printk as they're generated. - -q | Specify the quorum count needed to mount. This is + -p | Exit script after preparing mounts only, don't run tests. + -q | Specify the quorum count needed to mount. This is | used when running mkfs and is needed by a few tests. -r | Specify the directory in which to store results of | test runs. The directory will be created if it doesn't @@ -83,13 +85,10 @@ while true; do -a) T_ABORT="1" ;; - -d) - test -n "$2" || die "-d must have device file argument" - T_DEVICE="$2" - shift - ;; -D) - T_TRACE_DUMP="1" + test -n "$2" || die "-d must have device file argument" + T_DATA_DEVICE="$2" + shift ;; -E) test -n "$2" || die "-E must have test exclusion regex argument" @@ -101,6 +100,9 @@ while true; do T_EXDEV="$2" shift ;; + -F) + T_TRACE_DUMP="1" + ;; -I) test -n "$2" || die "-I must have test incusion regex argument" T_INCLUDE+="-e '$2' " @@ -119,6 +121,11 @@ while true; do T_KMOD_BRANCH="$2" shift ;; + -M) + test -n "$2" || die "-z must have meta device file argument" + T_META_DEVICE="$2" + shift + ;; -m) T_MKFS="1" ;; @@ -127,12 +134,12 @@ while true; do T_NR_MOUNTS="$2" shift ;; - -p) - T_PREPARE="1" - ;; -P) T_TRACE_PRINTK="1" ;; + -p) + T_PREPARE="1" + ;; -q) test -n "$2" || die "-q must have quorum count argument" T_QUORUM="$2" @@ -180,7 +187,7 @@ while true; do show_help exit 1 ;; - --) + --) break ;; -?*) @@ -196,8 +203,10 @@ while true; do shift done -test -n "$T_DEVICE" || die "must specify -d fs device" -test -e "$T_DEVICE" || die "fs device -d '$T_DEVICE' doesn't exist" +test -n "$T_DATA_DEVICE" || die "must specify -D data device" +test -e "$T_DATA_DEVICE" || die "data device -D '$T_DATA_DEVICE' doesn't exist" +test -n "$T_META_DEVICE" || die "must specify -M meta device" +test -e "$T_META_DEVICE" || die "meta device -M '$T_META_DEVICE' doesn't exist" test -n "$T_EXDEV" || die "must specify -e extra device" test -e "$T_EXDEV" || die "fs device -d '$T_EXDEV' doesn't exist" test -n "$T_KMOD_REPO" || die "must specify -K kmod repo dir" @@ -218,7 +227,7 @@ test "$T_NR_MOUNTS" -ge 1 -a "$T_NR_MOUNTS" -le 8 || \ die "-n nr mounts must be >= 1 and <= 8" # canonicalize paths -for e in T_DEVICE T_EXDEV T_KMOD_REPO T_RESULTS T_UTILS_REPO T_XFSTESTS_REPO; do +for e in T_META_DEVICE T_DATA_DEVICE T_EXDEV T_KMOD_REPO T_RESULTS T_UTILS_REPO T_XFSTESTS_REPO; do eval $e=\"$(readlink -f "${!e}")\" done @@ -311,8 +320,14 @@ unmount_all() { cmd wait $p done - # delete all temp devices - for dev in $(losetup --associated "$T_DEVICE" | cut -d : -f 1); do + # delete all temp meta devices + for dev in $(losetup --associated "$T_META_DEVICE" | cut -d : -f 1); do + if [ -e "$dev" ]; then + cmd losetup -d "$dev" + fi + done + # delete all temp data devices + for dev in $(losetup --associated "$T_DATA_DEVICE" | cut -d : -f 1); do if [ -e "$dev" ]; then cmd losetup -d "$dev" fi @@ -323,7 +338,7 @@ if [ -n "$T_UNMOUNT" ]; then fi if [ -n "$T_MKFS" ]; then - cmd scoutfs mkfs -Q "$T_QUORUM" "$T_DEVICE" + cmd scoutfs mkfs -Q "$T_QUORUM" "$T_META_DEVICE" "$T_DATA_DEVICE" fi if [ -n "$T_INSMOD" ]; then @@ -354,19 +369,21 @@ fi # mount concurrently so that a quorum is present to elect the leader and # start a server. # -msg "mounting $T_NR_MOUNTS mounts on $T_DEVICE" +msg "mounting $T_NR_MOUNTS mounts on meta $T_META_DEVICE data $T_DATA_DEVICE" pids="" for i in $(seq 0 $((T_NR_MOUNTS - 1))); do - opts="-o server_addr=127.0.0.1" - dev=$(losetup --find --show $T_DEVICE) - test -b "$dev" || die "failed to create temp device $dev" + meta_dev=$(losetup --find --show $T_META_DEVICE) + test -b "$meta_dev" || die "failed to create temp device $meta_dev" + data_dev=$(losetup --find --show $T_DATA_DEVICE) + test -b "$data_dev" || die "failed to create temp device $data_dev" dir="/mnt/test.$i" test -d "$dir" || cmd mkdir -p "$dir" - msg "mounting $dev on $dir" - cmd mount -t scoutfs $opts "$dev" "$dir" & + msg "mounting $meta_dev/$data_dev on $dir" + opts="-o server_addr=127.0.0.1,metadev_path=$meta_dev" + cmd mount -t scoutfs $opts "$data_dev" "$dir" & p="$!" pids="$pids $!" log "background mount $i pid $p" @@ -375,9 +392,13 @@ for i in $(seq 0 $((T_NR_MOUNTS - 1))); do T_O[$i]="$opts" T_OS+="$opts " - eval T_B$i=$dev - T_B[$i]=$dev - T_BS+="$dev " + eval T_MB$i=$meta_dev + T_MB[$i]=$meta_dev + T_MBS+="$meta_dev " + + eval T_DB$i=$data_dev + T_DB[$i]=$data_dev + T_DBS+="$data_dev " eval T_M$i=\"$dir\" T_M[$i]=$dir diff --git a/tests/tests/setup-error-teardown.sh b/tests/tests/setup-error-teardown.sh index de450067..1cbf65c6 100644 --- a/tests/tests/setup-error-teardown.sh +++ b/tests/tests/setup-error-teardown.sh @@ -7,9 +7,9 @@ t_require_commands sleep killall -echo "== interrupt waiting mount with no options" +echo "== interrupt waiting mount" t_umount_all -mount -t scoutfs $T_B0 $T_M0 & +mount -t scoutfs -o metadev_path=$T_MB0 $T_DB0 $T_M0 & pid="$!" sleep .1 kill $pid diff --git a/tests/tests/xfstests.sh b/tests/tests/xfstests.sh index e649228b..07ed36da 100644 --- a/tests/tests/xfstests.sh +++ b/tests/tests/xfstests.sh @@ -35,7 +35,7 @@ t_quiet sync cat << EOF > local.config export FSTYP=scoutfs export MKFS_OPTIONS="-Q 1" -export TEST_DEV=$T_B0 +export TEST_DEV=$T_DB0 export TEST_DIR=$T_M0 export SCRATCH_DEV=$T_EXDEV export SCRATCH_MNT="$T_TMPDIR/mnt.scratch"