From 64a698aa937aabf619d065b652392020b7873518 Mon Sep 17 00:00:00 2001 From: Andy Grover Date: Mon, 4 Jan 2021 16:27:27 -0800 Subject: [PATCH] Make changes to tests for new scoutfs cmdline syntax Some different error message require changes to golden/* Signed-off-by: Andy Grover --- tests/funcs/fs.sh | 4 +- tests/golden/offline-extent-waiting | 4 +- tests/golden/setattr_more | 8 ++-- tests/golden/simple-release-extents | 16 ++++---- tests/golden/simple-staging | 10 ++--- tests/tests/archive-light-cycle.sh | 4 +- tests/tests/basic-block-counts.sh | 16 ++++---- tests/tests/basic-posix-consistency.sh | 24 +++++------ tests/tests/inode-items-updated.sh | 6 +-- tests/tests/lock-pr-cw-conflict.sh | 2 +- tests/tests/offline-extent-waiting.sh | 54 ++++++++++++------------- tests/tests/setattr_more.sh | 22 +++++----- tests/tests/simple-inode-index.sh | 4 +- tests/tests/simple-release-extents.sh | 28 ++++++------- tests/tests/simple-staging.sh | 34 ++++++++-------- tests/tests/srch-basic-functionality.sh | 2 +- tests/tests/stage-multi-part.sh | 6 +-- tests/tests/stage-release-race-alloc.sh | 6 +-- 18 files changed, 125 insertions(+), 125 deletions(-) diff --git a/tests/funcs/fs.sh b/tests/funcs/fs.sh index 84c1adb4..160f00df 100644 --- a/tests/funcs/fs.sh +++ b/tests/funcs/fs.sh @@ -28,8 +28,8 @@ t_ident() local fsid local rid - fsid=$(scoutfs statfs -s fsid "$mnt") - rid=$(scoutfs statfs -s rid "$mnt") + fsid=$(scoutfs statfs -s fsid -p "$mnt") + rid=$(scoutfs statfs -s rid -p "$mnt") echo "f.${fsid:0:6}.r.${rid:0:6}" } diff --git a/tests/golden/offline-extent-waiting b/tests/golden/offline-extent-waiting index 5b163cc9..5b4af2d2 100644 --- a/tests/golden/offline-extent-waiting +++ b/tests/golden/offline-extent-waiting @@ -1,6 +1,6 @@ == create files == waiter shows up in ioctl -offline wating should be empty: +offline waiting should be empty: 0 offline waiting should now have one known entry: == multiple waiters on same block listed once @@ -8,7 +8,7 @@ offline waiting still has one known entry: == different blocks show up offline waiting now has two known entries: == staging wakes everyone -offline wating should be empty again: +offline waiting should be empty again: 0 == interruption does no harm offline waiting should now have one known entry: diff --git a/tests/golden/setattr_more b/tests/golden/setattr_more index dd80461f..040ffe07 100644 --- a/tests/golden/setattr_more +++ b/tests/golden/setattr_more @@ -1,9 +1,9 @@ == 0 data_version arg fails -setattr_more ioctl failed on '/mnt/test/test/setattr_more/file': Invalid argument (22) -scoutfs: setattr failed: Invalid argument (22) +setattr: data version must not be 0 +Try `setattr --help' or `setattr --usage' for more information. == args must specify size and offline -setattr_more ioctl failed on '/mnt/test/test/setattr_more/file': Invalid argument (22) -scoutfs: setattr failed: Invalid argument (22) +setattr: must provide size if using --offline option +Try `setattr --help' or `setattr --usage' for more information. == only works on regular files failed to open '/mnt/test/test/setattr_more/dir': Is a directory (21) scoutfs: setattr failed: Is a directory (21) diff --git a/tests/golden/simple-release-extents b/tests/golden/simple-release-extents index c28511cc..44305fd1 100644 --- a/tests/golden/simple-release-extents +++ b/tests/golden/simple-release-extents @@ -8,16 +8,16 @@ release ioctl failed: Invalid argument (22) scoutfs: release failed: Invalid argument (22) == releasing non-file fails -ioctl failed on '/mnt/test/test/simple-release-extents/file-char': Inappropriate ioctl for device (25) -release ioctl failed: Inappropriate ioctl for device (25) -scoutfs: release failed: Inappropriate ioctl for device (25) +ioctl failed: Inappropriate ioctl for device (25) +release: must provide file version --data-version +Try `release --help' or `release --usage' for more information. == releasing a non-scoutfs file fails -ioctl failed on '/dev/null': Inappropriate ioctl for device (25) -release ioctl failed: Inappropriate ioctl for device (25) -scoutfs: release failed: Inappropriate ioctl for device (25) +ioctl failed: Inappropriate ioctl for device (25) +release: must provide file version --data-version +Try `release --help' or `release --usage' for more information. == releasing bad version fails -release ioctl failed: Stale file handle (116) -scoutfs: release failed: Stale file handle (116) +release: must provide file version --data-version +Try `release --help' or `release --usage' for more information. == verify small release merging 0 0 0: (0 0 1) (1 101 4) 0 0 1: (0 0 2) (2 102 3) diff --git a/tests/golden/simple-staging b/tests/golden/simple-staging index bc3d10ca..d05c8496 100644 --- a/tests/golden/simple-staging +++ b/tests/golden/simple-staging @@ -4,8 +4,8 @@ == release+stage shouldn't change stat, data seq or vers == stage does change meta_seq == can't use stage to extend online file -stage returned -1, not 4096: error Invalid argument (22) -scoutfs: stage failed: Input/output error (5) +stage: must provide file version with --data-version +Try `stage --help' or `stage --usage' for more information. == wrapped region fails stage returned -1, not 4096: error Invalid argument (22) scoutfs: stage failed: Input/output error (5) @@ -18,6 +18,6 @@ scoutfs: stage failed: Input/output error (5) == partial final block that writes to i_size does work == zero length stage doesn't bring blocks online == stage of non-regular file fails -ioctl failed on '/mnt/test/test/simple-staging/file-char': Inappropriate ioctl for device (25) -stage returned -1, not 1: error Inappropriate ioctl for device (25) -scoutfs: stage failed: Input/output error (5) +ioctl failed: Inappropriate ioctl for device (25) +stage: must provide file version with --data-version +Try `stage --help' or `stage --usage' for more information. diff --git a/tests/tests/archive-light-cycle.sh b/tests/tests/archive-light-cycle.sh index 8321bd71..a02cfab4 100644 --- a/tests/tests/archive-light-cycle.sh +++ b/tests/tests/archive-light-cycle.sh @@ -161,9 +161,9 @@ for n in $(t_fs_nrs); do echo "bash $gen $blocks $n $p $f > $path" >> $create echo "cmp $path <(bash $gen $blocks $n $p $f)" >> $verify echo "vers=\$(scoutfs stat -s data_version $path)" >> $release - echo "scoutfs release $path \$vers 0 $blocks" >> $release + echo "scoutfs release $path -V \$vers -o 0 -l $bytes" >> $release echo "vers=\$(scoutfs stat -s data_version $path)" >> $stage - echo "scoutfs stage $path \$vers 0 $bytes <(bash $gen $blocks $n $p $f)" >> $stage + echo "scoutfs stage <(bash $gen $blocks $n $p $f) $path -V \$vers -o 0 -l $bytes " >> $stage echo "rm -f $path" >> $unlink echo "x=\$(scoutfs stat -s online_blocks $path)" >> $online diff --git a/tests/tests/basic-block-counts.sh b/tests/tests/basic-block-counts.sh index 6a9e49c3..1b95610e 100644 --- a/tests/tests/basic-block-counts.sh +++ b/tests/tests/basic-block-counts.sh @@ -9,14 +9,14 @@ t_require_commands scoutfs dd truncate touch mkdir rm rmdir release_vers() { local file="$1" local vers="$2" - local block="$3" - local count="$4" + local offset="$3" + local length="$4" if [ "$vers" == "stat" ]; then vers=$(scoutfs stat -s data_version "$file") fi - scoutfs release "$file" "$vers" "$block" "$count" + scoutfs release "$file" -V "$vers" -o "$offset" -l "$length" } # if vers is "stat" then we ask stat_more for the data_version @@ -24,14 +24,14 @@ stage_vers() { local file="$1" local vers="$2" local offset="$3" - local count="$4" + local length="$4" local contents="$5" if [ "$vers" == "stat" ]; then vers=$(scoutfs stat -s data_version "$file") fi - scoutfs stage "$file" "$vers" "$offset" "$count" "$contents" + scoutfs stage "$contents" "$file" -V "$vers" -o "$offset" -l "$length" } echo_blocks() @@ -57,15 +57,15 @@ dd if=/dev/zero of="$FILE" bs=4K count=1 conv=notrunc oflag=append status=none echo_blocks "$FILE" echo "== release" -release_vers "$FILE" stat 0 2 +release_vers "$FILE" stat 0 8K echo_blocks "$FILE" echo "== duplicate release" -release_vers "$FILE" stat 0 2 +release_vers "$FILE" stat 0 8K echo_blocks "$FILE" echo "== duplicate release past i_size" -release_vers "$FILE" stat 0 16 +release_vers "$FILE" stat 0 64K echo_blocks "$FILE" echo "== stage" diff --git a/tests/tests/basic-posix-consistency.sh b/tests/tests/basic-posix-consistency.sh index 0444a3aa..9c0d2398 100644 --- a/tests/tests/basic-posix-consistency.sh +++ b/tests/tests/basic-posix-consistency.sh @@ -169,32 +169,32 @@ rm -rf "$T_D0/dir" echo "== inode indexes match after syncing existing" t_sync_seq_index -scoutfs walk-inodes meta_seq 0 -1 "$T_M0" > "$T_TMP.0" -scoutfs walk-inodes meta_seq 0 -1 "$T_M1" > "$T_TMP.1" +scoutfs walk-inodes -p "$T_M0" -- meta_seq 0 -1 > "$T_TMP.0" +scoutfs walk-inodes -p "$T_M1" -- meta_seq 0 -1 > "$T_TMP.1" diff -u "$T_TMP.0" "$T_TMP.1" -scoutfs walk-inodes data_seq 0 -1 "$T_M0" > "$T_TMP.0" -scoutfs walk-inodes data_seq 0 -1 "$T_M1" > "$T_TMP.1" +scoutfs walk-inodes -p "$T_M0" -- data_seq 0 -1 > "$T_TMP.0" +scoutfs walk-inodes -p "$T_M1" -- data_seq 0 -1 > "$T_TMP.1" diff -u "$T_TMP.0" "$T_TMP.1" echo "== inode indexes match after copying and syncing" mkdir "$T_D0/dir" cp -ar /boot/conf* "$T_D0/dir" t_sync_seq_index -scoutfs walk-inodes meta_seq 0 -1 "$T_M0" > "$T_TMP.0" -scoutfs walk-inodes meta_seq 0 -1 "$T_M1" > "$T_TMP.1" +scoutfs walk-inodes -p "$T_M0" -- meta_seq 0 -1 > "$T_TMP.0" +scoutfs walk-inodes -p "$T_M1" -- meta_seq 0 -1 > "$T_TMP.1" diff -u "$T_TMP.0" "$T_TMP.1" -scoutfs walk-inodes data_seq 0 -1 "$T_M0" > "$T_TMP.0" -scoutfs walk-inodes data_seq 0 -1 "$T_M1" > "$T_TMP.1" +scoutfs walk-inodes -p "$T_M0" -- data_seq 0 -1 > "$T_TMP.0" +scoutfs walk-inodes -p "$T_M1" -- data_seq 0 -1 > "$T_TMP.1" diff -u "$T_TMP.0" "$T_TMP.1" echo "== inode indexes match after removing and syncing" rm -f "$T_D1/dir/conf*" t_sync_seq_index -scoutfs walk-inodes meta_seq 0 -1 "$T_M0" > "$T_TMP.0" -scoutfs walk-inodes meta_seq 0 -1 "$T_M1" > "$T_TMP.1" +scoutfs walk-inodes -p "$T_M0" -- meta_seq 0 -1 > "$T_TMP.0" +scoutfs walk-inodes -p "$T_M1" -- meta_seq 0 -1 > "$T_TMP.1" diff -u "$T_TMP.0" "$T_TMP.1" -scoutfs walk-inodes data_seq 0 -1 "$T_M0" > "$T_TMP.0" -scoutfs walk-inodes data_seq 0 -1 "$T_M1" > "$T_TMP.1" +scoutfs walk-inodes -p "$T_M0" -- data_seq 0 -1 > "$T_TMP.0" +scoutfs walk-inodes -p "$T_M1" -- data_seq 0 -1 > "$T_TMP.1" diff -u "$T_TMP.0" "$T_TMP.1" t_pass diff --git a/tests/tests/inode-items-updated.sh b/tests/tests/inode-items-updated.sh index 810e3ac3..193a626a 100644 --- a/tests/tests/inode-items-updated.sh +++ b/tests/tests/inode-items-updated.sh @@ -30,7 +30,7 @@ echo "== create files and sync" dd if=/dev/zero of="$DIR/truncate" bs=4096 count=1 status=none dd if=/dev/zero of="$DIR/stage" bs=4096 count=1 status=none vers=$(scoutfs stat -s data_version "$DIR/stage") -scoutfs release "$DIR/stage" $vers 0 1 +scoutfs release "$DIR/stage" -V $vers -o 0 -l 4K dd if=/dev/zero of="$DIR/release" bs=4096 count=1 status=none touch "$DIR/write_end" mkdir "$DIR"/{mknod_dir,link_dir,unlink_dir,symlink_dir,rename_dir} @@ -41,9 +41,9 @@ sync; sync echo "== modify files" truncate -s 0 "$DIR/truncate" vers=$(scoutfs stat -s data_version "$DIR/stage") -scoutfs stage "$DIR/stage" $vers 0 4096 /dev/zero +scoutfs stage /dev/zero "$DIR/stage" -V $vers -o 0 -l 4096 vers=$(scoutfs stat -s data_version "$DIR/release") -scoutfs release "$DIR/release" $vers 0 1 +scoutfs release "$DIR/release" -V $vers -o 0 -l 4K dd if=/dev/zero of="$DIR/write_end" bs=4096 count=1 status=none conv=notrunc touch $DIR/mknod_dir/mknod_file touch $DIR/link_dir/link_targ diff --git a/tests/tests/lock-pr-cw-conflict.sh b/tests/tests/lock-pr-cw-conflict.sh index 09210a39..96ce7b9f 100644 --- a/tests/tests/lock-pr-cw-conflict.sh +++ b/tests/tests/lock-pr-cw-conflict.sh @@ -9,7 +9,7 @@ FILE="$T_D0/file" echo "== race writing and index walking" for i in $(seq 1 10); do dd if=/dev/zero of="$FILE" bs=4K count=1 status=none conv=notrunc & - scoutfs walk-inodes data_seq 0 -1 "$T_M0" > /dev/null & + scoutfs walk-inodes -p "$T_M0" -- data_seq 0 -1 > /dev/null & wait done diff --git a/tests/tests/offline-extent-waiting.sh b/tests/tests/offline-extent-waiting.sh index fb413562..31b04b59 100644 --- a/tests/tests/offline-extent-waiting.sh +++ b/tests/tests/offline-extent-waiting.sh @@ -24,7 +24,7 @@ expect_wait() shift done - scoutfs data-waiting 0 0 "$file" > $T_TMP.wait.output + scoutfs data-waiting -B 0 -I 0 -p "$file" > $T_TMP.wait.output diff -u $T_TMP.wait.expected $T_TMP.wait.output } @@ -37,9 +37,9 @@ ino=$(stat -c "%i" "$DIR/file") vers=$(scoutfs stat -s data_version "$DIR/file") echo "== waiter shows up in ioctl" -echo "offline wating should be empty:" -scoutfs data-waiting 0 0 "$DIR" | wc -l -scoutfs release "$DIR/file" "$vers" 0 $BLOCKS +echo "offline waiting should be empty:" +scoutfs data-waiting -B 0 -I 0 -p "$DIR" | wc -l +scoutfs release "$DIR/file" -V "$vers" -o 0 -l $BYTES cat "$DIR/file" > /dev/null & sleep .1 echo "offline waiting should now have one known entry:" @@ -58,13 +58,13 @@ echo "offline waiting now has two known entries:" expect_wait "$DIR/file" "read" $ino 0 $ino 1 echo "== staging wakes everyone" -scoutfs stage "$DIR/file" "$vers" 0 $BYTES "$DIR/golden" +scoutfs stage "$DIR/golden" "$DIR/file" -V "$vers" -o 0 -l $BYTES sleep .1 -echo "offline wating should be empty again:" -scoutfs data-waiting 0 0 "$DIR" | wc -l +echo "offline waiting should be empty again:" +scoutfs data-waiting -B 0 -I 0 -p "$DIR" | wc -l echo "== interruption does no harm" -scoutfs release "$DIR/file" "$vers" 0 $BLOCKS +scoutfs release "$DIR/file" -V "$vers" -o 0 -l $BYTES cat "$DIR/file" > /dev/null 2>&1 & pid="$!" sleep .1 @@ -74,7 +74,7 @@ kill "$pid" # silence terminated message wait "$pid" 2> /dev/null echo "offline waiting should be empty again:" -scoutfs data-waiting 0 0 "$DIR" | wc -l +scoutfs data-waiting -B 0 -I 0 -p "$DIR" | wc -l echo "== EIO injection for waiting readers works" ino=$(stat -c "%i" "$DIR/file") @@ -86,23 +86,23 @@ dd if="$DIR/file" bs=$BS skip=1 of=/dev/null 2>&1 | \ pid2="$!" sleep .1 echo "offline waiting should now have two known entries:" -scoutfs data-waiting 0 0 "$DIR" | wc -l +scoutfs data-waiting -B 0 -I 0 -p "$DIR" | wc -l expect_wait "$DIR/file" "read" $ino 0 $ino 1 -scoutfs data-wait-err "$DIR" "$ino" "$vers" 0 $((BS*2)) read -5 +scoutfs data-wait-err -p "$DIR" -I "$ino" -V "$vers" -F 0 -C $((BS*2)) -O read -E -5 sleep .1 echo "offline waiting should now have 0 known entries:" -scoutfs data-waiting 0 0 "$DIR" | wc -l +scoutfs data-waiting -B 0 -I 0 -p "$DIR" | wc -l # silence terminated message wait "$pid" 2> /dev/null wait "$pid2" 2> /dev/null cat $T_TMP.cat1 cat $T_TMP.cat2 echo "offline waiting should be empty again:" -scoutfs data-waiting 0 0 "$DIR" | wc -l +scoutfs data-waiting -B 0 -I 0 -p "$DIR" | wc -l echo "== readahead while offline does no harm" xfs_io -c "fadvise -w 0 $BYTES" "$DIR/file" -scoutfs stage "$DIR/file" "$vers" 0 $BYTES "$DIR/golden" +scoutfs stage "$DIR/golden" "$DIR/file" -V "$vers" -o 0 -l $BYTES cmp "$DIR/file" "$DIR/golden" echo "== waiting on interesting blocks works" @@ -113,65 +113,65 @@ for base in $(echo 0 $(($BLOCKS / 2)) $(($BLOCKS - 2))); do done done for b in $blocks; do - scoutfs release "$DIR/file" "$vers" 0 $BLOCKS + scoutfs release "$DIR/file" -V "$vers" -o 0 -l $BYTES dd if="$DIR/file" of=/dev/null \ status=none bs=$BS count=1 skip=$b 2> /dev/null & sleep .1 - scoutfs stage "$DIR/file" "$vers" 0 $BYTES "$DIR/golden" + scoutfs stage "$DIR/golden" "$DIR/file" -V "$vers" -o 0 -l $BYTES sleep .1 echo "offline waiting is empty at block $b" - scoutfs data-waiting 0 0 "$DIR" | wc -l + scoutfs data-waiting -B 0 -I 0 -p "$DIR" | wc -l done echo "== contents match when staging blocks forward" -scoutfs release "$DIR/file" "$vers" 0 $BLOCKS +scoutfs release "$DIR/file" -V "$vers" -o 0 -l $BYTES cat "$DIR/file" > "$DIR/forward" & for b in $(seq 0 1 $((BLOCKS - 1))); do dd if="$DIR/golden" of="$DIR/block" status=none bs=$BS skip=$b count=1 - scoutfs stage "$DIR/file" "$vers" $((b * $BS)) $BS "$DIR/block" + scoutfs stage "$DIR/block" "$DIR/file" -V "$vers" -o $((b * $BS)) -l $BS done sleep .1 cmp "$DIR/golden" "$DIR/forward" echo "== contents match when staging blocks backwards" -scoutfs release "$DIR/file" "$vers" 0 $BLOCKS +scoutfs release "$DIR/file" -V "$vers" -o 0 -l $BYTES cat "$DIR/file" > "$DIR/backward" & for b in $(seq $((BLOCKS - 1)) -1 0); do dd if="$DIR/golden" of="$DIR/block" status=none bs=$BS skip=$b count=1 - scoutfs stage "$DIR/file" "$vers" $((b * $BS)) $BS "$DIR/block" + scoutfs stage "$DIR/block" "$DIR/file" -V "$vers" -o $((b * $BS)) -l $BS done sleep .1 cmp "$DIR/golden" "$DIR/backward" echo "== truncate to same size doesn't wait" -scoutfs release "$DIR/file" "$vers" 0 $BLOCKS +scoutfs release "$DIR/file" -V "$vers" -o 0 -l $BYTES truncate -s "$BYTES" "$DIR/file" & sleep .1 echo "offline wating should be empty:" -scoutfs data-waiting 0 0 "$DIR" | wc -l +scoutfs data-waiting -B 0 -I 0 -p "$DIR" | wc -l echo "== truncating does wait" truncate -s "$BS" "$DIR/file" & sleep .1 echo "truncate should be waiting for first block:" expect_wait "$DIR/file" "change_size" $ino 0 -scoutfs stage "$DIR/file" "$vers" 0 $BYTES "$DIR/golden" +scoutfs stage "$DIR/golden" "$DIR/file" -V "$vers" -o 0 -l $BYTES sleep .1 echo "trunate should no longer be waiting:" -scoutfs data-waiting 0 0 "$DIR" | wc -l +scoutfs data-waiting -B 0 -I 0 -p "$DIR" | wc -l cat "$DIR/golden" > "$DIR/file" vers=$(scoutfs stat -s data_version "$DIR/file") echo "== writing waits" dd if=/dev/urandom of="$DIR/other" bs=$BS count=$BLOCKS status=none -scoutfs release "$DIR/file" "$vers" 0 $BLOCKS +scoutfs release "$DIR/file" -V "$vers" -o 0 -l $BYTES # overwrite, not truncate+write dd if="$DIR/other" of="$DIR/file" \ bs=$BS count=$BLOCKS conv=notrunc status=none & sleep .1 echo "should be waiting for write" expect_wait "$DIR/file" "write" $ino 0 -scoutfs stage "$DIR/file" "$vers" 0 $BYTES "$DIR/golden" +scoutfs stage "$DIR/golden" "$DIR/file" -V "$vers" -o 0 -l $BYTES cmp "$DIR/file" "$DIR/other" echo "== cleanup" diff --git a/tests/tests/setattr_more.sh b/tests/tests/setattr_more.sh index 0aecd9be..af05b89f 100644 --- a/tests/tests/setattr_more.sh +++ b/tests/tests/setattr_more.sh @@ -8,63 +8,63 @@ FILE="$T_D0/file" echo "== 0 data_version arg fails" touch "$FILE" -scoutfs setattr -d 0 -s 1 -f "$FILE" 2>&1 | t_filter_fs +scoutfs setattr -V 0 -s 1 "$FILE" 2>&1 | t_filter_fs rm "$FILE" echo "== args must specify size and offline" touch "$FILE" -scoutfs setattr -d 1 -o -s 0 -f "$FILE" 2>&1 | t_filter_fs +scoutfs setattr -V 1 -o -s 0 "$FILE" 2>&1 | t_filter_fs rm "$FILE" echo "== only works on regular files" mkdir "$T_D0/dir" -scoutfs setattr -d 1 -s 1 -f "$T_D0/dir" 2>&1 | t_filter_fs +scoutfs setattr -V 1 -s 1 "$T_D0/dir" 2>&1 | t_filter_fs rmdir "$T_D0/dir" mknod "$T_D0/char" c 1 3 -scoutfs setattr -d 1 -s 1 -f "$T_D0/char" 2>&1 | t_filter_fs +scoutfs setattr -V 1 -s 1 "$T_D0/char" 2>&1 | t_filter_fs rm "$T_D0/char" echo "== non-zero file size fails" echo contents > "$FILE" -scoutfs setattr -d 1 -s 1 -f "$FILE" 2>&1 | t_filter_fs +scoutfs setattr -V 1 -s 1 "$FILE" 2>&1 | t_filter_fs rm "$FILE" echo "== non-zero file data_version fails" touch "$FILE" truncate -s 1M "$FILE" truncate -s 0 "$FILE" -scoutfs setattr -d 1 -o -s 1 -f "$FILE" 2>&1 | t_filter_fs +scoutfs setattr -V 1 -o -s 1 "$FILE" 2>&1 | t_filter_fs rm "$FILE" echo "== large size is set" touch "$FILE" -scoutfs setattr -d 1 -s 578437695752307201 -f "$FILE" 2>&1 | t_filter_fs +scoutfs setattr -V 1 -s 578437695752307201 "$FILE" 2>&1 | t_filter_fs stat -c "%s" "$FILE" rm "$FILE" echo "== large data_version is set" touch "$FILE" -scoutfs setattr -d 578437695752307201 -s 1 -f "$FILE" 2>&1 | t_filter_fs +scoutfs setattr -V 578437695752307201 -s 1 "$FILE" 2>&1 | t_filter_fs scoutfs stat -s data_version "$FILE" rm "$FILE" echo "== large ctime is set" touch "$FILE" # only doing 32bit sec 'cause stat gets confused -scoutfs setattr -c 67305985.999999999 -d 1 -s 1 -f "$FILE" 2>&1 | t_filter_fs +scoutfs setattr -t 67305985.999999999 -V 1 -s 1 "$FILE" 2>&1 | t_filter_fs TZ=GMT stat -c "%z" "$FILE" rm "$FILE" echo "== large offline extents are created" touch "$FILE" -scoutfs setattr -d 1 -o -s $((10007 * 4096)) -f "$FILE" 2>&1 | t_filter_fs +scoutfs setattr -V 1 -o -s $((10007 * 4096)) "$FILE" 2>&1 | t_filter_fs filefrag -v -b4096 "$FILE" 2>&1 | t_filter_fs rm "$FILE" # had a bug where we were creating extents that were too long echo "== correct offline extent length" touch "$FILE" -scoutfs setattr -d 1 -o -s 4000000000 -f "$FILE" 2>&1 | t_filter_fs +scoutfs setattr -V 1 -o -s 4000000000 "$FILE" 2>&1 | t_filter_fs scoutfs stat -s offline_blocks "$FILE" rm "$FILE" diff --git a/tests/tests/simple-inode-index.sh b/tests/tests/simple-inode-index.sh index bdd065d8..514a4348 100644 --- a/tests/tests/simple-inode-index.sh +++ b/tests/tests/simple-inode-index.sh @@ -14,7 +14,7 @@ query_index() { local first="${2:-0}" local last="${3:--1}" - scoutfs walk-inodes $which $first $last "$T_M0" + scoutfs walk-inodes -p "$T_M0" -- $which $first $last } # print the major in the index for the ino if it's found @@ -22,7 +22,7 @@ ino_major() { local which="$1" local ino="$2" - scoutfs walk-inodes $which 0 -1 "$T_M0" | \ + scoutfs walk-inodes -p "$T_M0" -- $which 0 -1 | \ awk '($4 == "'$ino'") {print $2}' } diff --git a/tests/tests/simple-release-extents.sh b/tests/tests/simple-release-extents.sh index 4fa9583b..da3eee3d 100644 --- a/tests/tests/simple-release-extents.sh +++ b/tests/tests/simple-release-extents.sh @@ -23,14 +23,14 @@ create_file() { release_vers() { local file="$1" local vers="$2" - local block="$3" - local count="$4" + local offset="$3" + local length="$4" if [ "$vers" == "stat" ]; then vers=$(scoutfs stat -s data_version "$file") fi - scoutfs release "$file" "$vers" "$block" "$count" + scoutfs release "$file" -V "$vers" -o "$offset" -l "$length" } FILE="$T_D0/file" @@ -38,41 +38,41 @@ CHAR="$FILE-char" echo "== simple whole file multi-block releasing" create_file "$FILE" 65536 -release_vers "$FILE" stat 0 16 +release_vers "$FILE" stat 0 64K rm "$FILE" echo "== release last block that straddles i_size" create_file "$FILE" 6144 -release_vers "$FILE" stat 1 1 +release_vers "$FILE" stat 4K 4K rm "$FILE" echo "== release entire file past i_size" create_file "$FILE" 8192 -release_vers "$FILE" stat 0 100 +release_vers "$FILE" stat 0 400K # not deleting for the following little tests echo "== releasing offline extents is fine" -release_vers "$FILE" stat 0 100 +release_vers "$FILE" stat 0 400K echo "== 0 count is fine" release_vers "$FILE" stat 0 0 echo "== release past i_size is fine" -release_vers "$FILE" stat 100 1 +release_vers "$FILE" stat 400K 4K echo "== wrapped blocks fails" release_vers "$FILE" stat $vers 0x8000000000000000 0x8000000000000000 echo "== releasing non-file fails" mknod "$CHAR" c 1 3 -release_vers "$CHAR" stat 0 1 2>&1 | t_filter_fs +release_vers "$CHAR" stat 0 4K 2>&1 | t_filter_fs rm "$CHAR" echo "== releasing a non-scoutfs file fails" -release_vers "/dev/null" stat 0 1 +release_vers "/dev/null" stat 0 4K echo "== releasing bad version fails" -release_vers "$FILE" 0 0 1 +release_vers "$FILE" 0 0 4K rm "$FILE" @@ -108,9 +108,9 @@ for c in $(seq 0 4); do start=$(fiemap_file "$FILE" | \ awk '($1 == "0:"){print substr($4, 0, length($4)- 2)}') - release_vers "$FILE" stat $a 1 - release_vers "$FILE" stat $b 1 - release_vers "$FILE" stat $c 1 + release_vers "$FILE" stat $(($a * 4))K 4K + release_vers "$FILE" stat $(($b * 4))K 4K + release_vers "$FILE" stat $(($c * 4))K 4K echo -n "$a $b $c:" diff --git a/tests/tests/simple-staging.sh b/tests/tests/simple-staging.sh index 1cd8e1e6..ad059bd0 100644 --- a/tests/tests/simple-staging.sh +++ b/tests/tests/simple-staging.sh @@ -29,14 +29,14 @@ create_file() { release_vers() { local file="$1" local vers="$2" - local block="$3" - local count="$4" + local offset="$3" + local length="$4" if [ "$vers" == "stat" ]; then vers=$(scoutfs stat -s data_version "$file") fi - scoutfs release "$file" "$vers" "$block" "$count" + scoutfs release "$file" -V "$vers" -o "$offset" -l "$length" } # if vers is "stat" then we ask stat_more for the data_version @@ -44,14 +44,14 @@ stage_vers() { local file="$1" local vers="$2" local offset="$3" - local count="$4" + local length="$4" local contents="$5" if [ "$vers" == "stat" ]; then vers=$(scoutfs stat -s data_version "$file") fi - scoutfs stage "$file" "$vers" "$offset" "$count" "$contents" + scoutfs stage "$contents" "$file" -V "$vers" -o "$offset" -l "$length" } FILE="$T_D0/file" @@ -60,7 +60,7 @@ CHAR="$FILE-char" echo "== create/release/stage single block file" create_file "$FILE" 4096 cp "$FILE" "$T_TMP" -release_vers "$FILE" stat 0 1 +release_vers "$FILE" stat 0 4K # make sure there only offline extents fiemap_file "$FILE" | grep "^[ 0-9]*:" | grep -v "unknown" stage_vers "$FILE" stat 0 4096 "$T_TMP" @@ -70,7 +70,7 @@ rm -f "$FILE" echo "== create/release/stage larger file" create_file "$FILE" $((4096 * 4096)) cp "$FILE" "$T_TMP" -release_vers "$FILE" stat 0 4096 +release_vers "$FILE" stat 0 16M # make sure there only offline extents fiemap_file "$FILE" | grep "^[ 0-9]*:" | grep -v "unknown" stage_vers "$FILE" stat 0 $((4096 * 4096)) "$T_TMP" @@ -83,7 +83,7 @@ cp "$FILE" "$T_TMP" nr=1 while [ "$nr" -lt 10 ]; do echo "attempt $nr" >> $seqres.full 2>&1 - release_vers "$FILE" stat 0 1024 + release_vers "$FILE" stat 0 4096K sync echo 3 > /proc/sys/vm/drop_caches stage_vers "$FILE" stat 0 $((4096 * 1024)) "$T_TMP" @@ -100,7 +100,7 @@ sync stat "$FILE" > "$T_TMP.before" scoutfs stat -s data_seq "$FILE" >> "$T_TMP.before" scoutfs stat -s data_version "$FILE" >> "$T_TMP.before" -release_vers "$FILE" stat 0 1 +release_vers "$FILE" stat 0 4K stage_vers "$FILE" stat 0 4096 "$T_TMP" stat "$FILE" > "$T_TMP.after" scoutfs stat -s data_seq "$FILE" >> "$T_TMP.after" @@ -110,7 +110,7 @@ rm -f "$FILE" echo "== stage does change meta_seq" create_file "$FILE" 4096 -release_vers "$FILE" stat 0 1 +release_vers "$FILE" stat 0 4K sync before=$(scoutfs stat -s meta_seq "$FILE") stage_vers "$FILE" stat 0 4096 "$T_TMP" @@ -121,7 +121,7 @@ rm -f "$FILE" # XXX this now waits, demand staging should be own test #echo "== can't write to offline" #create_file "$FILE" 4096 -#release_vers "$FILE" stat 0 1 +#release_vers "$FILE" stat 0 4K ## make sure there only offline extents #fiemap_file "$FILE" | grep "^[ 0-9]*:" | grep -v "unknown" #dd if=/dev/zero of="$FILE" conv=notrunc bs=4096 count=1 2>&1 | t_filter_fs @@ -144,13 +144,13 @@ rm -f "$FILE" echo "== wrapped region fails" create_file "$FILE" 4096 -stage_vers "$FILE" stat 0xFFFFFFFFFFFFFFFF 4096 /dev/zero +stage_vers "$FILE" stat 0xFFFFFFFFFFFFF000 4096 /dev/zero rm -f "$FILE" echo "== non-block aligned offset fails" create_file "$FILE" 4096 cp "$FILE" "$T_TMP" -release_vers "$FILE" stat 0 1 +release_vers "$FILE" stat 0 4K stage_vers "$FILE" stat 1 4095 "$T_TMP" fiemap_file "$FILE" | grep "^[ 0-9]*:" | grep -v "unknown" rm -f "$FILE" @@ -158,7 +158,7 @@ rm -f "$FILE" echo "== non-block aligned len within block fails" create_file "$FILE" 4096 cp "$FILE" "$T_TMP" -release_vers "$FILE" stat 0 1 +release_vers "$FILE" stat 0 4K stage_vers "$FILE" stat 0 1024 "$T_TMP" fiemap_file "$FILE" | grep "^[ 0-9]*:" | grep -v "unknown" rm -f "$FILE" @@ -166,14 +166,14 @@ rm -f "$FILE" echo "== partial final block that writes to i_size does work" create_file "$FILE" 2048 cp "$FILE" "$T_TMP" -release_vers "$FILE" stat 0 1 +release_vers "$FILE" stat 0 4K stage_vers "$FILE" stat 0 2048 "$T_TMP" cmp "$FILE" "$T_TMP" rm -f "$FILE" echo "== zero length stage doesn't bring blocks online" create_file "$FILE" $((4096 * 100)) -release_vers "$FILE" stat 0 100 +release_vers "$FILE" stat 0 400K stage_vers "$FILE" stat 4096 0 /dev/zero fiemap_file "$FILE" | grep "^[ 0-9]*:" | grep -v "unknown" rm -f "$FILE" @@ -188,7 +188,7 @@ rm -f "$FILE" #create_file "$FILE" 4096 #cp "$FILE" "$T_TMP" #sync -#release_vers "$FILE" stat 0 1 +#release_vers "$FILE" stat 0 4K #md5sum "$FILE" 2>&1 | t_filter_fs #stage_vers "$FILE" stat 0 4096 "$T_TMP" #cmp "$FILE" "$T_TMP" diff --git a/tests/tests/srch-basic-functionality.sh b/tests/tests/srch-basic-functionality.sh index d7d6eb66..b310ecd4 100644 --- a/tests/tests/srch-basic-functionality.sh +++ b/tests/tests/srch-basic-functionality.sh @@ -17,7 +17,7 @@ diff_srch_find() local n="$1" sync - scoutfs search-xattrs -n "$n" -f "$T_M0" > "$T_TMP.srch" + scoutfs search-xattrs "$n" -p "$T_M0" > "$T_TMP.srch" find_xattrs -d "$T_D0" -m "$T_M0" -n "$n" > "$T_TMP.find" diff -u "$T_TMP.srch" "$T_TMP.find" diff --git a/tests/tests/stage-multi-part.sh b/tests/tests/stage-multi-part.sh index 594a4f06..6ed1673c 100644 --- a/tests/tests/stage-multi-part.sh +++ b/tests/tests/stage-multi-part.sh @@ -29,7 +29,7 @@ release_file() { local path="$1" local vers=$(scoutfs stat -s data_version "$path") - scoutfs release "$path" "$vers" 0 $FILE_BLOCKS + scoutfs release "$path" -V "$vers" -o 0 -l $FILE_BYTES } stage_file() { @@ -38,8 +38,8 @@ stage_file() { local off=0 for a in $(seq 1 $NR_FRAGS); do - scoutfs stage "$path" "$vers" $off $FRAG_BYTES \ - <(gen $FRAG_BLOCKS $a $a $a) + scoutfs stage <(gen $FRAG_BLOCKS $a $a $a) "$path" -V "$vers" \ + -o $off -l $FRAG_BYTES ((off+=$FRAG_BYTES)) done } diff --git a/tests/tests/stage-release-race-alloc.sh b/tests/tests/stage-release-race-alloc.sh index 5dc3438d..b9c74de5 100644 --- a/tests/tests/stage-release-race-alloc.sh +++ b/tests/tests/stage-release-race-alloc.sh @@ -15,7 +15,7 @@ release_file() { local vers=$(scoutfs stat -s data_version "$path") echo "releasing $path" >> "$T_TMP.log" - scoutfs release "$path" "$vers" 0 $BLOCKS + scoutfs release "$path" -V "$vers" -o 0 -l $BYTES echo "released $path" >> "$T_TMP.log" } @@ -24,8 +24,8 @@ stage_file() { local vers=$(scoutfs stat -s data_version "$path") echo "staging $path" >> "$T_TMP.log" - scoutfs stage "$path" "$vers" 0 $BYTES \ - "$DIR/good/$(basename $path)" + scoutfs stage "$DIR/good/$(basename $path)" "$path" -V "$vers" -o 0 -l $BYTES + echo "staged $path" >> "$T_TMP.log" }