overlay: run unionmount tests with custom overlay mount options
authorAmir Goldstein <amir73il@gmail.com>
Sat, 19 Dec 2020 10:47:27 +0000 (12:47 +0200)
committerEryu Guan <guaneryu@gmail.com>
Sun, 20 Dec 2020 16:18:43 +0000 (00:18 +0800)
Assign $OVERLAY_MOUNT_OPTIONS to UNIONMOUNT_MNTOPTIONS and require
that unionmount supports UNIONMOUNT_MNTOPTIONS if OVERLAY_MOUNT_OPTIONS
was provided.

For example, when the mount option metacopy=on is set in
$OVERLAY_MOUNT_OPTIONS, it enables the --meta test option and affects
the test verifications after copy up.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/overlay

index 5e6a7e0f6adad5f3cde15e3a4edd3e4387dc8edf..1ca37e291183bbb467b261631863104d72a8faaf 100644 (file)
@@ -376,6 +376,13 @@ _require_unionmount_testsuite()
        local usage=`UNIONMOUNT_BASEDIR=_ "$UNIONMOUNT_TESTSUITE/run" 2>&1`
        echo $usage | grep -wq "UNIONMOUNT_BASEDIR" || \
                _notrun "newer version of unionmount testsuite required."
+
+       [ -n "$OVERLAY_MOUNT_OPTIONS" ] || return
+       # If custom overlay mount options are used
+       # verify that UNIONMOUNT_MNTOPTIONS var is supported
+       local usage=`UNIONMOUNT_MNTOPTIONS=_ "$UNIONMOUNT_TESTSUITE/run" 2>&1`
+       echo $usage | grep -wq "UNIONMOUNT_MNTOPTIONS" || \
+               _notrun "newer version of unionmount testsuite required to support OVERLAY_MOUNT_OPTIONS."
 }
 
 _unionmount_testsuite_run()
@@ -394,6 +401,7 @@ _unionmount_testsuite_run()
                export UNIONMOUNT_LOWERDIR=$OVL_BASE_TEST_DIR/union
        fi
        export UNIONMOUNT_BASEDIR=$OVL_BASE_SCRATCH_MNT/union
+       export UNIONMOUNT_MNTOPTIONS="$OVERLAY_MOUNT_OPTIONS"
 
        _scratch_mkfs
        rm -rf $UNIONMOUNT_BASEDIR $UNIONMOUNT_LOWERDIR