aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolay Borisov <nborisov@suse.com>2021-11-01 15:56:58 +0200
committerEryu Guan <guaneryu@gmail.com>2021-11-07 20:54:26 +0800
commit955e0660288c50b4ce5eb9a80b4eb6b19b62d75a (patch)
treed6e45c00cf38a0b768b7fda832f5610008869af4
parentf67dd9d11c536a910e2ea2490048dc1cd37536ff (diff)
downloadxfstests-dev-955e0660288c50b4ce5eb9a80b4eb6b19b62d75a.tar.gz
common/rc: Fix check for SCRATCH_DEV_POOL presence in _scratch_dev_pool_get
Current check is buggy because it can never trigger as even if SCRATCH_DEV_POOL is not defined config_ndevs will get a value of 0 from 'wc -w', this in turn makes 'typeset -p config_ndevs' always return 0, triggering the existing check a noop. Fix this by explicitly checking for the presence of SCHRATC_DEV_POOL Signed-off-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
-rw-r--r--common/rc10
1 files changed, 5 insertions, 5 deletions
diff --git a/common/rc b/common/rc
index 751974539e..0d261184c1 100644
--- a/common/rc
+++ b/common/rc
@@ -917,15 +917,15 @@ _scratch_dev_pool_get()
_fail "Usage: _scratch_dev_pool_get ndevs"
fi
- local test_ndevs=$1
- local config_ndevs=`echo $SCRATCH_DEV_POOL| wc -w`
- local -a devs="( $SCRATCH_DEV_POOL )"
-
- typeset -p config_ndevs >/dev/null 2>&1
+ typeset -p SCRATCH_DEV_POOL >/dev/null 2>&1
if [ $? -ne 0 ]; then
_fail "Bug: cant find SCRATCH_DEV_POOL ndevs"
fi
+ local test_ndevs=$1
+ local config_ndevs=`echo $SCRATCH_DEV_POOL| wc -w`
+ local -a devs="( $SCRATCH_DEV_POOL )"
+
if [ $config_ndevs -lt $test_ndevs ]; then
_notrun "Need at least test requested number of ndevs $test_ndevs"
fi