common/rc: Update _exclude_scratch_mount_option() and _require_dm_target() for new...
authorXiao Yang <yangx.jy@cn.fujitsu.com>
Mon, 10 Aug 2020 16:29:09 +0000 (00:29 +0800)
committerEryu Guan <guaneryu@gmail.com>
Sun, 16 Aug 2020 14:33:42 +0000 (22:33 +0800)
Some tests(e.g. ext4/035) cannot include dax option(dax=inode/dax=never
is OK) so make _exclude_scratch_mount_option() and _require_dm_target()
check if old dax or new dax=always option is not defined in $MOUNT_OPTIONS.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/rc

index 062eb6ba5cd17e0a03939012465bcef059259cd5..aa5a740944b73da8314a24f3e7bc0acb9edf7bf6 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -1896,7 +1896,7 @@ _require_dm_target()
        _require_sane_bdev_flush $SCRATCH_DEV
        _require_command "$DMSETUP_PROG" dmsetup
 
-       echo $MOUNT_OPTIONS | grep -q dax
+       _normalize_mount_options | egrep -q "dax(=always| |$)"
        if [ $? -eq 0 ]; then
                case $target in
                stripe|linear|log-writes)
@@ -3483,12 +3483,16 @@ _normalize_mount_options()
 }
 
 # skip test if MOUNT_OPTIONS contains the given strings
+# Both dax and dax=always are excluded if dax or dax=always is passed
 _exclude_scratch_mount_option()
 {
        local mnt_opts=$(_normalize_mount_options)
 
        while [ $# -gt 0 ]; do
-               if echo $mnt_opts | grep -qw "$1"; then
+               local pattern=$1
+               echo "$pattern" | egrep -q "dax(=always|$)" && \
+                       pattern="dax(=always| |$)"
+               if echo $mnt_opts | egrep -q "$pattern"; then
                        _notrun "mount option \"$1\" not allowed in this test"
                fi
                shift