From b2fdc58725be7c28242bc446887a85d55218f092 Mon Sep 17 00:00:00 2001 From: Shin'ichiro Kawasaki Date: Wed, 8 Sep 2021 17:37:14 +0900 Subject: [PATCH] btrfs/146: require scratch dev and pool before _require_dm_target The test case btrfs/146 calls _require_dm_target which depends on SCRATCH_DEV. The test case assumes that valid devices are set in SCRATCH_DEV_POOL, and one of the devices is propagated to SCRATCH_DEV. However, when SCRATCH_DEV_POOL is not set, valid value is not propagated to SCRATCH_DEV and _require_dm_target causes unexpected test case failure. To avoid the failure, move _require_scratch and _require_scratch_dev_pool calls before _require_dm_target call to detect invalid SCRATCH_DEV_POOL beforehand. Signed-off-by: Shin'ichiro Kawasaki Signed-off-by: Eryu Guan --- tests/btrfs/146 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/btrfs/146 b/tests/btrfs/146 index 64c3513f..e3b75dc0 100755 --- a/tests/btrfs/146 +++ b/tests/btrfs/146 @@ -26,6 +26,8 @@ _cleanup() # real QA test starts here _supported_fs btrfs +_require_scratch +_require_scratch_dev_pool _require_dm_target error _require_test_program fsync-err _require_test_program dmerror @@ -38,9 +40,6 @@ old_SCRATCH_DEV=$SCRATCH_DEV SCRATCH_DEV_POOL=`echo $SCRATCH_DEV_POOL | perl -pe "s#$SCRATCH_DEV#$DMERROR_DEV#"` SCRATCH_DEV=$DMERROR_DEV -_require_scratch -_require_scratch_dev_pool - echo "Format and mount" # Build a filesystem with 2 devices that stripes the data across -- 2.39.5