All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: fstests@vger.kernel.org
Cc: zlang@kernel.org
Subject: [PATCH 16/28] check-parallel: run sections directly
Date: Thu, 17 Apr 2025 13:00:57 +1000	[thread overview]
Message-ID: <20250417031208.1852171-17-david@fromorbit.com> (raw)
In-Reply-To: <20250417031208.1852171-1-david@fromorbit.com>

From: Dave Chinner <dchinner@redhat.com>

Currently we pass the section through to check for it to apply and
run. However, we do not reconfigure the test or external devices in
check-parallel after the initial setup, so thie results in devices
that may be incorrectly configured for the given section config we
want to run.

To fix this, we need to iterate the sections directly in
check-parallel and reconfigure the runner device setup between each
section that is run. This allows the test device and external
devices to be set up correctly for each section config.

As the test list is consumed as we walk it, we need to reset the
test list for each section that we run.

We still pass the config section through to check so that it can
also source the correct config from the section we are running.

We also add section exclusion support so that we skip sections the
same way that check currently does.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 check-parallel         | 118 ++++++++++++++++++++++++++++-------------
 common/config-sections |   3 ++
 2 files changed, 84 insertions(+), 37 deletions(-)

diff --git a/check-parallel b/check-parallel
index e2cf2c8d0..23d29c7a8 100755
--- a/check-parallel
+++ b/check-parallel
@@ -15,6 +15,7 @@ runner_list=()
 runtimes=()
 show_test_list=
 run_section=""
+exclude_section=""
 iam="check-parallel"
 
 tmp=/tmp/check-parallel.$$
@@ -119,7 +120,8 @@ while [ $# -gt 0 ]; do
 
 	-f)	is_supported_fstype $2 ; export FSTYP=$2; shift ;;
 
-	-s)	run_section="$run_section -s $2"; shift ;;
+	-s)	run_section="$run_section $2"; shift ;;
+	-S)	exclude_section="$exclude_section $2"; shift ;;
 
 	-*)	usage ;;
 	*)	# not an argument, we've got tests now.
@@ -202,11 +204,12 @@ fi
 # each other.
 get_next_test()
 {
+	local test_file="$test_list.$1"
 	local test=
 
 	flock 99
-	test=$(tail -1 $test_list)
-	sed -i "\,$test,d" $test_list
+	test=$(tail -1 $test_file)
+	sed -i "\,$test,d" $test_file
 	flock -u 99
 	echo $test
 }
@@ -236,10 +239,34 @@ _destroy_loop_device()
         losetup -d $dev || _fail "Cannot destroy loop device $dev"
 }
 
-runner_go()
+run_tests()
 {
+	local section="$1"
+
 	exec 99<>$tmp.test_list_lock
 
+	local test_to_run=$(get_next_test $section)
+
+	# Run the tests in it's own mount namespace, as per the comment below
+	# that precedes making the basedir a private mount.
+	#
+	# Similarly, we need to run check in it's own PID namespace so that
+	# operations like pkill only affect the runner instance, not globally
+	# kill processes from other check instances.
+	while [ -n "$test_to_run" ]; do
+		echo -n " $test_to_run "
+		unset FSTESTS_ISOL
+		if ! _tl_expunge_test $test_to_run; then
+			tools/run_privatens ./check -s $section $test_to_run >> $me/log 2>&1
+		fi
+
+		test_to_run=$(get_next_test $section)
+	done
+}
+
+runner_go()
+{
+
 	local id=$1
 	local me=$basedir/runner-$id
 	local _test=$me/test.img
@@ -250,7 +277,7 @@ runner_go()
 	local _scratch_log=$me/scratch-log.img
 	local _logwrites=$me/logwrites.img
 	local _results=$me/results-$2
-	local test_to_run=$(get_next_test)
+	local section=$3
 
 	mkdir -p $me
 
@@ -286,21 +313,7 @@ runner_go()
 
 #	export DUMP_CORRUPT_FS=1
 
-	# Run the tests in it's own mount namespace, as per the comment below
-	# that precedes making the basedir a private mount.
-	#
-	# Similarly, we need to run check in it's own PID namespace so that
-	# operations like pkill only affect the runner instance, not globally
-	# kill processes from other check instances.
-	while [ -n "$test_to_run" ]; do
-		echo "Runner $id: running test $test_to_run"
-		unset FSTESTS_ISOL
-		if ! _tl_expunge_test $test_to_run; then
-			tools/run_privatens ./check $run_section $test_to_run >> $me/log 2>&1
-		fi
-
-		test_to_run=$(get_next_test)
-	done
+	run_tests $section
 
 	wait
 	sleep 1
@@ -322,6 +335,44 @@ runner_go()
 
 }
 
+run_section()
+{
+	local section="$1"
+	local now="$2"
+	local i
+
+	echo $run_section |grep -qw $section || return
+	echo $exclude_section |grep -qw $section && return
+
+	echo
+	echo Running section: $section
+	echo
+
+	parse_config_section $section
+
+	# set up consumable test list first
+	cp $test_list $test_list.$section
+	for ((i = 0; i < $runners; i++)); do
+		runner_go $i $now $section &
+	done
+	wait
+
+	echo
+	echo Section: $section
+	echo -n "Tests run: "
+	grep Ran $basedir/*/log | sed -e 's,^.*:,,' -e 's, ,\n,g' | sort | uniq | wc -l
+
+	echo -n "Tests _notrun: "
+	grep "^Not run" $basedir/*/log | uniq | sed -e 's,^.*:,,' -e 's, ,\n,g' -e 's,^\n,,' | wc -l
+
+	echo -n "Failure count: "
+	grep Failures: $basedir/*/log | uniq | sed -e "s/^.*Failures://" -e "s,\([0-9]\) \([gx]\),\1\n \2,g" |wc -l
+	echo
+
+	echo Ten slowest tests - runtime in seconds:
+	cat $basedir/*/results-$now/check.time | sort -k 2 -nr | head -10
+}
+
 cleanup()
 {
 	killall -INT -q check
@@ -336,6 +387,8 @@ trap "cleanup; exit" HUP INT QUIT TERM
 
 _config_setup_parallel
 
+run_section=${run_section:="$HOST_OPTIONS_SECTIONS"}
+
 _tl_setup_exclude_group "unreliable_in_parallel"
 _tl_prepare_test_list
 _tl_strip_test_list
@@ -369,23 +422,14 @@ fi
 mount --make-private $basedir
 
 now=`date +%Y-%m-%d-%H:%M:%S`
-for ((i = 0; i < $runners; i++)); do
-	runner_go $i $now &
-done;
-wait
-
-echo -n "Tests run: "
-grep Ran $basedir/*/log | sed -e 's,^.*:,,' -e 's, ,\n,g' | sort | uniq | wc -l
-
-echo -n "Tests _notrun: "
-grep "^Not run" $basedir/*/log | uniq | sed -e 's,^.*:,,' -e 's, ,\n,g' -e 's,^\n,,' | wc -l
-
-echo -n "Failure count: "
-grep Failures: $basedir/*/log | uniq | sed -e "s/^.*Failures://" -e "s,\([0-9]\) \([gx]\),\1\n \2,g" |wc -l
-echo
-
-echo Ten slowest tests - runtime in seconds:
-cat $basedir/*/results-$now/check.time | sort -k 2 -nr | head -10
+for section in $HOST_OPTIONS_SECTIONS; do
+	run_section $section $now
+	if [ "$sum_bad" != 0 ] && [ "$istop" = true ]; then
+		interrupt=false
+		status=`expr $sum_bad != 0`
+		exit
+	fi
+done
 
 echo
 echo Cleanup on Aisle 5?
diff --git a/common/config-sections b/common/config-sections
index 28bd11bab..c0ea097e8 100644
--- a/common/config-sections
+++ b/common/config-sections
@@ -436,6 +436,9 @@ _config_setup_parallel()
 		exit 1
 	fi
 
+	# strip check-parallel from the sections to run
+	export HOST_OPTIONS_SECTIONS=`echo $HOST_OPTIONS_SECTIONS | sed -e "s/$iam//"`
+
 	grep DEV $HOST_OPTIONS |grep -qv SIZE
 	if [ $? -ne 1 ]; then
 		echo "$iam config file has devices defined"
-- 
2.45.2


  parent reply	other threads:[~2025-04-17  3:12 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-17  3:00 [PATCH 00/28] check-parallel: Running tests without check Dave Chinner
2025-04-17  3:00 ` [PATCH 01/28] fstests: remove support for non-numeric test names Dave Chinner
2025-04-30  9:17   ` Nirjhar Roy (IBM)
2025-05-21  2:39     ` Dave Chinner
2025-05-26  5:14       ` Nirjhar Roy (IBM)
2025-04-17  3:00 ` [PATCH 02/28] _scratch_mkfs_sized: obey USE_EXTERNAL for XFS filesystems Dave Chinner
2025-05-05  6:14   ` Nirjhar Roy (IBM)
2025-04-17  3:00 ` [PATCH 03/28] fstests: move test exit functions to common/exit Dave Chinner
2025-04-17  3:00 ` [PATCH 04/28] check-parallel: report how many tests were _notrun Dave Chinner
2025-05-05  9:58   ` Nirjhar Roy (IBM)
2025-05-21  2:53     ` Dave Chinner
2025-05-26  6:09       ` Nirjhar Roy (IBM)
2025-04-17  3:00 ` [PATCH 05/28] check: factor out test list building code Dave Chinner
2025-05-06 11:32   ` Nirjhar Roy (IBM)
2025-05-21  3:55     ` Dave Chinner
2025-05-26  6:48       ` Nirjhar Roy (IBM)
2025-04-17  3:00 ` [PATCH 06/28] check-parallel: use common group list parsing code Dave Chinner
2025-05-06 15:56   ` Nirjhar Roy (IBM)
2025-05-21  4:13     ` Dave Chinner
2025-05-26  6:58       ` Nirjhar Roy (IBM)
2025-04-17  3:00 ` [PATCH 07/28] check-parallel: adjust concurrency according to CPU count Dave Chinner
2025-05-07  6:45   ` Nirjhar Roy (IBM)
2025-05-21  4:32     ` Dave Chinner
2025-05-26  8:50       ` Nirjhar Roy (IBM)
2025-04-17  3:00 ` [PATCH 08/28] check-parallel: add logwrite device support Dave Chinner
2025-05-07  8:18   ` Nirjhar Roy (IBM)
2025-05-21 10:07     ` Dave Chinner
2025-05-26  8:59       ` Nirjhar Roy (IBM)
2025-04-17  3:00 ` [PATCH 09/28] check-parallel: allow FSTYP selection from the CLI Dave Chinner
2025-05-07  8:49   ` Nirjhar Roy (IBM)
2025-05-21 10:17     ` Dave Chinner
2025-05-26  9:00       ` Nirjhar Roy (IBM)
2025-04-17  3:00 ` [PATCH 10/28] check-parallel: use PID namespaces for runner process isolation Dave Chinner
2025-05-07  9:02   ` Nirjhar Roy (IBM)
2025-05-21 10:19     ` Dave Chinner
2025-05-26  9:04       ` Nirjhar Roy (IBM)
2025-04-17  3:00 ` [PATCH 11/28] check-parallel: initial support for specifying device sizes Dave Chinner
2025-05-07 10:05   ` Nirjhar Roy (IBM)
2025-05-21 11:11     ` Dave Chinner
2025-04-17  3:00 ` [PATCH 12/28] config: move config section code to it's own file Dave Chinner
2025-05-09  6:09   ` Nirjhar Roy
2025-05-21 11:28     ` Dave Chinner
2025-04-17  3:00 ` [PATCH 13/28] check-parallel: introduce config file support Dave Chinner
2025-05-09 12:01   ` Nirjhar Roy
2025-05-21 12:23     ` Dave Chinner
2025-04-17  3:00 ` [PATCH 14/28] fstests: further separate sourcing common/rc and common/config from initialisation Dave Chinner
2025-05-10 14:08   ` Nirjhar Roy (IBM)
2025-04-17  3:00 ` [PATCH 15/28] check-parallel: de-batch test execution Dave Chinner
2025-05-09 13:16   ` Nirjhar Roy
2025-04-17  3:00 ` Dave Chinner [this message]
2025-05-09 14:03   ` [PATCH 16/28] check-parallel: run sections directly Nirjhar Roy
2025-04-17  3:00 ` [PATCH 17/28] check-parallel: rebuild test list when FSTYP changes Dave Chinner
2025-05-09 16:00   ` Nirjhar Roy
2025-04-17  3:00 ` [PATCH 18/28] check-parallel: create a "results-latest" symlink Dave Chinner
2025-05-10 13:12   ` Nirjhar Roy (IBM)
2025-04-17  3:01 ` [PATCH 19/28] check: factor test running Dave Chinner
2025-05-12 13:57   ` Nirjhar Roy (IBM)
2025-04-17  3:01 ` [PATCH 20/28] [RFC] check-parallel: run tests directly without using check Dave Chinner
2025-05-13 14:48   ` Nirjhar Roy (IBM)
2025-04-17  3:01 ` [PATCH 21/28] generic/531: limit max files per CPU Dave Chinner
2025-05-10 13:15   ` Nirjhar Roy (IBM)
2025-04-17  3:01 ` [PATCH 22/28] fsync-tester.c: use syncfs() rather than sync() Dave Chinner
2025-04-30  9:08   ` Nirjhar Roy (IBM)
2025-04-17  3:01 ` [PATCH 23/28] open-by-handle.c: " Dave Chinner
2025-04-30  9:02   ` Nirjhar Roy (IBM)
2025-05-21  2:32     ` Dave Chinner
2025-05-26  5:11       ` Nirjhar Roy (IBM)
2025-04-17  3:01 ` [PATCH 24/28] " Dave Chinner
2025-04-30  8:56   ` Nirjhar Roy (IBM)
2025-05-21  2:30     ` Dave Chinner
2025-05-26  4:56       ` Nirjhar Roy (IBM)
2025-04-17  3:01 ` [PATCH 25/28] bulkstat_unlink_test_modified.c: remove unused test code Dave Chinner
2025-04-30  8:47   ` Nirjhar Roy (IBM)
2025-04-17  3:01 ` [PATCH 26/28] stale-handle.c: use syncfs() rather than sync() Dave Chinner
2025-04-30  8:34   ` Nirjhar Roy (IBM)
2025-05-21  2:24     ` Dave Chinner
2025-04-17  3:01 ` [PATCH 27/28] scaleread: remove dead test code Dave Chinner
2025-04-30  8:10   ` Nirjhar Roy (IBM)
2025-04-17  3:01 ` [PATCH 28/28] xfs/259: no need to call sync Dave Chinner
2025-04-30  7:56   ` Nirjhar Roy (IBM)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250417031208.1852171-17-david@fromorbit.com \
    --to=david@fromorbit.com \
    --cc=fstests@vger.kernel.org \
    --cc=zlang@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.