diff mbox series

[1/2] generic/038: set a maximum runtime on this test

Message ID 167521269515.2382722.13790661033478617605.stgit@magnolia (mailing list archive)
State Deferred, archived
Headers show
Series fstests: random fixes for v2023.01.22 | expand

Commit Message

Darrick J. Wong Feb. 1, 2023, 12:51 a.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

This test races multiple FITRIM calls against multiple programs creating
200k small files to ensure that there are no concurrency problems with
the allocator and the FITRIM code.  This is not necessarily quick, and
the test itself does not contain any upper bound on the runtime.  On my
system that simulates storage with DRAM this takes ~5 minutes to run; on
my cloud system with newly provided discard support, I killed the test
after 27 hours.

Constrain the runtime to about the customary 30s * TIME_FACTOR.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 tests/generic/038 |    6 ++++++
 1 file changed, 6 insertions(+)

Comments

Zorro Lang Feb. 2, 2023, 9:53 a.m. UTC | #1
On Tue, Jan 31, 2023 at 04:51:35PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> This test races multiple FITRIM calls against multiple programs creating
> 200k small files to ensure that there are no concurrency problems with
> the allocator and the FITRIM code.  This is not necessarily quick, and
> the test itself does not contain any upper bound on the runtime.  On my
> system that simulates storage with DRAM this takes ~5 minutes to run; on
> my cloud system with newly provided discard support, I killed the test
> after 27 hours.
> 
> Constrain the runtime to about the customary 30s * TIME_FACTOR.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---

Looks good to me,

Reviewed-by: Zorro Lang <zlang@redhat.com>

>  tests/generic/038 |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> 
> diff --git a/tests/generic/038 b/tests/generic/038
> index 5c014ae389..e1176292fb 100755
> --- a/tests/generic/038
> +++ b/tests/generic/038
> @@ -100,6 +100,8 @@ nr_files=$((50000 * LOAD_FACTOR))
>  create_files()
>  {
>  	local prefix=$1
> +	local now=$(date '+%s')
> +	local end_time=$(( now + (TIME_FACTOR * 30) ))
>  
>  	for ((n = 0; n < 4; n++)); do
>  		mkdir $SCRATCH_MNT/$n
> @@ -113,6 +115,10 @@ create_files()
>  				echo "Failed creating file $n/${prefix}_$i" >>$seqres.full
>  				break
>  			fi
> +			if [ "$(date '+%s')" -ge $end_time ]; then
> +				echo "runtime exceeded @ $i files" >> $seqres.full
> +				break
> +			fi
>  		done
>  		) &
>  		create_pids[$n]=$!
>
diff mbox series

Patch

diff --git a/tests/generic/038 b/tests/generic/038
index 5c014ae389..e1176292fb 100755
--- a/tests/generic/038
+++ b/tests/generic/038
@@ -100,6 +100,8 @@  nr_files=$((50000 * LOAD_FACTOR))
 create_files()
 {
 	local prefix=$1
+	local now=$(date '+%s')
+	local end_time=$(( now + (TIME_FACTOR * 30) ))
 
 	for ((n = 0; n < 4; n++)); do
 		mkdir $SCRATCH_MNT/$n
@@ -113,6 +115,10 @@  create_files()
 				echo "Failed creating file $n/${prefix}_$i" >>$seqres.full
 				break
 			fi
+			if [ "$(date '+%s')" -ge $end_time ]; then
+				echo "runtime exceeded @ $i files" >> $seqres.full
+				break
+			fi
 		done
 		) &
 		create_pids[$n]=$!