common/rc, ceph: skip ceph/001-ceph/003 if test_dummy_encryption is enabled
PATCH v2 1/1 common/rc, ceph: skip ceph/001-ceph/003 if test_dummy_encryption is enabled
Some tests on ceph require changing the layout of new files, which is forbidden when the files are encrypted. Skip these tests if the test_dummy_encryption mount option is being used.
Generalize the _exclude_scratch_mount_option code and add a new _exclude_test_mount_option call as well. Call the new function from the ceph tests that should exclude test_dummy_encryption.
--- common/btrfs | 2 +- common/rc | 28 +++++++++++++++++++--------- tests/ceph/001 | 1 + tests/ceph/002 | 1 + tests/ceph/003 | 1 + 5 files changed, 23 insertions(+), 10 deletions(-)
Thanks to Eric and Luis for review so far!
v2: fix argument handling in _exclude_mount_option
fix _require_btrfs_no_compress
ensure _normalize_mount_options callers pass correct argument
common/btrfs +1 -1
@@ -115,7 +115,7 @@ _require_btrfs_fs_sysfs() _require_btrfs_no_compress() { - if _normalize_mount_options | grep -q "compress"; then + if _normalize_mount_options "$MOUNT_OPTIONS" | grep -q "compress"; then _notrun "This test requires no compression enabled" fi }
common/rc +19 -9
@@ -2039,7 +2039,7 @@ _require_sane_bdev_flush() # Returns 0 if DAX will be used, 1 if DAX is not going to be used. __scratch_uses_fsdax() { - local ops=$(_normalize_mount_options) + local ops=$(_normalize_mount_options "$MOUNT_OPTIONS") echo $ops | egrep -qw "dax(=always| |$)" && return 0 echo $ops | grep -qw "dax=never" && return 1
@@ -3718,7 +3718,7 @@ _has_metadata_journaling() return 1 } # ext4 might not load a journal - if _normalize_mount_options | grep -qw "noload"; then + if _normalize_mount_options "$MOUNT_OPTIONS" | grep -qw "noload"; then echo "mount option \"noload\" not allowed in this test" return 1 fi
@@ -3882,20 +3882,20 @@ _require_cloner() _notrun "cloner binary not present at $CLONER_PROG" } -# Normalize mount options from global $MOUNT_OPTIONS -# Convert options like "-o opt1,opt2 -oopt3" to -# "opt1 opt2 opt3" +# Normalize mount options from the option string in $1 +# Convert options like "-o opt1,opt2 -oopt3" to "opt1 opt2 opt3" _normalize_mount_options() { - echo $MOUNT_OPTIONS | sed -n 's/-o\s*\(\S*\)/\1/gp'| sed 's/,/ /g' + echo "$1" | sed -n 's/-o\s*\(\S*\)/\1/gp'| sed 's/,/ /g' } -# skip test if MOUNT_OPTIONS contains the given strings +# skip test if $1 contains the given strings in trailing arguments # Both dax and dax=always are excluded if dax or dax=always is passed -_exclude_scratch_mount_option() +_exclude_mount_option() { - local mnt_opts=$(_normalize_mount_options) + local mnt_opts=$(_normalize_mount_options "$1") + shift while [ $# -gt 0 ]; do local pattern=$1 echo "$pattern" | egrep -q "dax(=always|$)" && \
@@ -3907,6 +3907,16 @@ _exclude_scratch_mount_option() done } +_exclude_scratch_mount_option() +{ + _exclude_mount_option "$MOUNT_OPTIONS" $@ +} + +_exclude_test_mount_option() +{ + _exclude_mount_option "$TEST_FS_MOUNT_OPTS" $@ +} + _require_atime() { _exclude_scratch_mount_option "noatime"
tests/ceph/001 +1 -0
@@ -22,6 +22,7 @@ _begin_fstest auto quick copy_range _supported_fs ceph _require_xfs_io_command "copy_range" +_exclude_test_mount_option "test_dummy_encryption" _require_attrs _require_test
tests/ceph/002 +1 -0
@@ -30,6 +30,7 @@ _begin_fstest auto quick copy_range _supported_fs ceph _require_xfs_io_command "copy_range" +_exclude_test_mount_option "test_dummy_encryption" _require_attrs _require_test
tests/ceph/003 +1 -0
@@ -18,6 +18,7 @@ _begin_fstest auto quick copy_range _supported_fs ceph _require_xfs_io_command "copy_range" +_exclude_test_mount_option "test_dummy_encryption" _require_attrs _require_test
Signature · 1 line
2.33.1
Quoted 11 lines · Jeff Layton
Some tests on ceph require changing the layout of new files, which is forbidden when the files are encrypted. Skip these tests if the
test_dummy_encryptionmount option is being used.Generalize the
_exclude_scratch_mount_optioncode and add a new_exclude_test_mount_optioncall as well. Call the new function from the ceph tests that should excludetest_dummy_encryption.Cc Luis Henriques <[email protected]>Cc Eric Biggers <[email protected]>Signed-off-by Jeff Layton <[email protected]>
Quoted 7 lines
--- common/btrfs | 2 +- common/rc | 28 +++++++++++++++++++--------- tests/ceph/001 | 1 + tests/ceph/002 | 1 + tests/ceph/003 | 1 + 5 files changed, 23 insertions(+), 10 deletions(-)
- Eric
Quoted 11 lines · Jeff Layton
Some tests on ceph require changing the layout of new files, which is forbidden when the files are encrypted. Skip these tests if the
test_dummy_encryptionmount option is being used.Generalize the
_exclude_scratch_mount_optioncode and add a new_exclude_test_mount_optioncall as well. Call the new function from the ceph tests that should excludetest_dummy_encryption.Cc Luis Henriques <[email protected]>Cc Eric Biggers <[email protected]>Signed-off-by Jeff Layton <[email protected]>
Looks good to me! Feel free to add my
Cheers,
--
Luís
Quoted 133 lines
--- common/btrfs | 2 +- common/rc | 28 +++++++++++++++++++--------- tests/ceph/001 | 1 + tests/ceph/002 | 1 + tests/ceph/003 | 1 + 5 files changed, 23 insertions(+), 10 deletions(-)Thanks to Eric and Luis for review so far!
v2: fix argument handling in
_exclude_mount_option
fix_require_btrfs_no_compress
ensure_normalize_mount_optionscallers pass correct argumentcommon/btrfs +1
-1@@ -115,7 +115,7 @@ _require_btrfs_fs_sysfs() _require_btrfs_no_compress() { - if _normalize_mount_options | grep -q "compress"; then + if _normalize_mount_options "$MOUNT_OPTIONS" | grep -q "compress"; then _notrun "This test requires no compression enabled" fi }common/rc +19
-9@@ -2039,7 +2039,7 @@ _require_sane_bdev_flush() # Returns 0 if DAX will be used, 1 if DAX is not going to be used. __scratch_uses_fsdax() { - local ops=$(_normalize_mount_options) + local ops=$(_normalize_mount_options "$MOUNT_OPTIONS") echo $ops | egrep -qw "dax(=always| |$)" && return 0 echo $ops | grep -qw "dax=never" && return 1@@ -3718,7 +3718,7 @@ _has_metadata_journaling() return 1 } # ext4 might not load a journal - if _normalize_mount_options | grep -qw "noload"; then + if _normalize_mount_options "$MOUNT_OPTIONS" | grep -qw "noload"; then echo "mount option \"noload\" not allowed in this test" return 1 fi@@ -3882,20 +3882,20 @@ _require_cloner() _notrun "cloner binary not present at $CLONER_PROG" } -# Normalize mount options from global $MOUNT_OPTIONS -# Convert options like "-o opt1,opt2 -oopt3" to -# "opt1 opt2 opt3" +# Normalize mount options from the option string in $1 +# Convert options like "-o opt1,opt2 -oopt3" to "opt1 opt2 opt3" _normalize_mount_options() { - echo $MOUNT_OPTIONS | sed -n 's/-o\s*\(\S*\)/\1/gp'| sed 's/,/ /g' + echo "$1" | sed -n 's/-o\s*\(\S*\)/\1/gp'| sed 's/,/ /g' } -# skip test if MOUNT_OPTIONS contains the given strings +# skip test if $1 contains the given strings in trailing arguments # Both dax and dax=always are excluded if dax or dax=always is passed -_exclude_scratch_mount_option() +_exclude_mount_option() { - local mnt_opts=$(_normalize_mount_options) + local mnt_opts=$(_normalize_mount_options "$1") + shift while [ $# -gt 0 ]; do local pattern=$1 echo "$pattern" | egrep -q "dax(=always|$)" && \@@ -3907,6 +3907,16 @@ _exclude_scratch_mount_option() done } +_exclude_scratch_mount_option() +{ + _exclude_mount_option "$MOUNT_OPTIONS" $@ +} + +_exclude_test_mount_option() +{ + _exclude_mount_option "$TEST_FS_MOUNT_OPTS" $@ +} + _require_atime() { _exclude_scratch_mount_option "noatime"tests/ceph/001 +1
-0@@ -22,6 +22,7 @@ _begin_fstest auto quick copy_range _supported_fs ceph _require_xfs_io_command "copy_range" +_exclude_test_mount_option "test_dummy_encryption" _require_attrs _require_testtests/ceph/002 +1
-0@@ -30,6 +30,7 @@ _begin_fstest auto quick copy_range _supported_fs ceph _require_xfs_io_command "copy_range" +_exclude_test_mount_option "test_dummy_encryption" _require_attrs _require_testtests/ceph/003 +1
-0@@ -18,6 +18,7 @@ _begin_fstest auto quick copy_range _supported_fs ceph _require_xfs_io_command "copy_range" +_exclude_test_mount_option "test_dummy_encryption" _require_attrs _require_testSignature · 1 line
2.33.1