tiny fixes for xfstests
cover tiny fixes for xfstests
Hou Tao (5):
check: use _try_scratch_mount instead of _scratch_mount to mount
SCRATCH_DEV
generic/019: check scratch device is a block device or not generic/131: wait until the server is ready generic/466: explicitly request $SCRATCH_DEV to be a block device
fsx: check ENOSYS in test_copy_range()
check | 2 +- ltp/fsx.c | 2 +- tests/generic/019 | 1 + tests/generic/131 | 19 +++++++++++++------ tests/generic/466 | 1 + 5 files changed, 17 insertions(+), 8 deletions(-)
Signature · 1 line
2.16.2.dirty
PATCH 1/5 check: use _try_scratch_mount instead of _scratch_mount to mount SCRATCH_DEV
Else there won't be any error messages when mounting SCRATCH_DEV failed, because _scratch_mount exits early by invoking _fail.
--- check | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
check +1 -1
@@ -607,7 +607,7 @@ for section in $HOST_OPTIONS_SECTIONS; do # call the overridden mount - make sure the FS mounts with # the same options that we'll mount with later. - if ! _scratch_mount >$tmp.err 2>&1 + if ! _try_scratch_mount >$tmp.err 2>&1 then echo "our local mount routine ..." cat $tmp.err
Signature · 1 line
2.16.2.dirty
PATCH 2/5 generic/019: check scratch device is a block device or not
In reply to Hou TaoTo ensure "blockdev --getsz $SCRATCH_DEV" will succeed.
--- tests/generic/019 | 1 + 1 file changed, 1 insertion(+)
tests/generic/019 +1 -0
@@ -22,6 +22,7 @@ status=1 # failure is the default! _supported_fs generic _supported_os Linux _require_scratch +_require_block_device $SCRATCH_DEV _require_fail_make_request SYSFS_BDEV=`_sysfs_dev $SCRATCH_DEV`
Signature · 1 line
2.16.2.dirty
PATCH 3/5 generic/131: wait until the server is ready
In reply to Hou TaoWhen running xfstests under KVM VM and the load of host is high, only delaying 1s and checking the readiness of server are not enough, and the test case will fail early.
Fix it by repeatedly checking the readiness signal until it's found, or the server exits.
--- tests/generic/131 | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
tests/generic/131 +13 -6
@@ -37,13 +37,20 @@ TESTFILE=$TEST_DIR/lock_file src/locktest $TESTFILE 2>&1 > $TEST_DIR/server.out & locktest_pid1=$! -sleep 1 +while true; do + sleep 1 -PORT=$(cat $TEST_DIR/server.out | grep "^server port: " | awk '{print $3}') -if [ -z $PORT ]; then - echo "Could not get server port" - exit 1 -fi + PORT=$(cat $TEST_DIR/server.out | grep "^server port: " | awk '{print $3}') + if [ -n "$PORT" ]; then + break + fi + + # check the existence of server process + if ! kill -s 0 $locktest_pid1 >/dev/null 2>&1; then + echo "Could not get server port" + exit 1 + fi +done # Start the client src/locktest -p $PORT -h localhost $TESTFILE 2>&1 > $TEST_DIR/client.out
Signature · 1 line
2.16.2.dirty
Re: [PATCH 3/5] generic/131: wait until the server is ready
Quoted 17 lines · Hou Tao
When running xfstests under KVM VM and the load of host is high, only delaying 1s and checking the readiness of server are not enough, and the test case will fail early.
Fix it by repeatedly checking the readiness signal until it's found, or the server exits.
Signed-off-by Hou Tao <[email protected]>--- tests/generic/131 | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)tests/generic/131 +0
-0
tests/generic/131 TESTFILE=$TEST_DIR/lock_file · line 41
Quoted 6 lines
tests/generic/131 +2
-1@@ -37,13 +37,20 @@ TESTFILE=$TEST_DIR/lock_file src/locktest $TESTFILE 2>&1 > $TEST_DIR/server.out & locktest_pid1=$! -sleep 1 +while true; do + sleep 1
Looks like we'll loop forever if the locktest process is there but fails to print out the server port due to random reasons.
I think it's better to retry N times and give up if the server is still not ready.
Thanks,
Eryu
Quoted 23 lines
tests/generic/131 +11
-5-PORT=$(cat $TEST_DIR/server.out | grep "^server port: " | awk '{print $3}') -if [ -z $PORT ]; then - echo "Could not get server port" - exit 1 -fi + PORT=$(cat $TEST_DIR/server.out | grep "^server port: " | awk '{print $3}') + if [ -n "$PORT" ]; then + break + fi + + # check the existence of server process + if ! kill -s 0 $locktest_pid1 >/dev/null 2>&1; then + echo "Could not get server port" + exit 1 + fi +done # Start the client src/locktest -p $PORT -h localhost $TESTFILE 2>&1 > $TEST_DIR/client.outSignature · 1 line
2.16.2.dirty
Re: [PATCH 3/5] generic/131: wait until the server is ready
Hi,
Quoted 28 lines · Eryu Guan
Quoted 17 lines · Hou Tao
When running xfstests under KVM VM and the load of host is high, only delaying 1s and checking the readiness of server are not enough, and the test case will fail early.
Fix it by repeatedly checking the readiness signal until it's found, or the server exits.
Signed-off-by Hou Tao <[email protected]>--- tests/generic/131 | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)tests/generic/131 +0
-0tests/generic/131 TESTFILE=$TEST_DIR/lock_file · line 41
Quoted 6 lines
tests/generic/131 +2
-1@@ -37,13 +37,20 @@ TESTFILE=$TEST_DIR/lock_file src/locktest $TESTFILE 2>&1 > $TEST_DIR/server.out & locktest_pid1=$! -sleep 1 +while true; do + sleep 1Looks like we'll loop forever if the locktest process is there but fails to print out the server port due to random reasons.
Quoted 3 lines
I think it's better to retry N times and give up if the server is still not ready.
Thanks for your suggestion, will send v2 soon.
Quoted 28 lines
Thanks,
EryuQuoted 23 lines
tests/generic/131 +11
-5-PORT=$(cat $TEST_DIR/server.out | grep "^server port: " | awk '{print $3}') -if [ -z $PORT ]; then - echo "Could not get server port" - exit 1 -fi + PORT=$(cat $TEST_DIR/server.out | grep "^server port: " | awk '{print $3}') + if [ -n "$PORT" ]; then + break + fi + + # check the existence of server process + if ! kill -s 0 $locktest_pid1 >/dev/null 2>&1; then + echo "Could not get server port" + exit 1 + fi +done # Start the client src/locktest -p $PORT -h localhost $TESTFILE 2>&1 > $TEST_DIR/client.outSignature · 1 line
2.16.2.dirty
PATCH 4/5 generic/466: explicitly request $SCRATCH_DEV to be a block device
In reply to Hou Taoso "blockdev --getsize64 $SCRATCH_DEV" will succeed.
--- tests/generic/466 | 1 + 1 file changed, 1 insertion(+)
tests/generic/466 +1 -0
@@ -29,6 +29,7 @@ _cleanup() _supported_os Linux _supported_fs generic _require_scratch_nocheck +_require_block_device $SCRATCH_DEV rm -f $seqres.full
Signature · 1 line
2.16.2.dirty
PATCH 5/5 fsx: check ENOSYS in test_copy_range()
In reply to Hou TaoIn configure script, we only check whether or not the build of copy-range test program is successful, but that doesn't mean the kernel has implemented the syscall, so checking for this case.
--- ltp/fsx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ltp/fsx.c +1 -1
@@ -1583,7 +1583,7 @@ test_copy_range(void)loff_t o1 =0 , o2 =0 ;if (syscall (__NR_copy_file_range, fd, &o1, fd, &o2,0 ,0 ) ==-1 && - (errno ==EOPNOTSUPP || errno ==ENOTTY )) { + (errno ==ENOSYS || errno ==EOPNOTSUPP || errno ==ENOTTY )) {if (!quiet)fprintf (stderr, "main: filesystem does not support "
Signature · 1 line
2.16.2.dirty
Re: [PATCH 5/5] fsx: check ENOSYS in test_copy_range()
Quoted 15 lines · Hou Tao
In configure script, we only check whether or not the build of copy-range test program is successful, but that doesn't mean the kernel has implemented the syscall, so checking for this case.
Signed-off-by Hou Tao <[email protected]>--- ltp/fsx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)ltp/fsx.c +0
-0
ltp/fsx.c test_copy_range(void) · line 1586
Quoted 5 lines
ltp/fsx.c +1
-1@@ -1583,7 +1583,7 @@ test_copy_range(void)loff_t o1 =0 , o2 =0 ;if (syscall (__NR_copy_file_range, fd, &o1, fd, &o2,0 ,0 ) ==-1 && - (errno ==EOPNOTSUPP || errno ==ENOTTY )) { + (errno ==ENOSYS || errno ==EOPNOTSUPP || errno ==ENOTTY )) {
Should we also check for ENOSYS in other operations like {clone,dedupe}_range and fallocate?
Other fixes look good to me, thanks a lot for the fixes!
Thanks,
Eryu
Quoted 6 lines
ltp/fsx.c +0
-0if (!quiet)fprintf (stderr, "main: filesystem does not support "Signature · 1 line
2.16.2.dirty
Re: [PATCH 5/5] fsx: check ENOSYS in test_copy_range()
Quoted 18 lines · Eryu Guan
Quoted 17 lines · Hou Tao
In configure script, we only check whether or not the build of copy-range test program is successful, but that doesn't mean the kernel has implemented the syscall, so checking for this case.
Signed-off-by Hou Tao <[email protected]>--- ltp/fsx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)ltp/fsx.c +0
-0@@ -1583,7 +1583,7 @@ test_copy_range(void)loff_t o1 =0 , o2 =0 ;
Quoted 6 lines
ltp/fsx.c test_copy_range(void) · line 1586
Quoted 3 lines
ltp/fsx.c +1
-1if (syscall (__NR_copy_file_range, fd, &o1, fd, &o2,0 ,0 ) ==-1 && - (errno ==EOPNOTSUPP || errno ==ENOTTY )) { + (errno ==ENOSYS || errno ==EOPNOTSUPP || errno ==ENOTTY )) {Should we also check for ENOSYS in other operations like {clone,dedupe}_range
Unimplemented ioctls usually return EOPNOTSUPP or ENOTTY, not ENOSYS, so I don't think that's necessary.... unless there are kernels that don't implement the ioctl syscall?
In any case, the manpage for clone and dedupe don't say anything about returning ENOSYS.
Quoted 1 line
and fallocate?
Yes.
--D
Quoted 11 lines
Other fixes look good to me, thanks a lot for the fixes!
Thanks,
EryuQuoted 6 lines
ltp/fsx.c +0
-0if (!quiet)fprintf (stderr, "main: filesystem does not support "Signature · 1 line
2.16.2.dirty
Re: [PATCH 5/5] fsx: check ENOSYS in test_copy_range()
Hi,
Quoted 26 lines · Darrick J. Wong
Quoted 18 lines · Eryu Guan
Quoted 17 lines · Hou Tao
In configure script, we only check whether or not the build of copy-range test program is successful, but that doesn't mean the kernel has implemented the syscall, so checking for this case.
Signed-off-by Hou Tao <[email protected]>--- ltp/fsx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)ltp/fsx.c +0
-0@@ -1583,7 +1583,7 @@ test_copy_range(void)loff_t o1 =0 , o2 =0 ;Quoted 6 lines
ltp/fsx.c test_copy_range(void) · line 1586
Quoted 3 lines
ltp/fsx.c +1
-1if (syscall (__NR_copy_file_range, fd, &o1, fd, &o2,0 ,0 ) ==-1 && - (errno ==EOPNOTSUPP || errno ==ENOTTY )) { + (errno ==ENOSYS || errno ==EOPNOTSUPP || errno ==ENOTTY )) {Should we also check for ENOSYS in other operations like {clone,dedupe}_range
Quoted 9 lines
Unimplemented ioctls usually return EOPNOTSUPP or ENOTTY, not ENOSYS, so I don't think that's necessary.... unless there are kernels that don't implement the ioctl syscall?
In any case, the manpage for clone and dedupe don't say anything about returning ENOSYS.
Quoted 2 lines
and fallocate?
Yes.
I will send a v2 to also check test_fallocate(), and thanks for your review.
Quoted 16 lines
--D
Quoted 11 lines
Other fixes look good to me, thanks a lot for the fixes!
Thanks,
EryuQuoted 6 lines
ltp/fsx.c +0
-0if (!quiet)fprintf (stderr, "main: filesystem does not support "Signature · 1 line
2.16.2.dirty
Re: [PATCH 5/5] fsx: check ENOSYS in test_copy_range()
In reply to Hou TaoQuoted 6 lines · Hou Tao
In configure script, we only check whether or not the build of copy-range test program is successful, but that doesn't mean the kernel has implemented the syscall, so checking for this case.
Signed-off-by Hou Tao <[email protected]>
Err, oops. Thanks for catching that!
--D
Quoted 20 lines
--- ltp/fsx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)ltp/fsx.c +1
-1@@ -1583,7 +1583,7 @@ test_copy_range(void)loff_t o1 =0 , o2 =0 ;if (syscall (__NR_copy_file_range, fd, &o1, fd, &o2,0 ,0 ) ==-1 && - (errno ==EOPNOTSUPP || errno ==ENOTTY )) { + (errno ==ENOSYS || errno ==EOPNOTSUPP || errno ==ENOTTY )) {if (!quiet)fprintf (stderr, "main: filesystem does not support "Signature · 1 line
2.16.2.dirty