generic/430: Fix filename in "copy beyond end" test
PATCH 1/2 generic/430: Fix filename in "copy beyond end" test
The cmp command was using the wrong file to perform the comparison. Use $testdir/beyond instead of $testdir/end.
--- tests/generic/430 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/generic/430 +1 -1
@@ -87,7 +87,7 @@ md5sum $testdir/{file,end} | _filter_test_dir echo "Copy beyond end of original file" $XFS_IO_PROG -f -c "copy_range -s 4000 -l 2000 $testdir/file" "$testdir/beyond" -cmp -n 1000 $testdir/file $testdir/end 4000 +cmp -n 1000 $testdir/file $testdir/beyond 4000 echo "md5sums after copying beyond:" md5sum $testdir/{file,beyond} | _filter_test_dir
PATCH 2/2 common/rc: handle xfs_io copy_range when copy_file_range syscall isn't available
_require_xfs_io_command() isn't handling the case where the copy_file_range syscall isn't available. Unfortunately, old versions of xfs_io don't handle it correctly either and the test will succeed with an empty file.
To fix this function, we need to add two checks:
1) for old xfs_io versions, fail if the test seems to succeed (no output) but the file created is empty,
2) for newer versions, use the error returned.
--- common/rc | 4 ++++ 1 file changed, 4 insertions(+)
common/rc +4 -0
@@ -2146,6 +2146,10 @@ _require_xfs_io_command() $XFS_IO_PROG -F -f -c "pwrite 0 4k" $testfile > /dev/null 2>&1 testio=`$XFS_IO_PROG -F -f -c "copy_range $testfile" $testcopy 2>&1` rm -f $testcopy > /dev/null 2>&1 + [ -z "$testio" -a ! -s "$testcopy" ] && \ + _notrun "xfs_io $command support is missing" + echo $testio | egrep -q "Function not implemented" && \ + _notrun "xfs_io $command support is missing" ;; "falloc" ) testio=`$XFS_IO_PROG -F -f -c "falloc $param 0 1m" $testfile 2>&1`
Re: [PATCH 2/2] common/rc: handle xfs_io copy_range when copy_file_range syscall isn't available
Quoted 3 lines · Luis Henriques
_require_xfs_io_command()isn't handling the case where thecopy_file_rangesyscall isn't available. Unfortunately, old versions ofxfs_iodon't handle it correctly either and the test will succeed with an empty file.
If copy_file_range syscall isn't available on the system, xfs_io should have no "copy_range" built either, or if you're using a pre-built xfs_io binary shipped by a distro, it should have no copy_range either to match the kernel space. Anyway, I don't think it would cause any problem if there's no copy_file_range syscall support. I'm curious what's your environment setup.
Quoted 17 lines
To fix this function, we need to add two checks:
1) for old
xfs_ioversions, fail if the test seems to succeed (no output) but the file created is empty,
2) for newer versions, use the error returned.Signed-off-by Luis Henriques <[email protected]>--- common/rc | 4 ++++ 1 file changed, 4 insertions(+)common/rc +0
-0
common/rc _require_xfs_io_command() · line 2148
Quoted 3 lines
common/rc +0
-0@@ -2146,6 +2146,10 @@ _require_xfs_io_command() $XFS_IO_PROG -F -f -c "pwrite 0 4k" $testfile > /dev/null 2>&1 testio=`$XFS_IO_PROG -F -f -c "copy_range $testfile" $testcopy 2>&1` rm -f $testcopy > /dev/null 2>&1
$testcopy is removed here...
common/rc _require_xfs_io_command() · line 2149
Quoted 1 line
common/rc +1
-0+ [ -z "$testio" -a ! -s "$testcopy" ] && \
then on hosts with copy_file_range support, this check always returns true, and test _notrun when it should run.
Thanks,
Eryu
Quoted 10 lines
common/rc +3
-1+ _notrun "xfs_io $command support is missing" + echo $testio | egrep -q "Function not implemented" && \ + _notrun "xfs_io $command support is missing" ;; "falloc" ) testio=`$XFS_IO_PROG -F -f -c "falloc $param 0 1m" $testfile 2>&1` --To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] common/rc: handle xfs_io copy_range when copy_file_range syscall isn't available
Quoted 11 lines · Eryu Guan
Quoted 3 lines · Luis Henriques
_require_xfs_io_command()isn't handling the case where thecopy_file_rangesyscall isn't available. Unfortunately, old versions ofxfs_iodon't handle it correctly either and the test will succeed with an empty file.If
copy_file_rangesyscall isn't available on the system,xfs_ioshould have no "copy_range" built either, or if you're using a pre-builtxfs_iobinary shipped by a distro, it should have nocopy_rangeeither to match the kernel space. Anyway, I don't think it would cause any problem if there's nocopy_file_rangesyscall support. I'm curious what's your environment setup.
I am building an initramfs that contains the testing tools from a recent distro, and running the tests against an old kernel (which does not include this syscall). I'm not sure how usual this sort of setup is.
Would you rather have the test ignoring these sort of setups, and just include the 2nd check (i.e., always assume the tools (xfs_io) are in sync with the kernel)?
Quoted 23 lines
Quoted 17 lines
To fix this function, we need to add two checks:
1) for old
xfs_ioversions, fail if the test seems to succeed (no output) but the file created is empty,
2) for newer versions, use the error returned.Signed-off-by Luis Henriques <[email protected]>--- common/rc | 4 ++++ 1 file changed, 4 insertions(+)common/rc +0
-0common/rc _require_xfs_io_command() · line 2148
Quoted 3 lines
common/rc +0
-0@@ -2146,6 +2146,10 @@ _require_xfs_io_command() $XFS_IO_PROG -F -f -c "pwrite 0 4k" $testfile > /dev/null 2>&1 testio=`$XFS_IO_PROG -F -f -c "copy_range $testfile" $testcopy 2>&1` rm -f $testcopy > /dev/null 2>&1$testcopy is removed here...
Quoted 4 lines
common/rc _require_xfs_io_command() · line 2149
Quoted 1 line
common/rc +1
-0+ [ -z "$testio" -a ! -s "$testcopy" ] && \then on hosts with
copy_file_rangesupport, this check always returns true, and test_notrunwhen it should run.
/me blushes and hides
I'll send v2 once you let me know if you want me to keep these 2 checks.
Cheers,
--
Luís
Quoted 15 lines
Thanks,
EryuQuoted 10 lines
common/rc +3
-1+ _notrun "xfs_io $command support is missing" + echo $testio | egrep -q "Function not implemented" && \ + _notrun "xfs_io $command support is missing" ;; "falloc" ) testio=`$XFS_IO_PROG -F -f -c "falloc $param 0 1m" $testfile 2>&1` --To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] common/rc: handle xfs_io copy_range when copy_file_range syscall isn't available
Quoted 13 lines · Luis Henriques
Quoted 11 lines · Eryu Guan
Quoted 3 lines · Luis Henriques
_require_xfs_io_command()isn't handling the case where thecopy_file_rangesyscall isn't available. Unfortunately, old versions ofxfs_iodon't handle it correctly either and the test will succeed with an empty file.If
copy_file_rangesyscall isn't available on the system,xfs_ioshould have no "copy_range" built either, or if you're using a pre-builtxfs_iobinary shipped by a distro, it should have nocopy_rangeeither to match the kernel space. Anyway, I don't think it would cause any problem if there's nocopy_file_rangesyscall support. I'm curious what's your environment setup.
Quoted 7 lines
I am building an initramfs that contains the testing tools from a recent distro, and running the tests against an old kernel (which does not include this syscall). I'm not sure how usual this sort of setup is.
Would you rather have the test ignoring these sort of setups, and just include the 2nd check (i.e., always assume the tools (
xfs_io) are in sync with the kernel)?
I'm fine with having this "Function not implemented" check, it'd be better to add more background information in the commit log. And perhaps we should do it after the case switch so it not only applies to copy_file_range syscall, but also to all other syscalls/commands.
But I don't think we should workaround a xfsprogs bug in test, it revealed a real bug and that's what should be really fixed, i.e. build the initramfs with a newer version of xfsprogs with that bug fixed?
Thanks,
Eryu
Quoted 52 lines
Quoted 24 lines
Quoted 18 lines
To fix this function, we need to add two checks:
1) for old
xfs_ioversions, fail if the test seems to succeed (no output) but the file created is empty,
2) for newer versions, use the error returned.Signed-off-by Luis Henriques <[email protected]>--- common/rc | 4 ++++ 1 file changed, 4 insertions(+)common/rc +0
-0common/rc _require_xfs_io_command() · line 2148
Quoted 3 lines
common/rc +0
-0@@ -2146,6 +2146,10 @@ _require_xfs_io_command() $XFS_IO_PROG -F -f -c "pwrite 0 4k" $testfile > /dev/null 2>&1 testio=`$XFS_IO_PROG -F -f -c "copy_range $testfile" $testcopy 2>&1` rm -f $testcopy > /dev/null 2>&1$testcopy is removed here...
Quoted 4 lines
common/rc _require_xfs_io_command() · line 2149
Quoted 1 line
common/rc +1
-0+ [ -z "$testio" -a ! -s "$testcopy" ] && \then on hosts with
copy_file_rangesupport, this check always returns true, and test_notrunwhen it should run./me blushes and hides
I'll send v2 once you let me know if you want me to keep these 2 checks.
Cheers,
--
LuísQuoted 15 lines
Thanks,
EryuQuoted 10 lines
common/rc +3
-1+ _notrun "xfs_io $command support is missing" + echo $testio | egrep -q "Function not implemented" && \ + _notrun "xfs_io $command support is missing" ;; "falloc" ) testio=`$XFS_IO_PROG -F -f -c "falloc $param 0 1m" $testfile 2>&1` --To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 2/2 common/rc: handle xfs_io copy_range when copy_file_range syscall isn't available
_require_xfs_io_command() isn't handling the case where the copy_file_range syscall isn't available. To fix this simply check the error returned by xfs_io.
---
Changes since v1:
- dropped check that worked around an xfs_io bug.
common/rc | 2 ++
1 file changed, 2 insertions(+)
common/rc +2 -0
@@ -2195,6 +2195,8 @@ _require_xfs_io_command() _notrun "xfs_io $command failed (old kernel/wrong fs/bad args?)" echo $testio | grep -q "foreign file active" && \ _notrun "xfs_io $command not supported on $FSTYP" + echo $testio | egrep -q "Function not implemented" && \ + _notrun "xfs_io $command support is missing (missing syscall?)" if [ -n "$param" -a $param_checked -eq 0 ]; then $XFS_IO_PROG -c "help $command" | grep -q "^ $param --" || \
Quoted 4 lines · Luis Henriques
The cmp command was using the wrong file to perform the comparison. Use $testdir/beyond instead of $testdir/end.
Signed-off-by Luis Henriques <[email protected]>
This looks correct to me.