Warnings and uninitialized variables in TAP tests

Started by Michael Paquieralmost 8 years ago3 messages
#1Michael Paquier
michael@paquier.xyz
1 attachment(s)

Hi all,

While looking at the output of the TAP tests, I have seen warnings like
the following:
Use of uninitialized value $target_lsn in concatenation (.) or string at
/home/foo/git/postgres/src/bin/pg_rewind/../../../src/test/perl/PostgresNode.pm
line 1540.
[...]
./src/bin/pg_basebackup/tmp_check/log/regress_log_010_pg_basebackup:Use
of uninitialized value $str in print at
/home/foo/git/postgres/src/bin/pg_basebackup/../../../src/test/perl/TestLib.pm
line 244.

The first one shows somethng like 30 times, and the second only once.

Attached is a patch to clean up all that. In order to find all that, I
simply ran the following and they pop up:
find . -name "regress_log*" | xargs grep -i "uninitialized"

What I have found is harmless, still they pollute the logs.

Thanks,
--
Michael

Attachments:

tap-init-fix.patchtext/x-diff; charset=us-asciiDownload
diff --git a/src/bin/pg_basebackup/t/010_pg_basebackup.pl b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
index f502a2e3c7..0cd510eeea 100644
--- a/src/bin/pg_basebackup/t/010_pg_basebackup.pl
+++ b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
@@ -48,7 +48,7 @@ ok(!-d "$tempdir/backup", 'backup directory was cleaned up');
 # but leave the data directory behind
 mkdir("$tempdir/backup")
 	or BAIL_OUT("unable to create $tempdir/backup");
-append_to_file("$tempdir/backup/dir-not-empty.txt");
+append_to_file("$tempdir/backup/dir-not-empty.txt", "Some data");
 
 $node->command_fails([ 'pg_basebackup', '-D', "$tempdir/backup", '-n' ],
 	'failing run with no-clean option');
diff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pm
index 1bd91524d7..5a8f084efe 100644
--- a/src/test/perl/PostgresNode.pm
+++ b/src/test/perl/PostgresNode.pm
@@ -1541,7 +1541,7 @@ sub wait_for_catchup
 	  . $standby_name . "'s "
 	  . $mode
 	  . "_lsn to pass "
-	  . $target_lsn . " on "
+	  . $lsn_expr . " on "
 	  . $self->name . "\n";
 	my $query =
 qq[SELECT $lsn_expr <= ${mode}_lsn FROM pg_catalog.pg_stat_replication WHERE application_name = '$standby_name';];
#2Magnus Hagander
magnus@hagander.net
In reply to: Michael Paquier (#1)
Re: Warnings and uninitialized variables in TAP tests

On Mon, Apr 9, 2018 at 3:15 AM, Michael Paquier <michael@paquier.xyz> wrote:

Hi all,

While looking at the output of the TAP tests, I have seen warnings like
the following:
Use of uninitialized value $target_lsn in concatenation (.) or string at
/home/foo/git/postgres/src/bin/pg_rewind/../../../src/
test/perl/PostgresNode.pm
line 1540.
[...]
./src/bin/pg_basebackup/tmp_check/log/regress_log_010_pg_basebackup:Use
of uninitialized value $str in print at
/home/foo/git/postgres/src/bin/pg_basebackup/../../../
src/test/perl/TestLib.pm
line 244.

The first one shows somethng like 30 times, and the second only once.

Attached is a patch to clean up all that. In order to find all that, I
simply ran the following and they pop up:
find . -name "regress_log*" | xargs grep -i "uninitialized"

What I have found is harmless, still they pollute the logs.

Applied, thanks.

--
Magnus Hagander
Me: https://www.hagander.net/ <http://www.hagander.net/&gt;
Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/&gt;

#3Michael Paquier
michael@paquier.xyz
In reply to: Magnus Hagander (#2)
Re: Warnings and uninitialized variables in TAP tests

On Mon, Apr 09, 2018 at 09:46:29PM +0200, Magnus Hagander wrote:

Applied, thanks.

Thanks for the commit.
--
Michael