generic/508: fix to check inode creation time feature on scratch mountpoint
PATCH v2 1/1 generic/508: fix to check inode creation time feature on scratch mountpoint
_require_btime() just check inode creation time feature on TEST_DIR mountpoint, but generic/508 needs to do that check on SCRATCH_MNT mountpoint. Let's add _require_scratch_btime() for that, meanwhile moving the check behind scratch_mkfs/scratch_moun.
---
v2:
As Dave Chinner suggested:
- introduce _require_scratch_btime() to check inode creation time feature in scratch mountpoint, adjust generic/508 to use it.
- relocate the check behind scratch_mkfs/scratch_mount.
common/rc | 8 ++++++++ tests/generic/508 | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-)
common/rc +8 -0
@@ -3851,6 +3851,14 @@ _require_btime() rm -f $TEST_DIR/test_creation_time } +_require_scratch_btime() +{ + $XFS_IO_PROG -f $SCRATCH_MNT/test_creation_time -c "statx -v" \ + | grep btime >>$seqres.full 2>&1 || \ + _notrun "inode creation time not supported by this filesystem" + rm -f $SCRATCH_MNT/test_creation_time +} + init_rc ################################################################################
tests/generic/508 +1 -1
@@ -46,7 +46,6 @@ _supported_os Linux _require_test_lsattr _require_statx _require_xfs_io_command "statx" "-v" -_require_btime _require_scratch _require_scratch_shutdown
@@ -59,6 +58,7 @@ testfile=$SCRATCH_MNT/testfile do_check() { _scratch_mount + _require_scratch_btime touch $testfile
Signature · 1 line
2.18.0.rc1
Quoted 48 lines · Chao Yu
_require_btime()just check inode creation time feature onTEST_DIRmountpoint, but generic/508 needs to do that check onSCRATCH_MNTmountpoint. Let's add_require_scratch_btime()for that, meanwhile moving the check behind scratch_mkfs/scratch_moun.Signed-off-by Chao Yu <[email protected]>---
v2:
As Dave Chinner suggested:
- introduce_require_scratch_btime()to check inode creation time feature in scratch mountpoint, adjust generic/508 to use it.
- relocate the check behind scratch_mkfs/scratch_mount.common/rc | 8 ++++++++ tests/generic/508 | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-)common/rc +8
-0@@ -3851,6 +3851,14 @@ _require_btime() rm -f $TEST_DIR/test_creation_time } +_require_scratch_btime() +{ + $XFS_IO_PROG -f $SCRATCH_MNT/test_creation_time -c "statx -v" \ + | grep btime >>$seqres.full 2>&1 || \ + _notrun "inode creation time not supported by this filesystem" + rm -f $SCRATCH_MNT/test_creation_time +} + init_rc ################################################################################tests/generic/508 +0
-1@@ -46,7 +46,6 @@ _supported_os Linux _require_test_lsattr _require_statx _require_xfs_io_command "statx" "-v" -_require_btime _require_scratch _require_scratch_shutdown
tests/generic/508 testfile=$SCRATCH_MNT/testfile · line 61
Quoted 4 lines
tests/generic/508 +1
-0@@ -59,6 +58,7 @@ testfile=$SCRATCH_MNT/testfile do_check() { _scratch_mount + _require_scratch_btime
There is no need to check it every time the scratch device is mounted. Do the require checks up front befor the test starts after _scratch_mkfs has been run.
But, oh, what an inconsistent mess these scratch device require statements are. Some just check the scratch device. Some mkfs the scratch device, mount it and then run tests. Others require that the scratch device is already made and mounted. It doesn't look like there's any consistency here, so it's no wonder test writers are getting this stuff wrong....
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Quoted 46 lines · Dave Chinner
Quoted 45 lines · Chao Yu
_require_btime()just check inode creation time feature onTEST_DIRmountpoint, but generic/508 needs to do that check onSCRATCH_MNTmountpoint. Let's add_require_scratch_btime()for that, meanwhile moving the check behind scratch_mkfs/scratch_moun.Signed-off-by Chao Yu <[email protected]>---
v2:
As Dave Chinner suggested:
- introduce_require_scratch_btime()to check inode creation time feature in scratch mountpoint, adjust generic/508 to use it.
- relocate the check behind scratch_mkfs/scratch_mount.common/rc | 8 ++++++++ tests/generic/508 | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-)common/rc +8
-0@@ -3851,6 +3851,14 @@ _require_btime() rm -f $TEST_DIR/test_creation_time } +_require_scratch_btime() +{ + $XFS_IO_PROG -f $SCRATCH_MNT/test_creation_time -c "statx -v" \ + | grep btime >>$seqres.full 2>&1 || \ + _notrun "inode creation time not supported by this filesystem" + rm -f $SCRATCH_MNT/test_creation_time +} + init_rc ################################################################################tests/generic/508 +0
-1@@ -46,7 +46,6 @@ _supported_os Linux _require_test_lsattr _require_statx _require_xfs_io_command "statx" "-v" -_require_btime
Quoted 11 lines
tests/generic/508 testfile=$SCRATCH_MNT/testfile · line 61
Quoted 7 lines
tests/generic/508 +1
-0_require_scratch _require_scratch_shutdown@@ -59,6 +58,7 @@ testfile=$SCRATCH_MNT/testfile do_check() { _scratch_mount + _require_scratch_btimeThere is no need to check it every time the scratch device is mounted. Do the require checks up front befor the test starts after
_scratch_mkfshas been run.
Oh, sorry, actually, I should do this check with more clean way.
Taking other existing _require_* function which needs scratch device being mounted as an example, it may look more clean that adding mkfs/mount/umount into _require_scratch_btime instead of coupling codes with main flow. Like:
_require_scratch_btime()
{
_require_scratch
_scratch_mkfs > /dev/null 2>&1
_scratch_mount
$XFS_IO_PROG -f $SCRATCH_MNT/test_creation_time -c "statx -v" \
| grep btime >>$seqres.full 2>&1 || \
_notrun "inode creation time not supported by this filesystem"
rm -f $SCRATCH_MNT/test_creation_time
_scratch_unmount
}How do you think of this?
Thanks,
Quoted 12 lines
But, oh, what an inconsistent mess these scratch device require statements are. Some just check the scratch device. Some mkfs the scratch device, mount it and then run tests. Others require that the scratch device is already made and mounted. It doesn't look like there's any consistency here, so it's no wonder test writers are getting this stuff wrong....
Cheers,
Dave.