diff mbox series

[11/28] check-parallel: initial support for specifying device sizes

Message ID 20250417031208.1852171-12-david@fromorbit.com (mailing list archive)
State New
Headers show
Series check-parallel: Running tests without check | expand

Commit Message

Dave Chinner April 17, 2025, 3 a.m. UTC
From: Dave Chinner <dchinner@redhat.com>

Rather than hard coding loop device sizes, abstract them out into
environment variables with defined default values. This allows
a check-parallel wrapper to specify sizes or, in future, for them
to be read from a config file. Sizes are specified in human readable
values using M/G/T suffixes to indicate the units being specified

Whilst doing this also add support for creating all the external
devices that XFS uses during fstests execution. A typical setup
will be something like:

TEST_DEV_SIZE=10G
TEST_RTDEV_SIZE=10G
TEST_LOGDEV_SIZE=128M
SCRATCH_DEV_SIZE=20G
SCRATCH_RTDEV_SIZE=20G
SCRATCH_LOGDEV_SIZE=512M
LOGWRITES_DEV_SIZE=2G

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 check-parallel | 35 ++++++++++++++++++++++++++++++-----
 1 file changed, 30 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/check-parallel b/check-parallel
index aa88c681e..5bb44b6a5 100755
--- a/check-parallel
+++ b/check-parallel
@@ -18,6 +18,14 @@  run_section=""
 
 tmp=/tmp/check-parallel.$$
 
+TEST_DEV_SIZE=${TEST_DEV_SIZE:=10G}
+TEST_RTDEV_SIZE=${TEST_RTDEV_SIZE:=10G}
+TEST_LOGDEV_SIZE=${TEST_LOGDEV_SIZE:=128M}
+SCRATCH_DEV_SIZE=${SCRATCH_DEV_SIZE:=20G}
+SCRATCH_RTDEV_SIZE=${SCRATCH_RTDEV_SIZE:=20G}
+SCRATCH_LOGDEV_SIZE=${SCRATCH_LOGDEV_SIZE:=512M}
+LOGWRITES_DEV_SIZE=${LOGWRITES_DEV_SIZE:=2G}
+
 FSTYP=
 
 . ./common/exit
@@ -116,7 +124,7 @@  while [ $# -gt 0 ]; do
 	--exact-order) _tl_setup_ordered ;;
 	-n)	show_test_list="yes" ;;
 
-	-f)	is_supported_fstype $2 ; FSTYP=$2; shift ;;
+	-f)	is_supported_fstype $2 ; export FSTYP=$2; shift ;;
 
 	-s)	run_section="$run_section -s $2"; shift ;;
 
@@ -243,22 +251,35 @@  runner_go()
 	local id=$1
 	local me=$basedir/runner-$id
 	local _test=$me/test.img
+	local _test_rt=$me/test-rt.img
+	local _test_log=$me/test-log.img
 	local _scratch=$me/scratch.img
+	local _scratch_rt=$me/scratch-rt.img
+	local _scratch_log=$me/scratch-log.img
 	local _logwrites=$me/logwrites.img
 	local _results=$me/results-$2
 
 	mkdir -p $me
 
-	xfs_io -f -c 'truncate 2g' $_test
-	xfs_io -f -c 'truncate 8g' $_scratch
-	xfs_io -f -c 'truncate 1g' $_logwrites
+	xfs_io -f -c "truncate $TEST_DEV_SIZE" $_test
+	xfs_io -f -c "truncate $TEST_RTDEV_SIZE" $_test_rt
+	xfs_io -f -c "truncate $TEST_LOGDEV_SIZE" $_test_log
+	xfs_io -f -c "truncate $SCRATCH_DEV_SIZE" $_scratch
+	xfs_io -f -c "truncate $SCRATCH_RTDEV_SIZE" $_scratch_rt
+	xfs_io -f -c "truncate $SCRATCH_LOGDEV_SIZE" $_scratch_log
+	xfs_io -f -c "truncate $LOGWRITES_DEV_SIZE" $_logwrites
 
 	export TEST_DEV=$(_create_loop_device $_test)
+	export TEST_RTDEV=$(_create_loop_device $_test_rt)
+	export TEST_LOGDEV=$(_create_loop_device $_test_log)
 	export TEST_DIR=$me/test
+
 	export SCRATCH_DEV=$(_create_loop_device $_scratch)
+	export SCRATCH_RTDEV=$(_create_loop_device $_scratch_rt)
+	export SCRATCH_LOGDEV=$(_create_loop_device $_scratch_log)
 	export SCRATCH_MNT=$me/scratch
+
 	export LOGWRITES_DEV=$(_create_loop_device $_logwrites)
-	export FSTYP=xfs
 	export RESULT_BASE=$_results
 
 	mkdir -p $TEST_DIR
@@ -285,7 +306,11 @@  runner_go()
 	umount -R $TEST_DIR 2> /dev/null
 	umount -R $SCRATCH_MNT 2> /dev/null
 	_destroy_loop_device $TEST_DEV
+	_destroy_loop_device $TEST_RTDEV
+	_destroy_loop_device $TEST_LOGDEV
 	_destroy_loop_device $SCRATCH_DEV
+	_destroy_loop_device $SCRATCH_RTDEV
+	_destroy_loop_device $SCRATCH_LOGDEV
 	_destroy_loop_device $LOGWRITES_DEV
 
 	grep -q Failures: $me/log