Hi all,
(Thomas and Andres in CC.)

Andres has complained a couple of days ago about the quantity of logs
that can be fed into the TAP tests running pg_regress:
https://www.postgresql.org/message-id/20220603195318.qk4voicqfdhls...@alap3.anarazel.de

This concerns the TAP tests of pg_upgrade, as well as
027_stream_regress.pl, where a crash while running the tests would
show a couple of megs worth of regression.diffs.  Most of the output
generated does not make much sense to have in this case, and the
parallel schedule gives a harder time to spot the exact query involved
in the crash (if that's a query) while the logs of the backend should
be enough to spot what's the problem with the PIDs tracked.

One idea I got to limit the useless output generated is to check the
status of the cluster after running the regression test suite as
restart_on_crash is disabled by default in Cluster.pm, and avoid any 
follow-up logic in these tests if the cluster is not running anymore,
as of the attached.

Thoughts?
--
Michael
diff --git a/src/bin/pg_upgrade/t/002_pg_upgrade.pl b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
index 3f11540e18..b3ea3cfba3 100644
--- a/src/bin/pg_upgrade/t/002_pg_upgrade.pl
+++ b/src/bin/pg_upgrade/t/002_pg_upgrade.pl
@@ -115,6 +115,10 @@ else
 		  . "--max-concurrent-tests=20 "
 		  . "--inputdir=\"$inputdir\" "
 		  . "--outputdir=\"$outputdir\"");
+
+	die "node has crashed while running pg_regress\n"
+	  if ($oldnode->status) != 0;
+
 	if ($rc != 0)
 	{
 		# Dump out the regression diffs file, if there is one
diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm b/src/test/perl/PostgreSQL/Test/Cluster.pm
index c8c7bc5045..463293bc86 100644
--- a/src/test/perl/PostgreSQL/Test/Cluster.pm
+++ b/src/test/perl/PostgreSQL/Test/Cluster.pm
@@ -995,6 +995,29 @@ sub promote
 	return;
 }
 
+=item $node->status()
+
+Wrapper for pg_ctl status.  Returns the exit code of the command.
+
+=cut
+
+sub status
+{
+	my ($self)  = @_;
+	my $port    = $self->port;
+	my $pgdata  = $self->data_dir;
+	my $logfile = $self->logfile;
+	my $name    = $self->name;
+	my $ret;
+
+	local %ENV = $self->_get_env();
+
+	print "### Retrieving status of node \"$name\"\n";
+	$ret = PostgreSQL::Test::Utils::system_log('pg_ctl', '-D', $pgdata,
+		'-l', $logfile, 'status');
+	return $ret;
+}
+
 =pod
 
 =item $node->logrotate()
diff --git a/src/test/recovery/t/027_stream_regress.pl b/src/test/recovery/t/027_stream_regress.pl
index fdb4ea0bf5..e3a8b35bd5 100644
--- a/src/test/recovery/t/027_stream_regress.pl
+++ b/src/test/recovery/t/027_stream_regress.pl
@@ -74,6 +74,10 @@ my $rc =
 	  . "--max-concurrent-tests=20 "
 	  . "--inputdir=../regress "
 	  . "--outputdir=\"$outputdir\"");
+
+die "node has crashed while running pg_regress\n"
+  if ($node_primary->status) != 0;
+
 if ($rc != 0)
 {
 	# Dump out the regression diffs file, if there is one

Attachment: signature.asc
Description: PGP signature

Reply via email to