diff mbox series

[21/40] generic/127: reduce runtime

Message ID 20241127045403.3665299-22-david@fromorbit.com (mailing list archive)
State New
Headers show
Series fstests: concurrent test execution | expand

Commit Message

Dave Chinner Nov. 27, 2024, 4:51 a.m. UTC
From: Dave Chinner <dchinner@redhat.com>

...
generic/127 684
...

This takes a long time to run because it runs 6 individual
invocations of fsx sequentially. Make them run concurrently
as they can operate on separate files.

...
generic/127 168
...

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 tests/generic/127     | 67 ++++++++++++++++++++++++++-----------------
 tests/generic/127.out |  6 ----
 2 files changed, 41 insertions(+), 32 deletions(-)
diff mbox series

Patch

diff --git a/tests/generic/127 b/tests/generic/127
index c8984f273..985c99cfb 100755
--- a/tests/generic/127
+++ b/tests/generic/127
@@ -16,7 +16,10 @@  _begin_fstest rw auto
 # Override the default cleanup function.
 _cleanup()
 {
-    rm -f $tmp.output
+	[ -n "$fsx_pids" ] && kill $fsx_pids 2> /dev/null
+	wait
+	cd /
+	rm -f $tmp.*
 }
 
 # Import common functions.
@@ -27,7 +30,6 @@  FSX_ARGS="-q -l $FSX_FILE_SIZE -o 65536 -S 191110531 -N 100000"
 
 _fsx_lite_nommap()
 {
-    echo "=== FSX Light Mode, No Memory Mapping ==="
     dd if=/dev/zero of=$TEST_DIR/fsx_lite_nommap bs=${FSX_FILE_SIZE} count=1 > /dev/null 2>&1
     if ! ltp/fsx $FSX_ARGS -L -R -W $FSX_AVOID $TEST_DIR/fsx_lite_nommap > $tmp.output 2>&1
     then
@@ -41,7 +43,6 @@  _fsx_lite_nommap()
 
 _fsx_lite_mmap()
 {
-    echo "=== FSX Light Mode, Memory Mapping ==="
     dd if=/dev/zero of=$TEST_DIR/fsx_lite_mmap bs=${FSX_FILE_SIZE} count=1 > /dev/null 2>&1
     if ! ltp/fsx $FSX_ARGS -L $FSX_AVOID $TEST_DIR/fsx_lite_mmap > $tmp.output 2>&1
     then
@@ -55,42 +56,56 @@  _fsx_lite_mmap()
 
 _fsx_std_nommap()
 {
-    echo "=== FSX Standard Mode, No Memory Mapping ==="
-    if ! ltp/fsx $FSX_ARGS -R -W $FSX_AVOID $TEST_DIR/fsx_std_nommap > $tmp.output 2>&1
-    then
-        echo "ltp/fsx $FSX_ARGS -R -W fsx_std_nommap"
-        cat $tmp.output
-        return 1
-    fi
-    cat $tmp.output
-    return 0
+	local fname="$TEST_DIR/$1"
+
+	if ! ltp/fsx $FSX_ARGS -R -W $FSX_AVOID $fname > $tmp.output 2>&1
+	then
+		echo "ltp/fsx $FSX_ARGS -R -W fsx_std_nommap"
+		cat $tmp.output
+		return 1
+	fi
+	cat $tmp.output
+	return 0
 }
 
 _fsx_std_mmap()
 {
-    echo "=== FSX Standard Mode, Memory Mapping ==="
-    if ! ltp/fsx $FSX_ARGS $FSX_AVOID $TEST_DIR/fsx_std_mmap > $tmp.output 2>&1
-    then
-    	echo "ltp/fsx $FSX_ARGS fsx_std_mmap"
+	local fname="$TEST_DIR/$1"
+
+	if ! ltp/fsx $FSX_ARGS $FSX_AVOID $fname > $tmp.output 2>&1
+	then
+		echo "ltp/fsx $FSX_ARGS fsx_std_mmap"
+		cat $tmp.output
+		return 1
+	fi
 	cat $tmp.output
-	return 1
-    fi
-    cat $tmp.output
-    return 0
+	return 0
 }
 
 _require_test
 
-_fsx_lite_nommap || exit
-_fsx_lite_mmap || exit
+_fsx_lite_nommap &
+fsx_pids=$!
 
-_fsx_std_nommap || exit
-_fsx_std_mmap || exit
+_fsx_lite_mmap &
+fsx_pids="$! $fsx_pids"
+
+_fsx_std_nommap fsx_std_nommap &
+fsx_pids="$! $fsx_pids"
+
+_fsx_std_mmap fsx_std_mmap &
+fsx_pids="$! $fsx_pids"
 
 #flush cache after write
 FSX_ARGS="-f $FSX_ARGS"
-_fsx_std_nommap || exit
-_fsx_std_mmap || exit
+_fsx_std_nommap fsx_std_nommap_flush &
+fsx_pids="$! $fsx_pids"
+
+_fsx_std_mmap fsx_std_mmap_flush &
+fsx_pids="$! $fsx_pids"
+
+wait $fsx_pids
+unset fsx_pids
 
 status=0
 _cleanup
diff --git a/tests/generic/127.out b/tests/generic/127.out
index 9459dc897..99fb0fddc 100644
--- a/tests/generic/127.out
+++ b/tests/generic/127.out
@@ -1,13 +1,7 @@ 
 QA output created by 127
-=== FSX Light Mode, No Memory Mapping ===
 All 100000 operations completed A-OK!
-=== FSX Light Mode, Memory Mapping ===
 All 100000 operations completed A-OK!
-=== FSX Standard Mode, No Memory Mapping ===
 All 100000 operations completed A-OK!
-=== FSX Standard Mode, Memory Mapping ===
 All 100000 operations completed A-OK!
-=== FSX Standard Mode, No Memory Mapping ===
 All 100000 operations completed A-OK!
-=== FSX Standard Mode, Memory Mapping ===
 All 100000 operations completed A-OK!