From 0a0ee5c063c0176bf7e7782a5e82de1f99adc0b4 Mon Sep 17 00:00:00 2001
From: Marcel Telka <marcel@telka.sk>
Date: Fri, 25 Nov 2022 13:59:17 +0100
Subject: [PATCH] tools/perl-integrate-module: do not re-run test if it failed earlier

---
 tools/perl-integrate-module |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/perl-integrate-module b/tools/perl-integrate-module
index 5cc4a60..806f6dc 100755
--- a/tools/perl-integrate-module
+++ b/tools/perl-integrate-module
@@ -418,6 +418,7 @@
 
 
 # Run tests to make sure they pass and to create result snapshots
+TESTED_VERSIONS=
 for v in $PERL_VERSIONS ; do
 	! gmake PERL_VERSIONS=$v test > /dev/null 2>&1 && printf "ERROR: Testing failed for %s!\n" "$v" >&2 && continue
 
@@ -427,14 +428,15 @@
 
 	# Empty result snapshot is suspicious
 	[[ -s "$COMPONENT_TEST_SNAPSHOT" ]] || printf "WARNING: Empty test results for %s\n" "$v" >&2
+
+	TESTED_VERSIONS="$TESTED_VERSIONS $v"
 done
 
 # Save result snapshots and detect USE_COMMON_TEST_MASTER value
 TEST_MASTERS=
 for common_results in yes no ; do
-	for v in $PERL_VERSIONS ; do
+	for v in $TESTED_VERSIONS ; do
 		COMPONENT_TEST_SNAPSHOT=$(gmake PERL_VERSION=$v print-value-COMPONENT_TEST_SNAPSHOT)
-		[[ ! -f "$COMPONENT_TEST_SNAPSHOT" ]] && continue
 		COMPONENT_TEST_MASTER=$(gmake PERL_VERSION=$v USE_COMMON_TEST_MASTER=$common_results print-value-COMPONENT_TEST_MASTER)
 
 		if [[ -f "$COMPONENT_TEST_MASTER" ]] ; then
@@ -455,7 +457,7 @@
 [[ -n "$TEST_MASTERS" ]] && git add $TEST_MASTERS
 
 # Run tests again to confirm the results are reproducible
-for v in $PERL_VERSIONS ; do
+for v in $TESTED_VERSIONS ; do
 	gmake PERL_VERSIONS=$v USE_COMMON_TEST_MASTER=$common_results test > /dev/null 2>&1 || printf "ERROR: Testing for %s is not reproducible!\n" "$v" >&2
 done
 

--
Gitblit v1.9.3