[libdbd-pg-perl] 23/35: Allow POSTGRES_HOME to determine pg_ctl and initdb in the tests

Christoph Berg myon at debian.org
Wed Sep 27 17:41:04 UTC 2017


This is an automated email from the git hooks/post-receive script.

myon pushed a commit to branch master
in repository libdbd-pg-perl.

commit 295d70539b5d19ae05bf13b84e05e01f36b2d884
Author: Greg Sabino Mullane <greg at endpoint.com>
Date:   Thu Sep 21 18:36:12 2017 -0400

    Allow POSTGRES_HOME to determine pg_ctl and initdb in the tests
---
 t/dbdpg_test_setup.pl | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/t/dbdpg_test_setup.pl b/t/dbdpg_test_setup.pl
index 7d4e03b..c02f308 100644
--- a/t/dbdpg_test_setup.pl
+++ b/t/dbdpg_test_setup.pl
@@ -285,7 +285,9 @@ version: $version
 		$helpconnect = 16;
 
 		## Use the initdb found by App::Info
-		$initdb = $ENV{DBDPG_INITDB} || $ENV{PGINITDB} || '';
+        if (! length $initdb or $initdb eq 'default') {
+            $initdb = $ENV{DBDPG_INITDB} || $ENV{PGINITDB} || '';
+        }
 		if (!$initdb or ! -e $initdb) {
 			$initdb = 'initdb';
 		}
@@ -781,13 +783,20 @@ sub get_test_settings {
 
 	## Find the best candidate for the pg_ctl program
 	my $pg_ctl = 'pg_ctl';
-	if (exists $ENV{DBDPG_INITDB} and -e $ENV{DBDPG_INITDB}) {
+    my $initdb = 'default';
+    if (exists $ENV{POSTGRES_HOME} and -e "$ENV{POSTGRES_HOME}/bin/pg_ctl") {
+        $pg_ctl = "$ENV{POSTGRES_HOME}/bin/pg_ctl";
+        $initdb = "$ENV{POSTGRES_HOME}/bin/initdb";
+    }
+	elsif (exists $ENV{DBDPG_INITDB} and -e $ENV{DBDPG_INITDB}) {
 		($pg_ctl = $ENV{DBDPG_INITDB}) =~ s/initdb/pg_ctl/;
-	} elsif (exists $ENV{PGINITDB} and -e $ENV{PGINITDB}) {
+	}
+    elsif (exists $ENV{PGINITDB} and -e $ENV{PGINITDB}) {
 		($pg_ctl = $ENV{PGINITDB}) =~ s/initdb/pg_ctl/;
 	}
+
 	my ($testdsn, $testuser, $testdir, $error) = ('','','','?');
-	my ($helpconnect, $su, $uid, $initdb, $version) = (0,'','','default',0);
+	my ($helpconnect, $su, $uid, $version) = (0,'','',0);
 	my $inerror = 0;
 	if (-e $helpfile) {
 		open $fh, '<', $helpfile or die qq{Could not open "$helpfile": $!\n};

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libdbd-pg-perl.git



More information about the Pkg-perl-cvs-commits mailing list