diff mbox series

[RFC,v2,6/6] check: stash full/dmesg/out.bad files on rerun

Message ID 20220627222256.14175-7-ddiss@suse.de (mailing list archive)
State New, archived
Headers show
Series check: add option to rerun failed tests | expand

Commit Message

David Disseldorp June 27, 2022, 10:22 p.m. UTC
These files would otherwise be overwritten.

Signed-off-by: David Disseldorp <ddiss@suse.de>
---
 check | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

Comments

Darrick J. Wong June 28, 2022, 3:16 p.m. UTC | #1
On Tue, Jun 28, 2022 at 12:22:56AM +0200, David Disseldorp wrote:
> These files would otherwise be overwritten.
> 
> Signed-off-by: David Disseldorp <ddiss@suse.de>

Why not fold this into the previous patch?

--D

> ---
>  check | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/check b/check
> index 726c83d9..baf336da 100755
> --- a/check
> +++ b/check
> @@ -570,8 +570,17 @@ _stash_test_status() {
>  				      "$report_msg"
>  	fi
>  
> -	# only stash result for first failure (triggering loop)
> -	((loop_num > 1)) && return
> +	if ((loop_num > 0)); then
> +		# retain files which would be overwritten in subsequent reruns
> +		for i in "${REPORT_DIR}/${test_seq}.full" \
> +			 "${REPORT_DIR}/${test_seq}.dmesg" \
> +			 "${REPORT_DIR}/${test_seq}.out.bad"; do
> +			[ -f "$i" ] || continue
> +			cp "$i" "${i}.rerun$((loop_num - 1))"
> +		done
> +		# only stash result for first failure (triggering loop)
> +		((loop_num != 1)) && return
> +	fi
>  
>  	case "$test_status" in
>  	fail)
> -- 
> 2.35.3
>
David Disseldorp June 28, 2022, 10:36 p.m. UTC | #2
On Tue, 28 Jun 2022 08:16:08 -0700, Darrick J. Wong wrote:

> On Tue, Jun 28, 2022 at 12:22:56AM +0200, David Disseldorp wrote:
> > These files would otherwise be overwritten.
> > 
> > Signed-off-by: David Disseldorp <ddiss@suse.de>  
> 
> Why not fold this into the previous patch?

Gladly. Will do so in a subsequent round.

Cheers, David
diff mbox series

Patch

diff --git a/check b/check
index 726c83d9..baf336da 100755
--- a/check
+++ b/check
@@ -570,8 +570,17 @@  _stash_test_status() {
 				      "$report_msg"
 	fi
 
-	# only stash result for first failure (triggering loop)
-	((loop_num > 1)) && return
+	if ((loop_num > 0)); then
+		# retain files which would be overwritten in subsequent reruns
+		for i in "${REPORT_DIR}/${test_seq}.full" \
+			 "${REPORT_DIR}/${test_seq}.dmesg" \
+			 "${REPORT_DIR}/${test_seq}.out.bad"; do
+			[ -f "$i" ] || continue
+			cp "$i" "${i}.rerun$((loop_num - 1))"
+		done
+		# only stash result for first failure (triggering loop)
+		((loop_num != 1)) && return
+	fi
 
 	case "$test_status" in
 	fail)