common/xfs: support realtime devices with _scratch_xfs_admin
authorDarrick J. Wong <djwong@kernel.org>
Wed, 31 Mar 2021 01:08:10 +0000 (18:08 -0700)
committerEryu Guan <guaneryu@gmail.com>
Sun, 11 Apr 2021 13:22:40 +0000 (21:22 +0800)
Teach _scratch_xfs_admin to support passing the realtime device to
xfs_admin so that we can actually test xfs_admin functionality with
those setups.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/xfs

index 88510cf..6e1e661 100644 (file)
@@ -269,9 +269,15 @@ _test_xfs_db()
 _scratch_xfs_admin()
 {
        local options=("$SCRATCH_DEV")
+       local rt_opts=()
        [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
                options+=("$SCRATCH_LOGDEV")
-       $XFS_ADMIN_PROG "$@" "${options[@]}"
+       if [ "$USE_EXTERNAL" = yes ] && [ -n "$SCRATCH_RTDEV" ]; then
+               $XFS_ADMIN_PROG --help 2>&1 | grep -q 'rtdev' || \
+                       _notrun 'xfs_admin does not support rt devices'
+               rt_opts+=(-r "$SCRATCH_RTDEV")
+       fi
+       $XFS_ADMIN_PROG "${rt_opts[@]}" "$@" "${options[@]}"
 }
 
 _scratch_xfs_logprint()