* [PATCH] fstests: Fix inconsistent xfs_io error report caused false alert
From: Qu Wenruo @ 2017-01-04 8:37 UTC (permalink / raw)
To: linux-btrfs, fstests
Test case like generic/304 and generic/158 can cause false alert due to
the error output change of xfs_io.
For error case, xfs_io mostly reports error like "dedupe: ERROR STRING"
while under certain case, it reports error like "XFS_IOC_FILE_EXTENT_SAME:
ERROR STRING".
Fix it by adding a new filter, _filter_dedupe_ioctl(), to filter out all
"XFS_IOC_FILE_EXTENT_SAME:" to "dedupe:"
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
common/filter | 8 ++++++++
tests/generic/158 | 9 ++++++---
tests/generic/158.out | 4 ++--
tests/generic/304 | 12 +++++++++---
tests/generic/304.out | 2 +-
5 files changed, 26 insertions(+), 9 deletions(-)
diff --git a/common/filter b/common/filter
index 397b456..f9ad7f9 100644
--- a/common/filter
+++ b/common/filter
@@ -401,5 +401,13 @@ _filter_mknod()
sed -e "s/mknod: [\`']\(.*\)': File exists/mknod: \1: File exists/"
}
+# xfs_io has inconsistent error report prefix.
+# For some error it reports like "dedupe: STRING" while for some it
+# reports "XFS_IOC_FILE_EXTENT_SAME: STRING"
+# Use this filter to unify them to "dedupe:"
+_filter_dedupe_ioctl()
+{
+ sed -e "s/^XFS_IOC_FILE_EXTENT_SAME:/dedupe:/"
+}
# make sure this script returns success
/bin/true
diff --git a/tests/generic/158 b/tests/generic/158
index 086c522..88f3e47 100755
--- a/tests/generic/158
+++ b/tests/generic/158
@@ -98,7 +98,8 @@ echo "Try overlapping dedupe"
_dedupe_range $testdir1/file1 0 $testdir1/file1 1 $((blksz * 2))
echo "Try dedupe from past EOF"
-_dedupe_range $testdir1/file1 $(( (blks + 10) * blksz)) $testdir1/file1 0 $blksz
+_dedupe_range $testdir1/file1 $(( (blks + 10) * blksz)) $testdir1/file1 0 $blksz \
+ 2>&1 | _filter_dedupe_ioctl
echo "Try dedupe to past EOF, destination offset beyond EOF"
_dedupe_range $testdir1/file1 0 $testdir1/file1 $(( (blks + 10) * blksz)) \
@@ -109,10 +110,12 @@ _dedupe_range $testdir1/file1 0 $testdir1/file1 $(( (blks - 1) * blksz)) \
$((blksz * 2))
echo "Try to dedupe a dir"
-_dedupe_range $testdir1/dir1 0 $testdir1/file2 0 $blksz
+_dedupe_range $testdir1/dir1 0 $testdir1/file2 0 $blksz 2>&1 | \
+ _filter_dedupe_ioctl
echo "Try to dedupe a device"
-_dedupe_range $testdir1/dev1 0 $testdir1/file2 0 $blksz 2>&1 | _filter_enotty
+_dedupe_range $testdir1/dev1 0 $testdir1/file2 0 $blksz 2>&1 | \
+ _filter_enotty | _filter_dedupe_ioctl
echo "Try to dedupe to a dir"
_dedupe_range $testdir1/file1 0 $testdir1/dir1 0 $blksz 2>&1 | _filter_test_dir
diff --git a/tests/generic/158.out b/tests/generic/158.out
index 9b82ddf..3a9596f 100644
--- a/tests/generic/158.out
+++ b/tests/generic/158.out
@@ -14,9 +14,9 @@ dedupe: Invalid argument
Try dedupe to past EOF, destination offset behind EOF
dedupe: Invalid argument
Try to dedupe a dir
-XFS_IOC_FILE_EXTENT_SAME: Is a directory
+dedupe: Is a directory
Try to dedupe a device
-XFS_IOC_FILE_EXTENT_SAME: Invalid argument
+dedupe: Invalid argument
Try to dedupe to a dir
TEST_DIR/test-158/dir1: Is a directory
Try to dedupe to a device
diff --git a/tests/generic/304 b/tests/generic/304
index b7ee7b9..f8336fd 100755
--- a/tests/generic/304
+++ b/tests/generic/304
@@ -75,13 +75,19 @@ echo "Dedupe high offset to low offset"
_dedupe_range $testdir/file1 $bigoff_64k $testdir/file6 1048576 65535 >> $seqres.full
echo "Dedupe past source file EOF (should fail)"
-_dedupe_range $testdir/file2 524288 $testdir/file7 0 1048576 >> $seqres.full
+_dedupe_range $testdir/file2 524288 $testdir/file7 0 1048576 >> $seqres.full \
+ 2>$tmp.error
+cat $tmp.error | _filter_dedupe_ioctl
echo "Dedupe max size at nonzero offset (should fail)"
-_dedupe_range $testdir/file2 524288 $testdir/file8 0 $len >> $seqres.full
+_dedupe_range $testdir/file2 524288 $testdir/file8 0 $len >> $seqres.full \
+ 2>$tmp.error
+cat $tmp.error | _filter_dedupe_ioctl
echo "Dedupe with huge off/len (should fail)"
-_dedupe_range $testdir/file2 $bigoff_64k $testdir/file9 0 $bigoff_64k >> $seqres.full
+_dedupe_range $testdir/file2 $bigoff_64k $testdir/file9 0 $bigoff_64k \
+ >> $seqres.full 2>$tmp.error
+cat $tmp.error | _filter_dedupe_ioctl
echo "Check file creation"
_test_cycle_mount
diff --git a/tests/generic/304.out b/tests/generic/304.out
index 7b5ff0e..fbba6f3 100644
--- a/tests/generic/304.out
+++ b/tests/generic/304.out
@@ -14,7 +14,7 @@ dedupe: Invalid argument
Dedupe max size at nonzero offset (should fail)
dedupe: Invalid argument
Dedupe with huge off/len (should fail)
-XFS_IOC_FILE_EXTENT_SAME: Invalid argument
+dedupe: Invalid argument
Check file creation
file3
7ffffffffffffffe: 61 a
--
2.9.3
^ permalink raw reply related
* [PATCH v3] generic/390: Add tests for inode timestamp policy
From: Deepa Dinamani @ 2017-01-04 3:51 UTC (permalink / raw)
To: fstests; +Cc: arnd, y2038
The test helps to validate clamping and mount behaviors
according to supported file system timestamp ranges.
Note that the test can fail on 32-bit systems for a
few file systems. This will be corrected when vfs is
transitioned to use 64-bit timestamps.
Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
---
The branch of the kernel tree can be located at
https://github.com/deepa-hub/vfs refs/heads/vfs_timestamp_policy
The xfs_io patch to add utimes is at
https://www.spinics.net/lists/linux-xfs/msg02952.html
Changes since v2:
* Refactored notrun handling
* Updated comments
Changes since v1:
* Use xfs_io utimes command
* Updated error handling
* Reorganized code according to review comments
common/rc | 48 +++++++++++++
tests/generic/390 | 192 ++++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/390.out | 2 +
tests/generic/group | 1 +
4 files changed, 243 insertions(+)
create mode 100755 tests/generic/390
create mode 100644 tests/generic/390.out
diff --git a/common/rc b/common/rc
index e3b54ec..17f025e 100644
--- a/common/rc
+++ b/common/rc
@@ -1960,6 +1960,51 @@ _run_aiodio()
return $status
}
+# this test requires y2038 sysfs switch and filesystem
+# timestamp ranges support.
+_require_y2038()
+{
+ local device=${1:-$TEST_DEV}
+ local sysfsdir=/proc/sys/fs/fs-timestamp-check-on
+
+ if [ ! -e $sysfsdir ]; then
+ _notrun "no kernel support for y2038 sysfs switch"
+ fi
+
+ local tsmin tsmax
+ read tsmin tsmax <<<$(_filesystem_timestamp_range $device)
+ if [ $tsmin -eq -1 -a $tsmax -eq -1 ]; then
+ _notrun "filesystem $FSTYP timestamp bounds are unknown"
+ fi
+}
+
+_filesystem_timestamp_range()
+{
+ device=${1:-$TEST_DEV}
+ case $FSTYP in
+ ext4)
+ if [ $(dumpe2fs -h $device 2>/dev/null | grep "Inode size:" | cut -d: -f2) -gt 128 ]; then
+ echo "-2147483648 15032385535"
+ else
+ echo "-2147483648 2147483647"
+ fi
+ ;;
+
+ xfs)
+ echo "-2147483648 2147483647"
+ ;;
+ jfs)
+ echo "0 4294967295"
+ ;;
+ f2fs)
+ echo "-2147483648 2147483647"
+ ;;
+ *)
+ echo "-1 -1"
+ ;;
+ esac
+}
+
# indicate whether YP/NIS is active or not
#
_yp_active()
@@ -2070,6 +2115,9 @@ _require_xfs_io_command()
echo $testio | egrep -q "Inappropriate ioctl" && \
_notrun "xfs_io $command support is missing"
;;
+ "utimes" )
+ testio=`$XFS_IO_PROG -f -c "utimes" 0 0 0 0 $testfile 2>&1`
+ ;;
*)
testio=`$XFS_IO_PROG -c "$command help" 2>&1`
esac
diff --git a/tests/generic/390 b/tests/generic/390
new file mode 100755
index 0000000..f68b931
--- /dev/null
+++ b/tests/generic/390
@@ -0,0 +1,192 @@
+#! /bin/bash
+# FS QA Test 390
+#
+# Tests to verify policy for filesystem timestamps for
+# supported ranges:
+# 1. Verify filesystem rw mount according to sysctl
+# timestamp_supported.
+# 2. Verify timestamp clamping for timestamps beyond max
+# timestamp supported.
+#
+# Exit status 1: either or both tests above fail.
+# Exit status 0: both the above tests pass.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016 Deepa Dinamani. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1 # failure is the default!
+trap "exit \$status" 0 1 2 3 15
+
+# Get standard environment, filters and checks.
+. ./common/rc
+. ./common/filter
+. ./common/attr
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# Prerequisites for the test run.
+_supported_fs generic
+_supported_os Linux
+_require_scratch
+_require_xfs_io_command utimes
+
+# Compare file timestamps obtained from stat
+# with a given timestamp.
+check_stat()
+{
+ file=$1
+ timestamp=$2
+
+ stat_timestamp=`stat -c"%X;%Y" $file`
+
+ prev_timestamp="$timestamp;$timestamp"
+ if [ $prev_timestamp != $stat_timestamp ]; then
+ echo "$prev_timestamp != $stat_timestamp" | tee -a $seqres.full
+ fi
+}
+
+run_test_individual()
+{
+ file=$1
+ timestamp=$2
+ update_time=$3
+
+ #check if the time needs update
+ if [ $update_time -eq 1 ]; then
+ echo "Updating file: $file to timestamp `date -d @$timestamp`" >> $seqres.full
+ $XFS_IO_PROG -f -c "utimes $timestamp 0 $timestamp 0" $file
+ if [ $? -ne 0 ]; then
+ echo "Failed to update times on $file" | tee -a $seqres.full
+ fi
+ fi
+
+ tsclamp=$(($timestamp>$tsmax?$tsmax:$timestamp))
+ echo "Checking file: $file Updated timestamp is `date -d @$tsclamp`" >> $seqres.full
+ check_stat $file $tsclamp
+}
+
+run_test()
+{
+ update_time=$1
+
+ n=1
+
+ for TIME in "${TIMESTAMPS[@]}"
+ do
+ #Run the test
+ run_test_individual ${SCRATCH_MNT}/test_$n $TIME $update_time
+
+ #update iterator
+ ((n++))
+ done
+}
+
+_scratch_mkfs &>> $seqres.full 2>&1 || _fail "mkfs failed"
+_require_y2038 $SCRATCH_DEV
+
+read tsmin tsmax <<<$(_filesystem_timestamp_range $SCRATCH_DEV)
+echo min supported timestamp $tsmin $(date --date=@$tsmin) >> $seqres.full
+echo max supported timestamp $tsmax $(date --date=@$tsmax) >> $seqres.full
+
+# Test timestamps array
+
+declare -a TIMESTAMPS=(
+ $tsmin
+ 0
+ $tsmax
+ $((tsmax+1))
+ 4294967295
+ 8589934591
+ 34359738367
+)
+
+# Max timestamp is hardcoded to Mon Jan 18 19:14:07 PST 2038
+sys_tsmax=2147483647
+echo "max timestamp that needs to be supported by fs for rw mount is" \
+ "$((sys_tsmax+1)) $(date --date=@$((sys_tsmax+1)))" >> $seqres.full
+
+read ts_check <<<$(cat /proc/sys/fs/fs-timestamp-check-on)
+
+_scratch_mount
+result=$?
+
+if [ $ts_check -ne 0 ]; then
+ echo "sysctl filesystem timestamp check is on" >> $seqres.full
+ # check for mount failure if the minimum requirement for max timestamp
+ # supported is not met.
+ if [ $sys_tsmax -ge $tsmax ]; then
+ if [ $result -eq 0 ]; then
+ echo "mount test failed" | tee -a $seqres.full
+ exit
+ fi
+ else
+ if [ $result -ne 0 ]; then
+ echo "failed to mount $SCRATCH_DEV" | tee -a $seqres.full
+ exit
+ fi
+ fi
+else
+ # if sysctl switch is off then mount should succeed always.
+ echo "sysctl filesystem timestamp check is off" >> $seqres.full
+ if [ $result -ne 0 ]; then
+ echo "failed to mount $SCRATCH_DEV and timestamp check is off" >> $seqres.full
+ exit
+ fi
+fi
+
+# Begin test case 1
+echo "In memory timestamps update test start" >> $seqres.full
+
+# update time on the file
+update_time=1
+
+run_test $update_time
+
+echo "In memory timestamps update complete" >> $seqres.full
+
+echo "Unmounting and mounting scratch $SCRATCH_MNT" >> $seqres.full
+
+# unmount and remount $SCRATCH_DEV
+_scratch_cycle_mount
+
+# Begin test case 2
+
+n=1
+
+# Do not update time on the file this time, just read from disk
+update_time=0
+
+echo "On disk timestamps update test start" >> $seqres.full
+
+# Re-run test
+run_test $update_time
+
+echo "On disk timestamps update test complete" >> $seqres.full
+
+echo "y2038 inode timestamp tests completed successfully"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/390.out b/tests/generic/390.out
new file mode 100644
index 0000000..82bd4eb
--- /dev/null
+++ b/tests/generic/390.out
@@ -0,0 +1,2 @@
+QA output created by 390
+y2038 inode timestamp tests completed successfully
diff --git a/tests/generic/group b/tests/generic/group
index 08007d7..d137d01 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -392,3 +392,4 @@
387 auto clone
388 auto log metadata
389 auto quick acl
+390 auto quick rw
--
2.7.4
^ permalink raw reply related
* Re: [PATCH] generic/158,304: filter dedupe error message
From: Eryu Guan @ 2017-01-04 3:27 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: fstests, linux-xfs
In-Reply-To: <20170103200149.GB14031@birch.djwong.org>
On Tue, Jan 03, 2017 at 12:01:49PM -0800, Darrick J. Wong wrote:
> On Fri, Dec 30, 2016 at 12:08:54PM +0800, Eryu Guan wrote:
> > Kernel commit 22725ce4e4a0 ("vfs: fix isize/pos/len checks for reflink &
> > dedupe") added more checks on reflink and dedupe, rejected dedupe past
> > EOF early and explicitly, and causes generic/158 and generic/304 to fail.
> >
> > Try dedupe from past EOF
> > -dedupe: Invalid argument
> > +XFS_IOC_FILE_EXTENT_SAME: Invalid argument
> > Try dedupe to past EOF, destination offset beyond EOF
> >
> > Fix it by replacing fs-specific ioctl in error message to "dedupe".
> >
> > Signed-off-by: Eryu Guan <eguan@redhat.com>
> > ---
> > common/reflink | 7 +++++++
> > tests/generic/158 | 7 +++++--
> > tests/generic/158.out | 4 ++--
> > tests/generic/304 | 9 ++++++---
> > tests/generic/304.out | 2 +-
> > 5 files changed, 21 insertions(+), 8 deletions(-)
> >
> > diff --git a/common/reflink b/common/reflink
> > index 64ee04f..7306efd 100644
> > --- a/common/reflink
> > +++ b/common/reflink
> > @@ -241,6 +241,13 @@ _dedupe_range() {
> > $XFS_IO_PROG $xfs_io_args -f -c "dedupe $file1 $offset1 $offset2 $len" "$file2"
> > }
> >
> > +# Filter fs-specific ioctl in error message to "dedupe"
> > +# e.g. replace XFS_IOC_FILE_EXTENT_SAME with dedupe
> > +_filter_dedupe()
> > +{
> > + sed -e 's/XFS_IOC_FILE_EXTENT_SAME/dedupe/g'
> > +}
>
> I sent a patch to the xfs list last month ("xfs_io: prefix dedupe
> command error messages consistently") changing all the error message
> prefixes to "XFS_IOC_FILE_EXTENT_SAME". Was going to send a patch to
> fix up xfstests too... but evidently didn't.
Ah, didn't notict that patch.. Or I did saw the patch but failed to link
it with this test failure :)
>
> If you change the sed command to 's/dedupe:/XFS_IOC_FILE_EXTENT_SAME:/g'
> that'll suffice, I think.
Will do. Thanks!
Eryu
^ permalink raw reply
* Re: [PATCH v2 1/3] xfs/348: test handling of invalid inode modes
From: Darrick J. Wong @ 2017-01-03 20:36 UTC (permalink / raw)
To: Amir Goldstein
Cc: Eryu Guan, Christoph Hellwig, Brian Foster, fstests, linux-xfs
In-Reply-To: <1482689376-23553-2-git-send-email-amir73il@gmail.com>
On Sun, Dec 25, 2016 at 08:09:34PM +0200, Amir Goldstein wrote:
> Set all possible file type values for different types of files
> and verify that xfs_repair detects the correct errors.
>
> When setting invalid file type values (e.g. core.mode = 0170644),
> all files are expected to have been junked by xfs_repair.
>
> When setting valid file type values to non matching file types,
> xfs_repair would either detect wrong format and junk the file, e.g.:
> would have junked entry "FILE" in directory PARENT_INO
> or detect a ftype mismatch error, e.g.:
> would fix ftype mismatch (5/3) in directory/child PARENT_INO/FIFO_INO
>
> If ftype feature is enabled, when setting file type to one of the
> special types (i.e. FIFO(1), CHRDEV(2),BLKDEV(6),SOCKET(14)),
> xfs_repair is expected to detect ftype mismatch error. Otherewise,
"Otherwise"
> xfs_repair is not expected to detect ftype mismatch error.
>
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> ---
> tests/xfs/348 | 128 ++++++++++++++++++++++++++++++++
> tests/xfs/348.out | 216 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> tests/xfs/group | 1 +
> 3 files changed, 345 insertions(+)
> create mode 100755 tests/xfs/348
> create mode 100644 tests/xfs/348.out
>
> diff --git a/tests/xfs/348 b/tests/xfs/348
> new file mode 100755
> index 0000000..9ec696a
> --- /dev/null
> +++ b/tests/xfs/348
> @@ -0,0 +1,128 @@
> +#! /bin/bash
> +# FSQA Test No. 348
> +#
> +# Test handling of invalid inode modes
> +#
> +# Set all possible file type values for different types of files
> +# and verify that xfs_repair detects the correct errors.
> +#
> +#-----------------------------------------------------------------------
> +#
> +# Copyright (C) 2016 CTERA Networks. All Rights Reserved.
> +# Author: Amir Goldstein <amir73il@gmail.com>
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
> +#-----------------------------------------------------------------------
> +#
> +
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +tmp=/tmp/$$
> +status=1 # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> + rm -f $tmp.*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +. ./common/repair
> +
> +# real QA test starts here
> +_supported_fs xfs
> +_supported_os Linux
> +_require_scratch
> +
> +rm -f $seqres.full
> +
> +_scratch_mkfs >>$seqres.full 2>&1
> +
> +_scratch_mount
> +
> +# Create our test files.
> +testdir=$SCRATCH_MNT/test
> +mkdir -p $testdir
> +mkdir $testdir/DIR
> +echo 123 > $testdir/FILE
> +ln -s $testdir/FILE $testdir/SYMLINK
> +mknod $testdir/CHRDEV c 1 1
> +mknod $testdir/BLKDEV b 1 1
> +mknod $testdir/FIFO p
> +
> +xfs_info $SCRATCH_MNT | grep -q "ftype=1" && FTYPE_FEATURE=1
> +
> +# Record test dir inode for xfs_repair filter
> +inode_filter=$tmp.sed
> +rm -f $inode_filter
> +pino=$(ls -id $testdir | awk '{print $1}')
> +echo "s/inode $pino/PARENT_INO/" >> $inode_filter
> +echo "s/directory $pino/directory PARENT_INO/" >> $inode_filter
> +
> +inodes=""
> +# Record inode numbers for xfs_db commands and xfs_repair filter
> +for f in DIR FILE SYMLINK CHRDEV BLKDEV FIFO; do
> + ino=$(ls -id $testdir/$f | awk '{print $1}')
> + inodes="$inodes $ino"
> + echo "s/inode $ino/${f}_INO/" >> $inode_filter
> +done
> +
> +_scratch_unmount
> +
> +# Possible mode file type values (mode & S_IFMT) >> 12
> +dtypes="0 1 2 3 4 5 6 7 10 11 12 13 14 15 16 17"
> +echo "===== Find inode by file type:"
> +for dt in $dtypes; do
> + # Set all our test files to dt value
> + for ino in $inodes; do
> + _scratch_xfs_db -c "inode $ino" -c "print core.mode" | \
> + grep -q "0${dt}0...$" && \
> + (echo "dt=$dt => inode $ino" | sed -f $inode_filter)
> + done
> +done
> +for dt in $dtypes; do
> + echo
> + echo "===== Setting dt=$dt to all files:"
> + # Set all our test files to dt value
> + for ino in $inodes; do
> + _scratch_xfs_db -x -c "inode $ino" -c "write core.mode 0${dt}0644"
> + done
> + # Repair should detect the inconsistencies
> + # For invalid dt values, all files would have been junked.
> + # For valid dt values, one test file is expected to be valid.
> + # The rest would either have wrong format or non matching dir ftype.
> + _scratch_xfs_repair -n 2>&1 | tee -a $seqres.full | \
> + _filter_repair | grep "^would have junked" | sed -f $inode_filter | sort -u
I would also like to see a second test that scrambles the ftype field in
the directory entry (instead of changing the inode core.mode) but xfs_db
can't write to dir3 blocks because it doesn't know how to set the dir
block CRC.
I'm going to send a patch to add that as part of my xfsprogs 4.11
patchbomb (hopefully next week, but after the xfsprogs 4.9 release) so
that test can wait.
> + # If ftype feature is enabled, when setting file type to one of the
> + # special types (i.e. FIFO(1), CHRDEV(2),BLKDEV(6),SOCKET(14)),
> + # xfs_repair is expected to detect ftype mismatch error. Otherewise,
> + # xfs_repair is not expected to detect ftype mismatch error.
> + if [ "$FTYPE_FEATURE" = 1 ] && (echo ':1:2:6:14:' | grep -q ":$dt:"); then
> + _scratch_xfs_repair -n 2>&1 | grep -q "^would fix ftype mismatch" || \
> + _fail "xfs_repair should fix ftype mismatch"
> + else
> + _scratch_xfs_repair -n 2>&1 | grep -q -v "^would fix ftype mismatch" || \
> + _fail "xfs_repair should not fix ftype mismatch"
Just FYI the whole test will stop as soon as we hit a _fail. Please
consider simply echoing a complaint to stdout so that the golden output
diff will catch this, and we can see all the failing cases.
--D
> + fi
> +done
> +
> +# Repair should detect and junk all test files
> +_scratch_xfs_repair 2>&1 >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
> +
> +status=0
> +exit
> diff --git a/tests/xfs/348.out b/tests/xfs/348.out
> new file mode 100644
> index 0000000..bf4924b
> --- /dev/null
> +++ b/tests/xfs/348.out
> @@ -0,0 +1,216 @@
> +QA output created by 348
> +===== Find inode by file type:
> +dt=1 => FIFO_INO
> +dt=2 => CHRDEV_INO
> +dt=4 => DIR_INO
> +dt=6 => BLKDEV_INO
> +dt=10 => FILE_INO
> +dt=12 => SYMLINK_INO
> +
> +===== Setting dt=0 to all files:
> +core.mode = 0644
> +core.mode = 0644
> +core.mode = 0644
> +core.mode = 0644
> +core.mode = 0644
> +core.mode = 0644
> +would have junked entry "BLKDEV" in directory PARENT_INO
> +would have junked entry "CHRDEV" in directory PARENT_INO
> +would have junked entry "DIR" in directory PARENT_INO
> +would have junked entry "FIFO" in directory PARENT_INO
> +would have junked entry "FILE" in directory PARENT_INO
> +would have junked entry "SYMLINK" in directory PARENT_INO
> +
> +===== Setting dt=1 to all files:
> +core.mode = 010644
> +core.mode = 010644
> +core.mode = 010644
> +core.mode = 010644
> +core.mode = 010644
> +core.mode = 010644
> +would have junked entry "DIR" in directory PARENT_INO
> +would have junked entry "FILE" in directory PARENT_INO
> +would have junked entry "SYMLINK" in directory PARENT_INO
> +
> +===== Setting dt=2 to all files:
> +core.mode = 020644
> +core.mode = 020644
> +core.mode = 020644
> +core.mode = 020644
> +core.mode = 020644
> +core.mode = 020644
> +would have junked entry "DIR" in directory PARENT_INO
> +would have junked entry "FILE" in directory PARENT_INO
> +would have junked entry "SYMLINK" in directory PARENT_INO
> +
> +===== Setting dt=3 to all files:
> +core.mode = 030644
> +core.mode = 030644
> +core.mode = 030644
> +core.mode = 030644
> +core.mode = 030644
> +core.mode = 030644
> +would have junked entry "BLKDEV" in directory PARENT_INO
> +would have junked entry "CHRDEV" in directory PARENT_INO
> +would have junked entry "DIR" in directory PARENT_INO
> +would have junked entry "FIFO" in directory PARENT_INO
> +would have junked entry "FILE" in directory PARENT_INO
> +would have junked entry "SYMLINK" in directory PARENT_INO
> +
> +===== Setting dt=4 to all files:
> +core.mode = 040644
> +core.mode = 040644
> +core.mode = 040644
> +core.mode = 040644
> +core.mode = 040644
> +core.mode = 040644
> +would have junked entry "BLKDEV" in directory PARENT_INO
> +would have junked entry "CHRDEV" in directory PARENT_INO
> +would have junked entry "FIFO" in directory PARENT_INO
> +would have junked entry "FILE" in directory PARENT_INO
> +
> +===== Setting dt=5 to all files:
> +core.mode = 050644
> +core.mode = 050644
> +core.mode = 050644
> +core.mode = 050644
> +core.mode = 050644
> +core.mode = 050644
> +would have junked entry "BLKDEV" in directory PARENT_INO
> +would have junked entry "CHRDEV" in directory PARENT_INO
> +would have junked entry "DIR" in directory PARENT_INO
> +would have junked entry "FIFO" in directory PARENT_INO
> +would have junked entry "FILE" in directory PARENT_INO
> +would have junked entry "SYMLINK" in directory PARENT_INO
> +
> +===== Setting dt=6 to all files:
> +core.mode = 060644
> +core.mode = 060644
> +core.mode = 060644
> +core.mode = 060644
> +core.mode = 060644
> +core.mode = 060644
> +would have junked entry "DIR" in directory PARENT_INO
> +would have junked entry "FILE" in directory PARENT_INO
> +would have junked entry "SYMLINK" in directory PARENT_INO
> +
> +===== Setting dt=7 to all files:
> +core.mode = 070644
> +core.mode = 070644
> +core.mode = 070644
> +core.mode = 070644
> +core.mode = 070644
> +core.mode = 070644
> +would have junked entry "BLKDEV" in directory PARENT_INO
> +would have junked entry "CHRDEV" in directory PARENT_INO
> +would have junked entry "DIR" in directory PARENT_INO
> +would have junked entry "FIFO" in directory PARENT_INO
> +would have junked entry "FILE" in directory PARENT_INO
> +would have junked entry "SYMLINK" in directory PARENT_INO
> +
> +===== Setting dt=10 to all files:
> +core.mode = 0100644
> +core.mode = 0100644
> +core.mode = 0100644
> +core.mode = 0100644
> +core.mode = 0100644
> +core.mode = 0100644
> +would have junked entry "BLKDEV" in directory PARENT_INO
> +would have junked entry "CHRDEV" in directory PARENT_INO
> +would have junked entry "DIR" in directory PARENT_INO
> +would have junked entry "FIFO" in directory PARENT_INO
> +would have junked entry "SYMLINK" in directory PARENT_INO
> +
> +===== Setting dt=11 to all files:
> +core.mode = 0110644
> +core.mode = 0110644
> +core.mode = 0110644
> +core.mode = 0110644
> +core.mode = 0110644
> +core.mode = 0110644
> +would have junked entry "BLKDEV" in directory PARENT_INO
> +would have junked entry "CHRDEV" in directory PARENT_INO
> +would have junked entry "DIR" in directory PARENT_INO
> +would have junked entry "FIFO" in directory PARENT_INO
> +would have junked entry "FILE" in directory PARENT_INO
> +would have junked entry "SYMLINK" in directory PARENT_INO
> +
> +===== Setting dt=12 to all files:
> +core.mode = 0120644
> +core.mode = 0120644
> +core.mode = 0120644
> +core.mode = 0120644
> +core.mode = 0120644
> +core.mode = 0120644
> +would have junked entry "BLKDEV" in directory PARENT_INO
> +would have junked entry "CHRDEV" in directory PARENT_INO
> +would have junked entry "DIR" in directory PARENT_INO
> +would have junked entry "FIFO" in directory PARENT_INO
> +would have junked entry "FILE" in directory PARENT_INO
> +
> +===== Setting dt=13 to all files:
> +core.mode = 0130644
> +core.mode = 0130644
> +core.mode = 0130644
> +core.mode = 0130644
> +core.mode = 0130644
> +core.mode = 0130644
> +would have junked entry "BLKDEV" in directory PARENT_INO
> +would have junked entry "CHRDEV" in directory PARENT_INO
> +would have junked entry "DIR" in directory PARENT_INO
> +would have junked entry "FIFO" in directory PARENT_INO
> +would have junked entry "FILE" in directory PARENT_INO
> +would have junked entry "SYMLINK" in directory PARENT_INO
> +
> +===== Setting dt=14 to all files:
> +core.mode = 0140644
> +core.mode = 0140644
> +core.mode = 0140644
> +core.mode = 0140644
> +core.mode = 0140644
> +core.mode = 0140644
> +would have junked entry "DIR" in directory PARENT_INO
> +would have junked entry "FILE" in directory PARENT_INO
> +would have junked entry "SYMLINK" in directory PARENT_INO
> +
> +===== Setting dt=15 to all files:
> +core.mode = 0150644
> +core.mode = 0150644
> +core.mode = 0150644
> +core.mode = 0150644
> +core.mode = 0150644
> +core.mode = 0150644
> +would have junked entry "BLKDEV" in directory PARENT_INO
> +would have junked entry "CHRDEV" in directory PARENT_INO
> +would have junked entry "DIR" in directory PARENT_INO
> +would have junked entry "FIFO" in directory PARENT_INO
> +would have junked entry "FILE" in directory PARENT_INO
> +would have junked entry "SYMLINK" in directory PARENT_INO
> +
> +===== Setting dt=16 to all files:
> +core.mode = 0160644
> +core.mode = 0160644
> +core.mode = 0160644
> +core.mode = 0160644
> +core.mode = 0160644
> +core.mode = 0160644
> +would have junked entry "BLKDEV" in directory PARENT_INO
> +would have junked entry "CHRDEV" in directory PARENT_INO
> +would have junked entry "DIR" in directory PARENT_INO
> +would have junked entry "FIFO" in directory PARENT_INO
> +would have junked entry "FILE" in directory PARENT_INO
> +would have junked entry "SYMLINK" in directory PARENT_INO
> +
> +===== Setting dt=17 to all files:
> +core.mode = 0170644
> +core.mode = 0170644
> +core.mode = 0170644
> +core.mode = 0170644
> +core.mode = 0170644
> +core.mode = 0170644
> +would have junked entry "BLKDEV" in directory PARENT_INO
> +would have junked entry "CHRDEV" in directory PARENT_INO
> +would have junked entry "DIR" in directory PARENT_INO
> +would have junked entry "FIFO" in directory PARENT_INO
> +would have junked entry "FILE" in directory PARENT_INO
> +would have junked entry "SYMLINK" in directory PARENT_INO
> diff --git a/tests/xfs/group b/tests/xfs/group
> index c237b50..68c2bb6 100644
> --- a/tests/xfs/group
> +++ b/tests/xfs/group
> @@ -334,3 +334,4 @@
> 345 auto quick clone
> 346 auto quick clone
> 347 auto quick clone
> +348 auto quick repair
> --
> 2.7.4
>
^ permalink raw reply
* Re: [PATCH] generic/158,304: filter dedupe error message
From: Darrick J. Wong @ 2017-01-03 20:01 UTC (permalink / raw)
To: Eryu Guan; +Cc: fstests, linux-xfs
In-Reply-To: <20161230040854.17512-1-eguan@redhat.com>
On Fri, Dec 30, 2016 at 12:08:54PM +0800, Eryu Guan wrote:
> Kernel commit 22725ce4e4a0 ("vfs: fix isize/pos/len checks for reflink &
> dedupe") added more checks on reflink and dedupe, rejected dedupe past
> EOF early and explicitly, and causes generic/158 and generic/304 to fail.
>
> Try dedupe from past EOF
> -dedupe: Invalid argument
> +XFS_IOC_FILE_EXTENT_SAME: Invalid argument
> Try dedupe to past EOF, destination offset beyond EOF
>
> Fix it by replacing fs-specific ioctl in error message to "dedupe".
>
> Signed-off-by: Eryu Guan <eguan@redhat.com>
> ---
> common/reflink | 7 +++++++
> tests/generic/158 | 7 +++++--
> tests/generic/158.out | 4 ++--
> tests/generic/304 | 9 ++++++---
> tests/generic/304.out | 2 +-
> 5 files changed, 21 insertions(+), 8 deletions(-)
>
> diff --git a/common/reflink b/common/reflink
> index 64ee04f..7306efd 100644
> --- a/common/reflink
> +++ b/common/reflink
> @@ -241,6 +241,13 @@ _dedupe_range() {
> $XFS_IO_PROG $xfs_io_args -f -c "dedupe $file1 $offset1 $offset2 $len" "$file2"
> }
>
> +# Filter fs-specific ioctl in error message to "dedupe"
> +# e.g. replace XFS_IOC_FILE_EXTENT_SAME with dedupe
> +_filter_dedupe()
> +{
> + sed -e 's/XFS_IOC_FILE_EXTENT_SAME/dedupe/g'
> +}
I sent a patch to the xfs list last month ("xfs_io: prefix dedupe
command error messages consistently") changing all the error message
prefixes to "XFS_IOC_FILE_EXTENT_SAME". Was going to send a patch to
fix up xfstests too... but evidently didn't.
If you change the sed command to 's/dedupe:/XFS_IOC_FILE_EXTENT_SAME:/g'
that'll suffice, I think.
--D
> +
> # Create a file of interleaved unwritten and reflinked blocks
> _weave_reflink_unwritten() {
> blksz=$1
> diff --git a/tests/generic/158 b/tests/generic/158
> index 086c522..77ab1ce 100755
> --- a/tests/generic/158
> +++ b/tests/generic/158
> @@ -81,10 +81,12 @@ mkfifo $testdir1/fifo1
> sync
>
> _filter_enotty() {
> + _filter_dedupe | \
> sed -e 's/Inappropriate ioctl for device/Invalid argument/g'
> }
>
> _filter_eperm() {
> + _filter_dedupe | \
> sed -e 's/Permission denied/Invalid argument/g'
> }
>
> @@ -98,7 +100,8 @@ echo "Try overlapping dedupe"
> _dedupe_range $testdir1/file1 0 $testdir1/file1 1 $((blksz * 2))
>
> echo "Try dedupe from past EOF"
> -_dedupe_range $testdir1/file1 $(( (blks + 10) * blksz)) $testdir1/file1 0 $blksz
> +_dedupe_range $testdir1/file1 $(( (blks + 10) * blksz)) $testdir1/file1 0 $blksz \
> + 2>&1 | _filter_dedupe
>
> echo "Try dedupe to past EOF, destination offset beyond EOF"
> _dedupe_range $testdir1/file1 0 $testdir1/file1 $(( (blks + 10) * blksz)) \
> @@ -109,7 +112,7 @@ _dedupe_range $testdir1/file1 0 $testdir1/file1 $(( (blks - 1) * blksz)) \
> $((blksz * 2))
>
> echo "Try to dedupe a dir"
> -_dedupe_range $testdir1/dir1 0 $testdir1/file2 0 $blksz
> +_dedupe_range $testdir1/dir1 0 $testdir1/file2 0 $blksz 2>&1 | _filter_dedupe
>
> echo "Try to dedupe a device"
> _dedupe_range $testdir1/dev1 0 $testdir1/file2 0 $blksz 2>&1 | _filter_enotty
> diff --git a/tests/generic/158.out b/tests/generic/158.out
> index 9b82ddf..3a9596f 100644
> --- a/tests/generic/158.out
> +++ b/tests/generic/158.out
> @@ -14,9 +14,9 @@ dedupe: Invalid argument
> Try dedupe to past EOF, destination offset behind EOF
> dedupe: Invalid argument
> Try to dedupe a dir
> -XFS_IOC_FILE_EXTENT_SAME: Is a directory
> +dedupe: Is a directory
> Try to dedupe a device
> -XFS_IOC_FILE_EXTENT_SAME: Invalid argument
> +dedupe: Invalid argument
> Try to dedupe to a dir
> TEST_DIR/test-158/dir1: Is a directory
> Try to dedupe to a device
> diff --git a/tests/generic/304 b/tests/generic/304
> index b7ee7b9..8f0a3b4 100755
> --- a/tests/generic/304
> +++ b/tests/generic/304
> @@ -75,13 +75,16 @@ echo "Dedupe high offset to low offset"
> _dedupe_range $testdir/file1 $bigoff_64k $testdir/file6 1048576 65535 >> $seqres.full
>
> echo "Dedupe past source file EOF (should fail)"
> -_dedupe_range $testdir/file2 524288 $testdir/file7 0 1048576 >> $seqres.full
> +_dedupe_range $testdir/file2 524288 $testdir/file7 0 1048576 \
> + 2>&1 >> $seqres.full | _filter_dedupe
>
> echo "Dedupe max size at nonzero offset (should fail)"
> -_dedupe_range $testdir/file2 524288 $testdir/file8 0 $len >> $seqres.full
> +_dedupe_range $testdir/file2 524288 $testdir/file8 0 $len \
> + 2>&1 >> $seqres.full | _filter_dedupe
>
> echo "Dedupe with huge off/len (should fail)"
> -_dedupe_range $testdir/file2 $bigoff_64k $testdir/file9 0 $bigoff_64k >> $seqres.full
> +_dedupe_range $testdir/file2 $bigoff_64k $testdir/file9 0 $bigoff_64k \
> + 2>&1 >> $seqres.full | _filter_dedupe
>
> echo "Check file creation"
> _test_cycle_mount
> diff --git a/tests/generic/304.out b/tests/generic/304.out
> index 7b5ff0e..fbba6f3 100644
> --- a/tests/generic/304.out
> +++ b/tests/generic/304.out
> @@ -14,7 +14,7 @@ dedupe: Invalid argument
> Dedupe max size at nonzero offset (should fail)
> dedupe: Invalid argument
> Dedupe with huge off/len (should fail)
> -XFS_IOC_FILE_EXTENT_SAME: Invalid argument
> +dedupe: Invalid argument
> Check file creation
> file3
> 7ffffffffffffffe: 61 a
> --
> 2.9.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH 3/3] check: document tests include/exclude options
From: Amir Goldstein @ 2017-01-03 9:15 UTC (permalink / raw)
To: Eryu Guan; +Cc: fstests
In-Reply-To: <1483363379-10210-2-git-send-email-amir73il@gmail.com>
Add argument description and examples to usage() for the
various tests include and exclude options.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
check | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/check b/check
index 8d1ec71..5a93c94 100755
--- a/check
+++ b/check
@@ -80,9 +80,36 @@ check options
testlist options
-g group[,group...] include tests from these groups
-x group[,group...] exclude tests from these groups
- -X file exclude individual tests
+ -X exclude_file exclude individual tests
-E external_file exclude individual tests
[testlist] include tests matching names in testlist
+
+testlist argument is a list of tests in the form of <test dir>/<test name>.
+
+<test dir> is a directory under tests that contains a group file,
+with a list of the names of the tests in that directory.
+
+<test name> may be either a specific test file name (e.g. xfs/001) or
+a test file name match pattern (e.g. xfs/*).
+
+group argument is either a name of a tests group to collect from all
+the test dirs (e.g. quick) or a name of a tests group to collect from
+a specific tests dir in the form of <test dir>/<group name> (e.g. xfs/quick).
+
+exclude_file argument refers to a name of a file inside each test directory.
+for every test dir where this file is found, the listed test names are
+excluded from the list of tests to run from that test dir.
+
+external_file argument is a path to a single file containing a list of tests
+to exclude in the form of <test dir>/<test name>.
+
+examples:
+ check xfs/001
+ check -g quick
+ check -g xfs/quick
+ check -x stress xfs/*
+ check -X .exclude -g auto
+ check -E ~/.xfstests.exclude
'
exit 0
}
--
2.7.4
^ permalink raw reply related
* Re: [PATCH 2/2] check: support include/exclude of sub groups
From: Amir Goldstein @ 2017-01-03 9:10 UTC (permalink / raw)
To: Eryu Guan; +Cc: fstests
In-Reply-To: <20170103050607.GJ1859@eguan.usersys.redhat.com>
On Tue, Jan 3, 2017 at 7:06 AM, Eryu Guan <eguan@redhat.com> wrote:
> On Mon, Jan 02, 2017 at 03:22:59PM +0200, Amir Goldstein wrote:
>> Allow including and/or excluding tests by test dir and group.
>> -g and -x command line arguments can take the form of
>> <subdir>/<group>.
>>
>> For example:
>>
>> ./check -n -g xfs/quick
>> ./check -n -g stress -x xfs/stress
>> ./check -n -g xfs/punch -x dangerous_fuzzers
>>
>> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
>
> This looks handy to me! Mention this usage in usage() function too?
>
usage() is so far behind and cryptic (what is the difference between -E and -X?)
I will send a separate patch to address these and the new subgroup as well.
> Thanks,
> Eryu
>
>> ---
>> check | 8 ++++++++
>> 1 file changed, 8 insertions(+)
>>
>> diff --git a/check b/check
>> index faf6281..8d1ec71 100755
>> --- a/check
>> +++ b/check
>> @@ -105,6 +105,14 @@ get_group_list()
>> {
>> local grp=$1
>> local grpl=""
>> + local sub=$(dirname $grp)
>> +
>> + if [ -n "$sub" -a "$sub" != "." -a -d "$SRC_DIR/$sub" ]; then
>> + # group is given as <subdir>/<group> (e.g. xfs/quick)
>> + grp=$(basename $grp)
>> + get_sub_group_list $sub $grp
>> + return
>> + fi
>>
>> for d in $SRC_GROUPS $FSTYP; do
>> if ! test -d "$SRC_DIR/$d" ; then
>> --
>> 2.7.4
>>
^ permalink raw reply
* Re: [PATCH v2 0/3] xfs/348: test handling of malformed inode mode
From: Eryu Guan @ 2017-01-03 5:52 UTC (permalink / raw)
To: Amir Goldstein
Cc: Darrick J . Wong, Christoph Hellwig, Brian Foster, fstests,
linux-xfs
In-Reply-To: <1482689376-23553-1-git-send-email-amir73il@gmail.com>
On Sun, Dec 25, 2016 at 08:09:33PM +0200, Amir Goldstein wrote:
> Eryu,
>
> I beefed up the initial test sent earlier today with more checks
> on mounted fs.
>
> The original patch testing only xfs_repair remains patch 1 in this series.
>
> Patch 2 adds fstat tests on mounted fs, which are safe on my test system.
>
> Patch 3 is explosive. It exposes an XFS assert, but I left a "safety pin"
> that needs to be commented out to reproduce the assert.
My kenrel config doesn't turn DEBUG on, so I don't see a kernel crash :)
I can push this test out after the fix lands in upstream, then I think
there's no need to leave a switch in the test.
Otherwise tests look good to me. But I'd like to have Darrick to review
too, as he had written many fuzzer tests and suggested this test :)
Thanks,
Eryu
>
> I will soon post my kernel configs and dmesg logs.
>
> Amir.
>
> v2:
> - test fstat with malformed inode mode
> - test readlink/readdir with malformed inode mode
>
> v1:
> - test xfs_repair with malformed inode mode
>
> Amir Goldstein (3):
> xfs/348: test handling of invalid inode modes
> xfs/348: test fstat with malformed inode mode
> xfs/348: test readlink/readdir with malformed inode mode
>
> tests/xfs/348 | 154 +++++++++++++++++++++++++++
> tests/xfs/348.out | 312 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> tests/xfs/group | 1 +
> 3 files changed, 467 insertions(+)
> create mode 100755 tests/xfs/348
> create mode 100644 tests/xfs/348.out
>
> --
> 2.7.4
>
^ permalink raw reply
* Re: [PATCH 2/2] check: support include/exclude of sub groups
From: Eryu Guan @ 2017-01-03 5:06 UTC (permalink / raw)
To: Amir Goldstein; +Cc: fstests
In-Reply-To: <1483363379-10210-2-git-send-email-amir73il@gmail.com>
On Mon, Jan 02, 2017 at 03:22:59PM +0200, Amir Goldstein wrote:
> Allow including and/or excluding tests by test dir and group.
> -g and -x command line arguments can take the form of
> <subdir>/<group>.
>
> For example:
>
> ./check -n -g xfs/quick
> ./check -n -g stress -x xfs/stress
> ./check -n -g xfs/punch -x dangerous_fuzzers
>
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
This looks handy to me! Mention this usage in usage() function too?
Thanks,
Eryu
> ---
> check | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/check b/check
> index faf6281..8d1ec71 100755
> --- a/check
> +++ b/check
> @@ -105,6 +105,14 @@ get_group_list()
> {
> local grp=$1
> local grpl=""
> + local sub=$(dirname $grp)
> +
> + if [ -n "$sub" -a "$sub" != "." -a -d "$SRC_DIR/$sub" ]; then
> + # group is given as <subdir>/<group> (e.g. xfs/quick)
> + grp=$(basename $grp)
> + get_sub_group_list $sub $grp
> + return
> + fi
>
> for d in $SRC_GROUPS $FSTYP; do
> if ! test -d "$SRC_DIR/$d" ; then
> --
> 2.7.4
>
^ permalink raw reply
* Re: [PATCH v2] fstests: btrfs/006: Fix false alert due to output change
From: Eryu Guan @ 2017-01-03 4:07 UTC (permalink / raw)
To: Su Yue; +Cc: linux-btrfs, fstests
In-Reply-To: <20170103031617.439-1-suy.fnst@cn.fujitsu.com>
On Mon, Jan 02, 2017 at 10:16:17PM -0500, Su Yue wrote:
> Btrfs-progs v4.9 changed "device status" output by adding one more
> space, which differs from golden output.
> Fix it by using filter '_filter_spaces' to convert multi space into one.
You missed your SOB line. I added
Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
and applied the patch.
Thanks,
Eryu
^ permalink raw reply
* [PATCH v2] fstests: btrfs/006: Fix false alert due to output change
From: Su Yue @ 2017-01-03 3:16 UTC (permalink / raw)
To: linux-btrfs, fstests
Btrfs-progs v4.9 changed "device status" output by adding one more
space, which differs from golden output.
Fix it by using filter '_filter_spaces' to convert multi space into one.
---
v2:
Changed the '_filter_spaces' to match both Tab and Space and tested
all related tests.
---
common/filter | 2 +-
tests/btrfs/006 | 16 ++++++++++++----
tests/btrfs/006.out | 24 ++++++++++++------------
3 files changed, 25 insertions(+), 17 deletions(-)
diff --git a/common/filter b/common/filter
index 397b456..98eff57 100644
--- a/common/filter
+++ b/common/filter
@@ -299,7 +299,7 @@ _filter_scratch_pool()
_filter_spaces()
{
- sed -e 's/ [ ]*/ /g'
+ sed -e "s/\s\+/ /g"
}
_filter_quota()
diff --git a/tests/btrfs/006 b/tests/btrfs/006
index 0863394..d84dfcb 100755
--- a/tests/btrfs/006
+++ b/tests/btrfs/006
@@ -82,13 +82,21 @@ echo "== Sync filesystem"
$BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT > /dev/null
echo "== Show device stats by mountpoint"
-$BTRFS_UTIL_PROG device stats $SCRATCH_MNT | _filter_btrfs_device_stats $TOTAL_DEVS
+$BTRFS_UTIL_PROG device stats $SCRATCH_MNT | \
+ _filter_btrfs_device_stats $TOTAL_DEVS | \
+ _filter_spaces
echo "== Show device stats by first/scratch dev"
-$BTRFS_UTIL_PROG device stats $SCRATCH_DEV | _filter_btrfs_device_stats
+$BTRFS_UTIL_PROG device stats $SCRATCH_DEV | \
+ _filter_btrfs_device_stats | \
+ _filter_spaces
echo "== Show device stats by second dev"
-$BTRFS_UTIL_PROG device stats $FIRST_POOL_DEV | sed -e "s,$FIRST_POOL_DEV,FIRST_POOL_DEV,g"
+$BTRFS_UTIL_PROG device stats $FIRST_POOL_DEV | \
+ sed -e "s,$FIRST_POOL_DEV,FIRST_POOL_DEV,g" | \
+ _filter_spaces
echo "== Show device stats by last dev"
-$BTRFS_UTIL_PROG device stats $LAST_POOL_DEV | sed -e "s,$LAST_POOL_DEV,LAST_POOL_DEV,g"
+$BTRFS_UTIL_PROG device stats $LAST_POOL_DEV | \
+ sed -e "s,$LAST_POOL_DEV,LAST_POOL_DEV,g" | \
+ _filter_spaces
# success, all done
status=0
diff --git a/tests/btrfs/006.out b/tests/btrfs/006.out
index 05b9ac0..a976972 100644
--- a/tests/btrfs/006.out
+++ b/tests/btrfs/006.out
@@ -16,25 +16,25 @@ Label: 'TestLabel.006' uuid: <EXACTUUID>
== Sync filesystem
== Show device stats by mountpoint
<NUMDEVS> [SCRATCH_DEV].corruption_errs <NUM>
-<NUMDEVS> [SCRATCH_DEV].flush_io_errs <NUM>
+<NUMDEVS> [SCRATCH_DEV].flush_io_errs <NUM>
<NUMDEVS> [SCRATCH_DEV].generation_errs <NUM>
-<NUMDEVS> [SCRATCH_DEV].read_io_errs <NUM>
-<NUMDEVS> [SCRATCH_DEV].write_io_errs <NUM>
+<NUMDEVS> [SCRATCH_DEV].read_io_errs <NUM>
+<NUMDEVS> [SCRATCH_DEV].write_io_errs <NUM>
== Show device stats by first/scratch dev
[SCRATCH_DEV].corruption_errs <NUM>
-[SCRATCH_DEV].flush_io_errs <NUM>
+[SCRATCH_DEV].flush_io_errs <NUM>
[SCRATCH_DEV].generation_errs <NUM>
-[SCRATCH_DEV].read_io_errs <NUM>
-[SCRATCH_DEV].write_io_errs <NUM>
+[SCRATCH_DEV].read_io_errs <NUM>
+[SCRATCH_DEV].write_io_errs <NUM>
== Show device stats by second dev
-[FIRST_POOL_DEV].write_io_errs 0
-[FIRST_POOL_DEV].read_io_errs 0
-[FIRST_POOL_DEV].flush_io_errs 0
+[FIRST_POOL_DEV].write_io_errs 0
+[FIRST_POOL_DEV].read_io_errs 0
+[FIRST_POOL_DEV].flush_io_errs 0
[FIRST_POOL_DEV].corruption_errs 0
[FIRST_POOL_DEV].generation_errs 0
== Show device stats by last dev
-[LAST_POOL_DEV].write_io_errs 0
-[LAST_POOL_DEV].read_io_errs 0
-[LAST_POOL_DEV].flush_io_errs 0
+[LAST_POOL_DEV].write_io_errs 0
+[LAST_POOL_DEV].read_io_errs 0
+[LAST_POOL_DEV].flush_io_errs 0
[LAST_POOL_DEV].corruption_errs 0
[LAST_POOL_DEV].generation_errs 0
--
2.9.3
^ permalink raw reply related
* [PATCH 2/2] check: support include/exclude of sub groups
From: Amir Goldstein @ 2017-01-02 13:22 UTC (permalink / raw)
To: Eryu Guan; +Cc: fstests
In-Reply-To: <1483363379-10210-1-git-send-email-amir73il@gmail.com>
Allow including and/or excluding tests by test dir and group.
-g and -x command line arguments can take the form of
<subdir>/<group>.
For example:
./check -n -g xfs/quick
./check -n -g stress -x xfs/stress
./check -n -g xfs/punch -x dangerous_fuzzers
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
check | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/check b/check
index faf6281..8d1ec71 100755
--- a/check
+++ b/check
@@ -105,6 +105,14 @@ get_group_list()
{
local grp=$1
local grpl=""
+ local sub=$(dirname $grp)
+
+ if [ -n "$sub" -a "$sub" != "." -a -d "$SRC_DIR/$sub" ]; then
+ # group is given as <subdir>/<group> (e.g. xfs/quick)
+ grp=$(basename $grp)
+ get_sub_group_list $sub $grp
+ return
+ fi
for d in $SRC_GROUPS $FSTYP; do
if ! test -d "$SRC_DIR/$d" ; then
--
2.7.4
^ permalink raw reply related
* [PATCH 1/2] check: factor out get_sub_group_list() helper
From: Amir Goldstein @ 2017-01-02 13:22 UTC (permalink / raw)
To: Eryu Guan; +Cc: fstests
This helper gets a list of tests that belong to a group
under a specific tests subdir.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
check | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/check b/check
index cf6379b..faf6281 100755
--- a/check
+++ b/check
@@ -87,19 +87,30 @@ testlist options
exit 0
}
+get_sub_group_list()
+{
+ local d=$1
+ local grp=$2
+
+ test -s "$SRC_DIR/$d/group" || return 1
+
+ local grpl=$(sed -n < $SRC_DIR/$d/group \
+ -e 's/#.*//' \
+ -e 's/$/ /' \
+ -e "s;^\($VALID_TEST_NAME\).* $grp .*;$SRC_DIR/$d/\1;p")
+ echo $grpl
+}
+
get_group_list()
{
- grp=$1
+ local grp=$1
+ local grpl=""
for d in $SRC_GROUPS $FSTYP; do
if ! test -d "$SRC_DIR/$d" ; then
continue
fi
- l=$(sed -n < $SRC_DIR/$d/group \
- -e 's/#.*//' \
- -e 's/$/ /' \
- -e "s;^\($VALID_TEST_NAME\).* $grp .*;$SRC_DIR/$d/\1;p")
- grpl="$grpl $l"
+ grpl="$grpl $(get_sub_group_list $d $grp)"
done
echo $grpl
}
--
2.7.4
^ permalink raw reply related
* [ANNOUNCE] fstests: master branch updated to 06557299a5ed
From: Eryu Guan @ 2017-01-05 5:59 UTC (permalink / raw)
To: fstests
[-- Attachment #1: Type: text/plain, Size: 1059 bytes --]
Hi all,
The master branch of the xfstests repository at:
git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git
have just been updated. This is the last fstests update in 2016, also a small
one. I pushed out three btrfs test fixes, left patches that still need further
review/discussion (ubifs support and XFS malformed inode mode tests) to 2017.
Thanks all who have made contributions to fstests in 2016, either patches or
reviews or both. Happy New Year!
Thanks,
Eryu
The new head of the master branch is commit:
06557299a5ed btrfs/104: Redirect mkfs output to avoid false alert
New commits:
Chandan Rajendra (1):
[f7a52fc6db34] btrfs/012: Enable test to be executed on non-4k block size filesystems
Qu Wenruo (1):
[2333197d308e] btrfs/132: wait the writer to avoid EBUSY
Su Yue (1):
[06557299a5ed] btrfs/104: Redirect mkfs output to avoid false alert
Code Diffstat:
tests/btrfs/012 | 4 +++-
tests/btrfs/104 | 2 +-
tests/btrfs/132 | 7 ++++---
3 files changed, 8 insertions(+), 5 deletions(-)
--
Eryu Guan
eguan@redhat.com
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply
* Re: [PATCH] xfstests-bld: document how to add debian packages to GCE image
From: Theodore Ts'o @ 2016-12-31 15:52 UTC (permalink / raw)
To: Eric Biggers; +Cc: fstests, Eric Biggers
In-Reply-To: <20161228212132.GB8557@zzz>
On Wed, Dec 28, 2016 at 03:21:32PM -0600, Eric Biggers wrote:
> That works with kvm-xfstests (gen-image), but it didn't work when I tried it
> with gce-xfstests (gce-create-image) because nothing was actually copying the
> debian packages into the GS bucket for the test appliance to install. How about
> we update gce-create-image to copy the debian packages from
> test-appliances/debs/ into the GS bucket (maybe gsutil rsync -d to a directory
> 'debs'), so that it works in the way you're suggesting?
Oh, right; I had forgotten. I was originally planning on copying the
debian packages into the GS bucket, but I gave up on that because it
was too slow. I didn't try using gsutil rsync, but the multiple round
trips is very likely going to make things slower than we'd like.
Actually, what would probably work better for gce-create-image is
simply add jessie-backports to the apt sources list, and then use
"apt-get install -t jessie-backports <package> ..." to get the newer
version of e2fsprogs, f2fs-tools, etc. If we also use
snapshots.debian.org URL instead of the standard debian download site
(as we do with kvm-xfstests), it also has the advantage making the
build of the image be perfectly reproducible.
Converting kvm-xfstests to using jessie-backports as well is going to
be a bit tricky, since debootstrap doesn't understand how to install
from backports; so this would probably require hacking up something
using python-debian and possibly python-apt. So perhaps we'll just
change gce-create-image to use jessie-backports first, and we can
convert kvm-xfstests later.
- Ted
P.S. BTW, I checked in with the f2fs-tools maintainer and he has no
objections to porting the latest version of f2fs-tools from Debian
stretch to Debian jessie, so that should be happening in the next week
or so.
^ permalink raw reply
* Re: [PATCH v2] generic/390: Add tests for inode timestamp policy
From: Deepa Dinamani @ 2016-12-31 0:18 UTC (permalink / raw)
To: Eryu Guan; +Cc: fstests, Arnd Bergmann, y2038 Mailman List
In-Reply-To: <20161228110509.GA1859@eguan.usersys.redhat.com>
On Wed, Dec 28, 2016 at 3:05 AM, Eryu Guan <eguan@redhat.com> wrote:
> On Sat, Dec 24, 2016 at 07:38:13PM -0800, Deepa Dinamani wrote:
>> The test helps to validate clamping and mount behaviors
>> according to supported file system timestamp ranges.
>>
>> Note that the test can fail on 32-bit systems for a
>> few file systems. This will be corrected when vfs is
>> transitioned to use 64-bit timestamps.
>>
>> Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
>> ---
>> The branch of the kernel tree can be located at
>>
>> https://github.com/deepa-hub/vfs refs/heads/vfs_timestamp_policy
>>
>> The xfs_io patch to add utimes is at
>>
>> https://www.spinics.net/lists/linux-xfs/msg02952.html
>
> Thanks for this info! I built your test kernel and applied the xfs_io
> patch, and I got test failure on XFS, test passed on ext4 (256 inode
> size) without problems, is this expected?
Yes, this is expected.
Since kernel does not have actual limits for xfs filled in.
Although I need to fix the if condition(-gt needs to change to -ge) to
fail on mount here.
>> + f2fs)
>> + echo "-2147483648 2147483647"
>> + ;;
>> + *)
>> + echo "-1 -1"
>> + _notrun "filesystem $FSTYP timestamp bounds are unknown"
>
> This "_notrun" doesn't belong here. I think we can introduce a
> _require_y2038 rule. e.g.
Ok, I will merge this with require_y2038_sysfs() like what you suggest below.
> _require_y2038()
> {
> local device=${1:-$TEST_DEV}
> local sysfsdir=/proc/sys/fs/fs-timestamp-check-on
> if [ ! -ne $sysfsdir ]; then
> _notrun "no kernel support for y2038 sysfs switch"
> fi
>
> local tsmin tsmax
> read tsmin tsmax <<<$(_filesystem_timestamp_range $device)
> if [ $tsmin -eq -1 -a $tsmax -eq -1 ]; then
> _notrun "filesystem $FSTYP timestamp bounds are unknown"
> fi
> }
>
> Then
>
> _scratch_mkfs
> _require_y2038 $SCRATCH_DEV
>
>> + ;;
>> + esac
>> +}
>> +
>> # indicate whether YP/NIS is active or not
>> #
>> _yp_active()
>> @@ -2070,6 +2109,9 @@ _require_xfs_io_command()
>> echo $testio | egrep -q "Inappropriate ioctl" && \
>> _notrun "xfs_io $command support is missing"
>> ;;
>> + "utimes" )
>> + testio=`$XFS_IO_PROG -f -c "utimes" 0 0 0 0 $testfile 2>&1`
>> + ;;
>> *)
>> testio=`$XFS_IO_PROG -c "$command help" 2>&1`
>> esac
>> diff --git a/tests/generic/390 b/tests/generic/390
>> new file mode 100755
>> index 0000000..8ccadad
>> + stat_timestamp=`stat -c"%X;%Y" $file`
>> +
>> + prev_timestamp="$timestamp;$timestamp"
>> + if [ $prev_timestamp != $stat_timestamp ]; then
>> + echo "$prev_timestamp != $stat_timestamp" | tee -a $seqres.full
>> + exit
>
> No need to exit here. We prefer continuing the test in fstests when such
> test failure happens, it enlarges the test coverage and exercises some
> error paths. One exception is that when continuing the test could result
> in blocking all subsequent tests, we should exit early, one example
> provided later.
Ok, will continue here.
>> +{
>> + file=$1
>> + timestamp=$2
>> + update_time=$3
>> +
>> + #check if the time needs update
>> + if [ $update_time -eq 1 ]; then
>> + echo "Updating file: $file to timestamp `date -d @$timestamp`" >> $seqres.full
>> + $XFS_IO_PROG -f -c "utimes $timestamp 0 $timestamp 0" $file
>> + if [ $? -ne 0 ]; then
>> + echo "Failed to update times on $file" | tee -a $seqres.full
>> + exit
>
> Same here.
Will do.
>> + #initialization iterator
>> + n=1
>> +
>> + for TIME in "${TIMESTAMPS[@]}"
>> + do
>> + #Run the test
>> + run_test_individual ${SCRATCH_MNT}/test_$n $TIME $update_time
>> +
>> + #update iterator
>> + ((n++))
>
> Seems the comments here are not necessary, initialize the iterator, run
> the test and update iterator are all obvious.
Will remove comments.
> And we prefer this code style in fstests:
> for TIME in "${TIMESTAMPS[@]}"; do
> ...
> done
>
Will follow this style.
Is there a coding style guide or some recognized good example test?
>> + done
>> +}
>> +
>> +_scratch_mkfs &>> $seqres.full 2>&1 || _fail "mkfs failed"
>
> Let test continue here on mkfs and mount failure, test harness will
> capture these failures too, and running tests in these failure
> conditions sometimes reveal interesting bugs :)
>
> One example that we should exit on mkfs & mount failure is that we're
> testing ENOSPC and going to fulfill the test filesystem, and we'll eat
> all free space on root fs if we failed to mount the test device, and all
> subsequent tests are blocked because of ENOSPC on root fs.
In this test, I want to check for mount failure as that is expected behavior.
Continuing on mkfs should be fine.
>> +read tsmin tsmax <<<$(_filesystem_timestamp_range $SCRATCH_DEV)
>> +
>> +echo min supported timestamp $tsmin $(date --date=@$tsmin) >> $seqres.full
>> +echo max supported timestamp $tsmax $(date --date=@$tsmax) >> $seqres.full
>> +
>> +#Test timestamps array
>
> Please add a space after "#" in comments.
Ok, will update.
>
>> +
>> +declare -a TIMESTAMPS=(
>> + $tsmin
>> + 0
>> + $tsmax
>> + $((tsmax+1))
>> + 4294967295
>> + 8589934591
>> + 34359738367
>> +)
>> +
>> +# Max timestamp is hardcoded to Mon Jan 18 19:14:07 PST 2038
>> +sys_tsmax=2147483647
>> +echo "min timestamp that needs to be supported by fs for rw mount is $sys_tsmax $(date --date=@$sys_tsmax)" >> $seqres.full
>
> Meant "max timestamp" here?
No this is a little tricky. It is the minimum supported max timestamp.
Will update wording so that it is not confusing.
>> +
>> +read ts_check <<<$(cat /proc/sys/fs/fs-timestamp-check-on)
>> +
>> +_scratch_mount
>> +result=$?
>> +
>> +if [ $ts_check -ne 0 ]; then
>> + echo "sysctl filesystem timestamp check is on" >> $seqres.full
>> + if [ $sys_tsmax -gt $tsmax ]; then
>> + if [ $result -eq 0 ]; then
>> + echo "mount test failed" | tee -a $seqres.full
>> + exit
>> + fi
>> + else
>> + if [ $result -ne 0 ]; then
>> + echo "failed to mount $SCRATCH_DEV" | tee -a $seqres.full
>> + exit
>> + fi
>> + fi
>> +else
>> + echo "sysctl filesystem timestamp check is off" >> $seqres.full
>> + if [ $result -ne 0 ]; then
>> + echo "failed to mount $SCRATCH_DEV and timestamp check is off" >> $seqres.full
>> + exit
>> + fi
>> +fi
>
> I think we need some comments on this code block to explain the logic
> and expected behavior.
Will add more comments here.
>> +_scratch_cycle_mount
>> +if [ $? -ne 0 ];then
>> + echo "Failed to remount $SCRATCH_DEV" | tee -a $seqres.full
>> + exit
>> +fi
>
> No need to exit. Further, no need to check _scratch_cycle_mount status.
Will update accordingly.
Will post a v3 with changes.
Thanks,
Deepa
^ permalink raw reply
* Re: [PATCH 2/2] fstests: btrfs/006: Fix false alert due to output change
From: Eryu Guan @ 2016-12-30 6:17 UTC (permalink / raw)
To: Su Yue; +Cc: linux-btrfs, fstests
In-Reply-To: <20161230041410.10038-2-suy.fnst@cn.fujitsu.com>
On Thu, Dec 29, 2016 at 11:14:10PM -0500, Su Yue wrote:
> Btrfs-progs v4.9 changed "device status" output by adding one more
> space, which differs from golden output.
>
> Fix it by introducing new filter to convert multi space into one.
>
> Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
> ---
> common/filter | 6 ++++++
> tests/btrfs/006 | 16 ++++++++++++----
> tests/btrfs/006.out | 24 ++++++++++++------------
> 3 files changed, 30 insertions(+), 16 deletions(-)
>
> diff --git a/common/filter b/common/filter
> index 397b456..4d5e4d0 100644
> --- a/common/filter
> +++ b/common/filter
> @@ -401,5 +401,11 @@ _filter_mknod()
> sed -e "s/mknod: [\`']\(.*\)': File exists/mknod: \1: File exists/"
> }
>
> +# Filter spaces into one
> +_filter_spaces()
> +{
> + sed -e "s/\s\+/ /g"
> +}
> +
There's already one such filter with the same name in common/filter,
does this existing helper work for you?
> # make sure this script returns success
> /bin/true
> diff --git a/tests/btrfs/006 b/tests/btrfs/006
> index 0863394..dc9bfb9 100755
> --- a/tests/btrfs/006
> +++ b/tests/btrfs/006
> @@ -82,13 +82,21 @@ echo "== Sync filesystem"
> $BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT > /dev/null
>
> echo "== Show device stats by mountpoint"
> -$BTRFS_UTIL_PROG device stats $SCRATCH_MNT | _filter_btrfs_device_stats $TOTAL_DEVS
> +$BTRFS_UTIL_PROG device stats $SCRATCH_MNT | \
> + _filter_btrfs_device_stats $TOTAL_DEVS | \
Spaces before tab in above line.
Thanks,
Eryu
> + _filter_spaces
> echo "== Show device stats by first/scratch dev"
> -$BTRFS_UTIL_PROG device stats $SCRATCH_DEV | _filter_btrfs_device_stats
> +$BTRFS_UTIL_PROG device stats $SCRATCH_DEV | \
> + _filter_btrfs_device_stats | \
> + _filter_spaces
> echo "== Show device stats by second dev"
> -$BTRFS_UTIL_PROG device stats $FIRST_POOL_DEV | sed -e "s,$FIRST_POOL_DEV,FIRST_POOL_DEV,g"
> +$BTRFS_UTIL_PROG device stats $FIRST_POOL_DEV | \
> + sed -e "s,$FIRST_POOL_DEV,FIRST_POOL_DEV,g" | \
> + _filter_spaces
> echo "== Show device stats by last dev"
> -$BTRFS_UTIL_PROG device stats $LAST_POOL_DEV | sed -e "s,$LAST_POOL_DEV,LAST_POOL_DEV,g"
> +$BTRFS_UTIL_PROG device stats $LAST_POOL_DEV | \
> + sed -e "s,$LAST_POOL_DEV,LAST_POOL_DEV,g" | \
> + _filter_spaces
>
> # success, all done
> status=0
> diff --git a/tests/btrfs/006.out b/tests/btrfs/006.out
> index 05b9ac0..a976972 100644
> --- a/tests/btrfs/006.out
> +++ b/tests/btrfs/006.out
> @@ -16,25 +16,25 @@ Label: 'TestLabel.006' uuid: <EXACTUUID>
> == Sync filesystem
> == Show device stats by mountpoint
> <NUMDEVS> [SCRATCH_DEV].corruption_errs <NUM>
> -<NUMDEVS> [SCRATCH_DEV].flush_io_errs <NUM>
> +<NUMDEVS> [SCRATCH_DEV].flush_io_errs <NUM>
> <NUMDEVS> [SCRATCH_DEV].generation_errs <NUM>
> -<NUMDEVS> [SCRATCH_DEV].read_io_errs <NUM>
> -<NUMDEVS> [SCRATCH_DEV].write_io_errs <NUM>
> +<NUMDEVS> [SCRATCH_DEV].read_io_errs <NUM>
> +<NUMDEVS> [SCRATCH_DEV].write_io_errs <NUM>
> == Show device stats by first/scratch dev
> [SCRATCH_DEV].corruption_errs <NUM>
> -[SCRATCH_DEV].flush_io_errs <NUM>
> +[SCRATCH_DEV].flush_io_errs <NUM>
> [SCRATCH_DEV].generation_errs <NUM>
> -[SCRATCH_DEV].read_io_errs <NUM>
> -[SCRATCH_DEV].write_io_errs <NUM>
> +[SCRATCH_DEV].read_io_errs <NUM>
> +[SCRATCH_DEV].write_io_errs <NUM>
> == Show device stats by second dev
> -[FIRST_POOL_DEV].write_io_errs 0
> -[FIRST_POOL_DEV].read_io_errs 0
> -[FIRST_POOL_DEV].flush_io_errs 0
> +[FIRST_POOL_DEV].write_io_errs 0
> +[FIRST_POOL_DEV].read_io_errs 0
> +[FIRST_POOL_DEV].flush_io_errs 0
> [FIRST_POOL_DEV].corruption_errs 0
> [FIRST_POOL_DEV].generation_errs 0
> == Show device stats by last dev
> -[LAST_POOL_DEV].write_io_errs 0
> -[LAST_POOL_DEV].read_io_errs 0
> -[LAST_POOL_DEV].flush_io_errs 0
> +[LAST_POOL_DEV].write_io_errs 0
> +[LAST_POOL_DEV].read_io_errs 0
> +[LAST_POOL_DEV].flush_io_errs 0
> [LAST_POOL_DEV].corruption_errs 0
> [LAST_POOL_DEV].generation_errs 0
> --
> 2.9.3
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH 1/2] fstests: btrfs/104: Redirect mkfs output to avoid false alert
From: Su Yue @ 2016-12-30 4:14 UTC (permalink / raw)
To: linux-btrfs, fstests
btrfs/104 doesn't redirect mkfs output correctly, which leads to false
alert.
Fix it.
Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
---
tests/btrfs/104 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/btrfs/104 b/tests/btrfs/104
index e6a6d3b..c8be4dd 100755
--- a/tests/btrfs/104
+++ b/tests/btrfs/104
@@ -107,7 +107,7 @@ _explode_fs_tree () {
# Force the default leaf size as the calculations for making our btree
# heights are based on that.
-_scratch_mkfs "--nodesize 16384"
+_scratch_mkfs "--nodesize 16384" >> $seqres.full 2>&1
_scratch_mount
# populate the default subvolume and create a snapshot ('snap1')
--
2.9.3
^ permalink raw reply related
* [PATCH 2/2] fstests: btrfs/006: Fix false alert due to output change
From: Su Yue @ 2016-12-30 4:14 UTC (permalink / raw)
To: linux-btrfs, fstests
In-Reply-To: <20161230041410.10038-1-suy.fnst@cn.fujitsu.com>
Btrfs-progs v4.9 changed "device status" output by adding one more
space, which differs from golden output.
Fix it by introducing new filter to convert multi space into one.
Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
---
common/filter | 6 ++++++
tests/btrfs/006 | 16 ++++++++++++----
tests/btrfs/006.out | 24 ++++++++++++------------
3 files changed, 30 insertions(+), 16 deletions(-)
diff --git a/common/filter b/common/filter
index 397b456..4d5e4d0 100644
--- a/common/filter
+++ b/common/filter
@@ -401,5 +401,11 @@ _filter_mknod()
sed -e "s/mknod: [\`']\(.*\)': File exists/mknod: \1: File exists/"
}
+# Filter spaces into one
+_filter_spaces()
+{
+ sed -e "s/\s\+/ /g"
+}
+
# make sure this script returns success
/bin/true
diff --git a/tests/btrfs/006 b/tests/btrfs/006
index 0863394..dc9bfb9 100755
--- a/tests/btrfs/006
+++ b/tests/btrfs/006
@@ -82,13 +82,21 @@ echo "== Sync filesystem"
$BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT > /dev/null
echo "== Show device stats by mountpoint"
-$BTRFS_UTIL_PROG device stats $SCRATCH_MNT | _filter_btrfs_device_stats $TOTAL_DEVS
+$BTRFS_UTIL_PROG device stats $SCRATCH_MNT | \
+ _filter_btrfs_device_stats $TOTAL_DEVS | \
+ _filter_spaces
echo "== Show device stats by first/scratch dev"
-$BTRFS_UTIL_PROG device stats $SCRATCH_DEV | _filter_btrfs_device_stats
+$BTRFS_UTIL_PROG device stats $SCRATCH_DEV | \
+ _filter_btrfs_device_stats | \
+ _filter_spaces
echo "== Show device stats by second dev"
-$BTRFS_UTIL_PROG device stats $FIRST_POOL_DEV | sed -e "s,$FIRST_POOL_DEV,FIRST_POOL_DEV,g"
+$BTRFS_UTIL_PROG device stats $FIRST_POOL_DEV | \
+ sed -e "s,$FIRST_POOL_DEV,FIRST_POOL_DEV,g" | \
+ _filter_spaces
echo "== Show device stats by last dev"
-$BTRFS_UTIL_PROG device stats $LAST_POOL_DEV | sed -e "s,$LAST_POOL_DEV,LAST_POOL_DEV,g"
+$BTRFS_UTIL_PROG device stats $LAST_POOL_DEV | \
+ sed -e "s,$LAST_POOL_DEV,LAST_POOL_DEV,g" | \
+ _filter_spaces
# success, all done
status=0
diff --git a/tests/btrfs/006.out b/tests/btrfs/006.out
index 05b9ac0..a976972 100644
--- a/tests/btrfs/006.out
+++ b/tests/btrfs/006.out
@@ -16,25 +16,25 @@ Label: 'TestLabel.006' uuid: <EXACTUUID>
== Sync filesystem
== Show device stats by mountpoint
<NUMDEVS> [SCRATCH_DEV].corruption_errs <NUM>
-<NUMDEVS> [SCRATCH_DEV].flush_io_errs <NUM>
+<NUMDEVS> [SCRATCH_DEV].flush_io_errs <NUM>
<NUMDEVS> [SCRATCH_DEV].generation_errs <NUM>
-<NUMDEVS> [SCRATCH_DEV].read_io_errs <NUM>
-<NUMDEVS> [SCRATCH_DEV].write_io_errs <NUM>
+<NUMDEVS> [SCRATCH_DEV].read_io_errs <NUM>
+<NUMDEVS> [SCRATCH_DEV].write_io_errs <NUM>
== Show device stats by first/scratch dev
[SCRATCH_DEV].corruption_errs <NUM>
-[SCRATCH_DEV].flush_io_errs <NUM>
+[SCRATCH_DEV].flush_io_errs <NUM>
[SCRATCH_DEV].generation_errs <NUM>
-[SCRATCH_DEV].read_io_errs <NUM>
-[SCRATCH_DEV].write_io_errs <NUM>
+[SCRATCH_DEV].read_io_errs <NUM>
+[SCRATCH_DEV].write_io_errs <NUM>
== Show device stats by second dev
-[FIRST_POOL_DEV].write_io_errs 0
-[FIRST_POOL_DEV].read_io_errs 0
-[FIRST_POOL_DEV].flush_io_errs 0
+[FIRST_POOL_DEV].write_io_errs 0
+[FIRST_POOL_DEV].read_io_errs 0
+[FIRST_POOL_DEV].flush_io_errs 0
[FIRST_POOL_DEV].corruption_errs 0
[FIRST_POOL_DEV].generation_errs 0
== Show device stats by last dev
-[LAST_POOL_DEV].write_io_errs 0
-[LAST_POOL_DEV].read_io_errs 0
-[LAST_POOL_DEV].flush_io_errs 0
+[LAST_POOL_DEV].write_io_errs 0
+[LAST_POOL_DEV].read_io_errs 0
+[LAST_POOL_DEV].flush_io_errs 0
[LAST_POOL_DEV].corruption_errs 0
[LAST_POOL_DEV].generation_errs 0
--
2.9.3
^ permalink raw reply related
* [PATCH] generic/158,304: filter dedupe error message
From: Eryu Guan @ 2016-12-30 4:08 UTC (permalink / raw)
To: fstests; +Cc: linux-xfs, darrick.wong, Eryu Guan
Kernel commit 22725ce4e4a0 ("vfs: fix isize/pos/len checks for reflink &
dedupe") added more checks on reflink and dedupe, rejected dedupe past
EOF early and explicitly, and causes generic/158 and generic/304 to fail.
Try dedupe from past EOF
-dedupe: Invalid argument
+XFS_IOC_FILE_EXTENT_SAME: Invalid argument
Try dedupe to past EOF, destination offset beyond EOF
Fix it by replacing fs-specific ioctl in error message to "dedupe".
Signed-off-by: Eryu Guan <eguan@redhat.com>
---
common/reflink | 7 +++++++
tests/generic/158 | 7 +++++--
tests/generic/158.out | 4 ++--
tests/generic/304 | 9 ++++++---
tests/generic/304.out | 2 +-
5 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/common/reflink b/common/reflink
index 64ee04f..7306efd 100644
--- a/common/reflink
+++ b/common/reflink
@@ -241,6 +241,13 @@ _dedupe_range() {
$XFS_IO_PROG $xfs_io_args -f -c "dedupe $file1 $offset1 $offset2 $len" "$file2"
}
+# Filter fs-specific ioctl in error message to "dedupe"
+# e.g. replace XFS_IOC_FILE_EXTENT_SAME with dedupe
+_filter_dedupe()
+{
+ sed -e 's/XFS_IOC_FILE_EXTENT_SAME/dedupe/g'
+}
+
# Create a file of interleaved unwritten and reflinked blocks
_weave_reflink_unwritten() {
blksz=$1
diff --git a/tests/generic/158 b/tests/generic/158
index 086c522..77ab1ce 100755
--- a/tests/generic/158
+++ b/tests/generic/158
@@ -81,10 +81,12 @@ mkfifo $testdir1/fifo1
sync
_filter_enotty() {
+ _filter_dedupe | \
sed -e 's/Inappropriate ioctl for device/Invalid argument/g'
}
_filter_eperm() {
+ _filter_dedupe | \
sed -e 's/Permission denied/Invalid argument/g'
}
@@ -98,7 +100,8 @@ echo "Try overlapping dedupe"
_dedupe_range $testdir1/file1 0 $testdir1/file1 1 $((blksz * 2))
echo "Try dedupe from past EOF"
-_dedupe_range $testdir1/file1 $(( (blks + 10) * blksz)) $testdir1/file1 0 $blksz
+_dedupe_range $testdir1/file1 $(( (blks + 10) * blksz)) $testdir1/file1 0 $blksz \
+ 2>&1 | _filter_dedupe
echo "Try dedupe to past EOF, destination offset beyond EOF"
_dedupe_range $testdir1/file1 0 $testdir1/file1 $(( (blks + 10) * blksz)) \
@@ -109,7 +112,7 @@ _dedupe_range $testdir1/file1 0 $testdir1/file1 $(( (blks - 1) * blksz)) \
$((blksz * 2))
echo "Try to dedupe a dir"
-_dedupe_range $testdir1/dir1 0 $testdir1/file2 0 $blksz
+_dedupe_range $testdir1/dir1 0 $testdir1/file2 0 $blksz 2>&1 | _filter_dedupe
echo "Try to dedupe a device"
_dedupe_range $testdir1/dev1 0 $testdir1/file2 0 $blksz 2>&1 | _filter_enotty
diff --git a/tests/generic/158.out b/tests/generic/158.out
index 9b82ddf..3a9596f 100644
--- a/tests/generic/158.out
+++ b/tests/generic/158.out
@@ -14,9 +14,9 @@ dedupe: Invalid argument
Try dedupe to past EOF, destination offset behind EOF
dedupe: Invalid argument
Try to dedupe a dir
-XFS_IOC_FILE_EXTENT_SAME: Is a directory
+dedupe: Is a directory
Try to dedupe a device
-XFS_IOC_FILE_EXTENT_SAME: Invalid argument
+dedupe: Invalid argument
Try to dedupe to a dir
TEST_DIR/test-158/dir1: Is a directory
Try to dedupe to a device
diff --git a/tests/generic/304 b/tests/generic/304
index b7ee7b9..8f0a3b4 100755
--- a/tests/generic/304
+++ b/tests/generic/304
@@ -75,13 +75,16 @@ echo "Dedupe high offset to low offset"
_dedupe_range $testdir/file1 $bigoff_64k $testdir/file6 1048576 65535 >> $seqres.full
echo "Dedupe past source file EOF (should fail)"
-_dedupe_range $testdir/file2 524288 $testdir/file7 0 1048576 >> $seqres.full
+_dedupe_range $testdir/file2 524288 $testdir/file7 0 1048576 \
+ 2>&1 >> $seqres.full | _filter_dedupe
echo "Dedupe max size at nonzero offset (should fail)"
-_dedupe_range $testdir/file2 524288 $testdir/file8 0 $len >> $seqres.full
+_dedupe_range $testdir/file2 524288 $testdir/file8 0 $len \
+ 2>&1 >> $seqres.full | _filter_dedupe
echo "Dedupe with huge off/len (should fail)"
-_dedupe_range $testdir/file2 $bigoff_64k $testdir/file9 0 $bigoff_64k >> $seqres.full
+_dedupe_range $testdir/file2 $bigoff_64k $testdir/file9 0 $bigoff_64k \
+ 2>&1 >> $seqres.full | _filter_dedupe
echo "Check file creation"
_test_cycle_mount
diff --git a/tests/generic/304.out b/tests/generic/304.out
index 7b5ff0e..fbba6f3 100644
--- a/tests/generic/304.out
+++ b/tests/generic/304.out
@@ -14,7 +14,7 @@ dedupe: Invalid argument
Dedupe max size at nonzero offset (should fail)
dedupe: Invalid argument
Dedupe with huge off/len (should fail)
-XFS_IOC_FILE_EXTENT_SAME: Invalid argument
+dedupe: Invalid argument
Check file creation
file3
7ffffffffffffffe: 61 a
--
2.9.3
^ permalink raw reply related
* Re: [PATCH] xfstests-bld: document how to add debian packages to GCE image
From: Eric Biggers @ 2016-12-28 21:21 UTC (permalink / raw)
To: Theodore Ts'o; +Cc: fstests, Eric Biggers
In-Reply-To: <20161222170433.cbyrt2phsapq2tr7@thunk.org>
On Thu, Dec 22, 2016 at 12:04:33PM -0500, Theodore Ts'o wrote:
> On Wed, Dec 21, 2016 at 10:06:28AM -0800, Eric Biggers wrote:
> > +build your own image, you must first build a 64-bit (amd64) xfstests
> > +tarball as described in the [instructions for building
> > +xfstests](building-xfstests.md). Then copy any additional Debian
> > +packages, for the amd64 architecture, you want to include in the GCE
> > +image into the root directory of GS_BUCKET.
>
> This is phrased a bit awkwardly. The official way is to put the
> debian packages in kvm-xfstests/test-appliances/debs. This works for
> both building gce-xfstests and kvm-xfstests images.
>
That works with kvm-xfstests (gen-image), but it didn't work when I tried it
with gce-xfstests (gce-create-image) because nothing was actually copying the
debian packages into the GS bucket for the test appliance to install. How about
we update gce-create-image to copy the debian packages from
test-appliances/debs/ into the GS bucket (maybe gsutil rsync -d to a directory
'debs'), so that it works in the way you're suggesting?
Also, Documentation/building-rootfs.md already describes adding packages for
kvm-xfstests; it's just gce-xfstests that was missing the documentation. So
perhaps the gce-xfstests documentation should refer to the kvm-xfstests
documentation for full details on adding packages, if the procedure is going to
be the same.
Eric
^ permalink raw reply
* [PATCH v3] xfstests-bld: correct file permissions on test appliance files
From: Eric Biggers @ 2016-12-28 21:08 UTC (permalink / raw)
To: Theodore Ts'o; +Cc: fstests, Eric Biggers
From: Eric Biggers <ebiggers@google.com>
The xfstests-bld repository may have been cloned with a umask that
masked out the group and/or the other bits. When using --update-files
in this situation or when creating a GCE image, the VM ended up in a
state where non-root users were unable to execute anything, which made
all tests using the fsgqa user get skipped. Fix this by copying the r
and x user bits to the group and other bits when creating files.tar.gz.
Also set the owner and group to root while we're at it.
Note that git doesn't actually store file owners, groups, or any mode
bits other than "is the file executable"? So this patch really just
enforces a consistent, sane default for this "unstored" metadata.
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
gen-tarball | 2 +-
kvm-xfstests/gce-xfstests | 3 ++-
kvm-xfstests/kvm-xfstests | 3 ++-
kvm-xfstests/test-appliance/gce-create-image | 3 ++-
4 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/gen-tarball b/gen-tarball
index 2626996..2c5229a 100755
--- a/gen-tarball
+++ b/gen-tarball
@@ -50,5 +50,5 @@ cp bld/lib/client.txt xfstests/lib
echo "STRIP xfstests/*"
find xfstests -mindepth 2 -type f -perm /0111 | xargs $STRIP 2> /dev/null
echo "TAR xfstests"
-tar c --owner=root --group=root --mode=o+g-w xfstests | \
+tar c --owner=root --group=root --mode=go+u-w xfstests | \
$GZIP -9 > xfstests.tar.gz
diff --git a/kvm-xfstests/gce-xfstests b/kvm-xfstests/gce-xfstests
index 4553792..084b30c 100755
--- a/kvm-xfstests/gce-xfstests
+++ b/kvm-xfstests/gce-xfstests
@@ -456,7 +456,8 @@ then
exit 1
fi
(cd "$DIR/test-appliance"; \
- tar -X gce-exclude-files --exclude=etc -C files -cf - . | \
+ tar -X gce-exclude-files --exclude=etc -C files \
+ --owner=root --group=root --mode=go+u-w -cf - . | \
gzip -9n > $LOCAL_FILES)
get_local_hash "$LOCAL_FILES"
get_remote_hash "$GS_FILES"
diff --git a/kvm-xfstests/kvm-xfstests b/kvm-xfstests/kvm-xfstests
index fbdae7a..40c3632 100755
--- a/kvm-xfstests/kvm-xfstests
+++ b/kvm-xfstests/kvm-xfstests
@@ -75,7 +75,8 @@ then
exit 1
fi
(cd "$DIR/test-appliance"; \
- tar -X kvm-exclude-files -C files -cf - . | \
+ tar -X kvm-exclude-files -C files \
+ --owner=root --group=root --mode=go+u-w -cf - . | \
gzip -9n > "$TDIR/files.tar.gz")
tar -r -f $VDH -C "$TDIR" files.tar.gz
rm -rf "$TDIR"
diff --git a/kvm-xfstests/test-appliance/gce-create-image b/kvm-xfstests/test-appliance/gce-create-image
index 56366d1..a901476 100755
--- a/kvm-xfstests/test-appliance/gce-create-image
+++ b/kvm-xfstests/test-appliance/gce-create-image
@@ -87,7 +87,8 @@ then
cat ../../*.ver > files/root/xfstests/git-versions
fi
-tar -X gce-exclude-files -C files -cf - . | gzip -9n > $t
+tar -X gce-exclude-files -C files --owner=root --group=root --mode=go+u-w \
+ -cf - . | gzip -9n > $t
GS_FILES_TARBALL=gs://$GS_BUCKET/files.tar.gz
if test -f files/root/xfstests/git-versions
--
2.11.0
^ permalink raw reply related
* Re: [PATCH v2] xfstests-bld: correct file permissions on test appliance files
From: Eric Biggers @ 2016-12-28 21:07 UTC (permalink / raw)
To: Theodore Ts'o; +Cc: fstests, Eric Biggers
In-Reply-To: <20161222165551.qvccd2sv3ujhkgkk@thunk.org>
On Thu, Dec 22, 2016 at 11:55:51AM -0500, Theodore Ts'o wrote:
> On Wed, Dec 21, 2016 at 10:06:27AM -0800, Eric Biggers wrote:
> > From: Eric Biggers <ebiggers@google.com>
> >
> > The xfstests-bld repository may have been cloned with a umask that
> > masked out the other bits. When using --update-files in this situation
> > or when creating a GCE image, the VM ended up in a state where non-root
> > users were unable to execute anything, which made all tests using the
> > fsgqa user get skipped. Fix this by copying the r and x group bits to
> > the other bits when creating files.tar.gz. Also set the owner and group
> > to root while we're at it.
>
> Wouldn't it be better to use "--mode=go+u-w"? This will solve the
> problem for those people who use a umask of 077.
>
> - Ted
Yes, you're correct. I was thinking that the user and group permissions could
be different on the files, but actually git can only store mode 755 or 644, so
we might as well use go+u-w. I'll send a revised patch.
Eric
^ permalink raw reply
* Re: [PATCH v2] generic/390: Add tests for inode timestamp policy
From: Eryu Guan @ 2016-12-28 11:05 UTC (permalink / raw)
To: Deepa Dinamani; +Cc: fstests, arnd, y2038
In-Reply-To: <1482637093-13139-1-git-send-email-deepa.kernel@gmail.com>
On Sat, Dec 24, 2016 at 07:38:13PM -0800, Deepa Dinamani wrote:
> The test helps to validate clamping and mount behaviors
> according to supported file system timestamp ranges.
>
> Note that the test can fail on 32-bit systems for a
> few file systems. This will be corrected when vfs is
> transitioned to use 64-bit timestamps.
>
> Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
> ---
> The branch of the kernel tree can be located at
>
> https://github.com/deepa-hub/vfs refs/heads/vfs_timestamp_policy
>
> The xfs_io patch to add utimes is at
>
> https://www.spinics.net/lists/linux-xfs/msg02952.html
Thanks for this info! I built your test kernel and applied the xfs_io
patch, and I got test failure on XFS, test passed on ext4 (256 inode
size) without problems, is this expected?
[root@localhost xfstests]# uname -a
Linux localhost 4.9.0-rc6-next-20161123.y2038+ #14 SMP Wed Dec 28 16:01:54 CST 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost xfstests]# diff -u tests/generic/402.out
/root/workspace/xfstests/results//xfs_4k/generic/402.out.bad
--- tests/generic/402.out 2016-12-28 16:16:23.773711175 +0800
+++ /root/workspace/xfstests/results//xfs_4k/generic/402.out.bad 2016-12-28 16:43:54.825058119 +0800
@@ -1,2 +1,2 @@
QA output created by 402
-y2038 inode timestamp tests completed successfully
+2147483647;2147483647 != 2147483648;2147483648
seqres.full shows:
meta-data=/dev/mapper/systemvg-testlv2 isize=256 agcount=16, agsize=245696 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0, sparse=0, rmapbt=0
data = bsize=4096 blocks=3931136, imaxpct=25
= sunit=64 swidth=192 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=64 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
min supported timestamp -2147483648 Sat Dec 14 04:45:52 CST 1901
max supported timestamp 2147483647 Tue Jan 19 11:14:07 CST 2038
min timestamp that needs to be supported by fs for rw mount is 2147483647 Tue Jan 19 11:14:07 CST 2038
sysctl filesystem timestamp check is on
In memory timestamps update test start
Updating file: /mnt/testarea/scratch/test_1 to timestamp Sat Dec 14 04:45:52 CST 1901
Checking file: /mnt/testarea/scratch/test_1 Updated timestamp is Sat Dec 14 04:45:52 CST 1901
Updating file: /mnt/testarea/scratch/test_2 to timestamp Thu Jan 1 08:00:00 CST 1970
Checking file: /mnt/testarea/scratch/test_2 Updated timestamp is Thu Jan 1 08:00:00 CST 1970
Updating file: /mnt/testarea/scratch/test_3 to timestamp Tue Jan 19 11:14:07 CST 2038
Checking file: /mnt/testarea/scratch/test_3 Updated timestamp is Tue Jan 19 11:14:07 CST 2038
Updating file: /mnt/testarea/scratch/test_4 to timestamp Tue Jan 19 11:14:08 CST 2038
Checking file: /mnt/testarea/scratch/test_4 Updated timestamp is Tue Jan 19 11:14:07 CST 2038
2147483647;2147483647 != 2147483648;2147483648
>
> Changes since v1:
> * Use xfs_io utimes command
> * Updated error handling
> * Reorganized code according to review comments
>
> common/rc | 42 +++++++++++
> tests/generic/390 | 197 ++++++++++++++++++++++++++++++++++++++++++++++++++
> tests/generic/390.out | 2 +
> tests/generic/group | 1 +
> 4 files changed, 242 insertions(+)
> create mode 100755 tests/generic/390
> create mode 100644 tests/generic/390.out
>
> diff --git a/common/rc b/common/rc
> index e3b54ec..93c6e65 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -1960,6 +1960,45 @@ _run_aiodio()
> return $status
> }
>
> +# this test requires y2038 sysfs switch support
> +#
> +_require_y2038_sysfs()
> +{
> + sysfsdir=/proc/sys/fs/fs-timestamp-check-on
> +
> + if [ ! -e $sysfsdir ]; then
> + _notrun "no kernel support for y2038 sysfs switch"
> + fi
> +}
> +
> +_filesystem_timestamp_range()
> +{
> + device=${1:-$TEST_DEV}
> + case $FSTYP in
> + ext4)
> + if [ $(dumpe2fs -h $device 2>/dev/null | grep "Inode size:" | cut -d: -f2) -gt 128 ]; then
> + echo "-2147483648 15032385535"
> + else
> + echo "-2147483648 2147483647"
> + fi
> + ;;
> +
> + xfs)
> + echo "-2147483648 2147483647"
> + ;;
> + jfs)
> + echo "0 4294967295"
> + ;;
> + f2fs)
> + echo "-2147483648 2147483647"
> + ;;
> + *)
> + echo "-1 -1"
> + _notrun "filesystem $FSTYP timestamp bounds are unknown"
This "_notrun" doesn't belong here. I think we can introduce a
_require_y2038 rule. e.g.
_require_y2038()
{
local device=${1:-$TEST_DEV}
local sysfsdir=/proc/sys/fs/fs-timestamp-check-on
if [ ! -ne $sysfsdir ]; then
_notrun "no kernel support for y2038 sysfs switch"
fi
local tsmin tsmax
read tsmin tsmax <<<$(_filesystem_timestamp_range $device)
if [ $tsmin -eq -1 -a $tsmax -eq -1 ]; then
_notrun "filesystem $FSTYP timestamp bounds are unknown"
fi
}
Then
_scratch_mkfs
_require_y2038 $SCRATCH_DEV
> + ;;
> + esac
> +}
> +
> # indicate whether YP/NIS is active or not
> #
> _yp_active()
> @@ -2070,6 +2109,9 @@ _require_xfs_io_command()
> echo $testio | egrep -q "Inappropriate ioctl" && \
> _notrun "xfs_io $command support is missing"
> ;;
> + "utimes" )
> + testio=`$XFS_IO_PROG -f -c "utimes" 0 0 0 0 $testfile 2>&1`
> + ;;
> *)
> testio=`$XFS_IO_PROG -c "$command help" 2>&1`
> esac
> diff --git a/tests/generic/390 b/tests/generic/390
> new file mode 100755
> index 0000000..8ccadad
> --- /dev/null
> +++ b/tests/generic/390
> @@ -0,0 +1,197 @@
> +#! /bin/bash
> +# FS QA Test 390
> +#
> +# Tests to verify policy for filesystem timestamps for
> +# supported ranges:
> +# 1. Verify filesystem rw mount according to sysctl
> +# timestamp_supported.
> +# 2. Verify timestamp clamping for timestamps beyond max
> +# timestamp supported.
> +#
> +# Exit status 1: either or both tests above fail.
> +# Exit status 0: both the above tests pass.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2016 Deepa Dinamani. All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
> +#-----------------------------------------------------------------------
> +#
> +
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1 # failure is the default!
> +trap "exit \$status" 0 1 2 3 15
> +
> +# Get standard environment, filters and checks.
> +. ./common/rc
> +. ./common/filter
> +. ./common/attr
> +
> +# remove previous $seqres.full before test
> +rm -f $seqres.full
> +
> +# Prerequisites for the test run.
> +_supported_fs generic
> +_supported_os Linux
> +_require_scratch
> +_require_xfs_io_command utimes
> +_require_y2038_sysfs
> +
> +# Compare file timestamps obtained from stat
> +# with a given timestamp.
> +check_stat()
> +{
> + file=$1
> + timestamp=$2
> +
> + stat_timestamp=`stat -c"%X;%Y" $file`
> +
> + prev_timestamp="$timestamp;$timestamp"
> + if [ $prev_timestamp != $stat_timestamp ]; then
> + echo "$prev_timestamp != $stat_timestamp" | tee -a $seqres.full
> + exit
No need to exit here. We prefer continuing the test in fstests when such
test failure happens, it enlarges the test coverage and exercises some
error paths. One exception is that when continuing the test could result
in blocking all subsequent tests, we should exit early, one example
provided later.
> + fi
> +}
> +
> +run_test_individual()
> +{
> + file=$1
> + timestamp=$2
> + update_time=$3
> +
> + #check if the time needs update
> + if [ $update_time -eq 1 ]; then
> + echo "Updating file: $file to timestamp `date -d @$timestamp`" >> $seqres.full
> + $XFS_IO_PROG -f -c "utimes $timestamp 0 $timestamp 0" $file
> + if [ $? -ne 0 ]; then
> + echo "Failed to update times on $file" | tee -a $seqres.full
> + exit
Same here.
> + fi
> + fi
> +
> + tsclamp=$(($timestamp>$tsmax?$tsmax:$timestamp))
> + echo "Checking file: $file Updated timestamp is `date -d @$tsclamp`" >> $seqres.full
> + check_stat $file $tsclamp
> +}
> +
> +run_test()
> +{
> + update_time=$1
> +
> + #initialization iterator
> + n=1
> +
> + for TIME in "${TIMESTAMPS[@]}"
> + do
> + #Run the test
> + run_test_individual ${SCRATCH_MNT}/test_$n $TIME $update_time
> +
> + #update iterator
> + ((n++))
Seems the comments here are not necessary, initialize the iterator, run
the test and update iterator are all obvious.
And we prefer this code style in fstests:
for TIME in "${TIMESTAMPS[@]}"; do
...
done
> + done
> +}
> +
> +_scratch_mkfs &>> $seqres.full 2>&1 || _fail "mkfs failed"
Let test continue here on mkfs and mount failure, test harness will
capture these failures too, and running tests in these failure
conditions sometimes reveal interesting bugs :)
One example that we should exit on mkfs & mount failure is that we're
testing ENOSPC and going to fulfill the test filesystem, and we'll eat
all free space on root fs if we failed to mount the test device, and all
subsequent tests are blocked because of ENOSPC on root fs.
> +read tsmin tsmax <<<$(_filesystem_timestamp_range $SCRATCH_DEV)
> +
> +echo min supported timestamp $tsmin $(date --date=@$tsmin) >> $seqres.full
> +echo max supported timestamp $tsmax $(date --date=@$tsmax) >> $seqres.full
> +
> +#Test timestamps array
Please add a space after "#" in comments.
> +
> +declare -a TIMESTAMPS=(
> + $tsmin
> + 0
> + $tsmax
> + $((tsmax+1))
> + 4294967295
> + 8589934591
> + 34359738367
> +)
> +
> +# Max timestamp is hardcoded to Mon Jan 18 19:14:07 PST 2038
> +sys_tsmax=2147483647
> +echo "min timestamp that needs to be supported by fs for rw mount is $sys_tsmax $(date --date=@$sys_tsmax)" >> $seqres.full
Meant "max timestamp" here?
> +
> +read ts_check <<<$(cat /proc/sys/fs/fs-timestamp-check-on)
> +
> +_scratch_mount
> +result=$?
> +
> +if [ $ts_check -ne 0 ]; then
> + echo "sysctl filesystem timestamp check is on" >> $seqres.full
> + if [ $sys_tsmax -gt $tsmax ]; then
> + if [ $result -eq 0 ]; then
> + echo "mount test failed" | tee -a $seqres.full
> + exit
> + fi
> + else
> + if [ $result -ne 0 ]; then
> + echo "failed to mount $SCRATCH_DEV" | tee -a $seqres.full
> + exit
> + fi
> + fi
> +else
> + echo "sysctl filesystem timestamp check is off" >> $seqres.full
> + if [ $result -ne 0 ]; then
> + echo "failed to mount $SCRATCH_DEV and timestamp check is off" >> $seqres.full
> + exit
> + fi
> +fi
I think we need some comments on this code block to explain the logic
and expected behavior.
> +
> +# Begin test case 1
> +echo "In memory timestamps update test start" >> $seqres.full
> +
> +#update time on the file
> +update_time=1
> +
> +#Run test
> +run_test $update_time
> +
> +echo "In memory timestamps update complete" >> $seqres.full
> +
> +echo "Unmounting and mounting scratch $SCRATCH_MNT" >> $seqres.full
> +
> +#unmount and remount $SCRATCH_DEV
> +_scratch_cycle_mount
> +if [ $? -ne 0 ];then
> + echo "Failed to remount $SCRATCH_DEV" | tee -a $seqres.full
> + exit
> +fi
No need to exit. Further, no need to check _scratch_cycle_mount status.
Thanks,
Eryu
> +
> +# Begin test case 2
> +
> +#re-initialize iterator
> +n=1
> +
> +#Do not update time on the file, just read from disk
> +update_time=0
> +
> +echo "On disk timestamps update test start" >> $seqres.full
> +
> +#Re-run test
> +run_test $update_time
> +
> +echo "On disk timestamps update test complete" >> $seqres.full
> +
> +echo "y2038 inode timestamp tests completed successfully"
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/generic/390.out b/tests/generic/390.out
> new file mode 100644
> index 0000000..82bd4eb
> --- /dev/null
> +++ b/tests/generic/390.out
> @@ -0,0 +1,2 @@
> +QA output created by 390
> +y2038 inode timestamp tests completed successfully
> diff --git a/tests/generic/group b/tests/generic/group
> index 08007d7..d137d01 100644
> --- a/tests/generic/group
> +++ b/tests/generic/group
> @@ -392,3 +392,4 @@
> 387 auto clone
> 388 auto log metadata
> 389 auto quick acl
> +390 auto quick rw
> --
> 2.7.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH] btrfs/012: Enable test to be executed on non-4k block size filesystems
From: Chandan Rajendra @ 2016-12-26 17:32 UTC (permalink / raw)
To: fstests, linux-btrfs; +Cc: Chandan Rajendra, quwenruo
To get the test to work on non-4k block sized filesystems, this commit
obtains the block size of the Btrfs filesystem from $TEST_DIR.
Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
---
tests/btrfs/012 | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tests/btrfs/012 b/tests/btrfs/012
index b39dec0..cbd3882 100755
--- a/tests/btrfs/012
+++ b/tests/btrfs/012
@@ -63,8 +63,10 @@ _require_command "$E2FSCK_PROG" e2fsck
rm -f $seqres.full
+BLOCK_SIZE=`get_block_size $TEST_DIR`
+
# Create & populate an ext4 filesystem
-$MKFS_EXT4_PROG -F -b 4096 $SCRATCH_DEV > $seqres.full 2>&1 || \
+$MKFS_EXT4_PROG -F -b $BLOCK_SIZE $SCRATCH_DEV > $seqres.full 2>&1 || \
_notrun "Could not create ext4 filesystem"
# Manual mount so we don't use -t btrfs or selinux context
mount -t ext4 $SCRATCH_DEV $SCRATCH_MNT
--
2.5.5
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox