Author: turnstep
Date: Sun May 11 07:21:18 2008
New Revision: 11243

Modified:
   DBD-Pg/trunk/t/dbdpg_test_setup.pl

Log:
Make sure windows always uses localhost.
Capture error on first initdb.
Set max_connections to 3.


Modified: DBD-Pg/trunk/t/dbdpg_test_setup.pl
==============================================================================
--- DBD-Pg/trunk/t/dbdpg_test_setup.pl  (original)
+++ DBD-Pg/trunk/t/dbdpg_test_setup.pl  Sun May 11 07:21:18 2008
@@ -136,7 +136,7 @@
 
        if (! $testdsn) {
                $helpconnect = 1;
-               $testdsn = 'dbi:Pg:';
+               $testdsn = $^O =~ /Win32/ ? 'dbi:Pg:host=localhost' : 'dbi:Pg:';
        }
        if (! $testuser) {
                $testuser = 'postgres';
@@ -195,7 +195,7 @@
                }
                $info = '';
                eval {
-                       $info = qx{$initdb --help};
+                       $info = qx{$initdb --help 2>&1};
                };
                last GETHANDLE if $@;
                if (!defined $info or $info !~ /[EMAIL PROTECTED]/) {
@@ -323,7 +323,7 @@
                        $@ = qq{Could not open "$conf": $!};
                        last GETHANDLE;
                }
-               print $cfh "\n\n## DBD::Pg testing port\nport=$testport\n\n";
+               print $cfh "\n\n## DBD::Pg testing 
parameters\nport=$testport\nmax_connections=3\n\n";
                close $cfh or die qq{Could not close "$conf": $!\n};
 
                ## Attempt to start up the test server
@@ -348,6 +348,9 @@
 
                ## Attempt to connect to this server
                $testdsn = "dbi:Pg:dbname=postgres;port=$testport";
+               if ($^O =~ /Win32/) {
+                       $testdsn .= ';host=localhost';
+               }
                my $loop = 1;
          STARTUP: {
                        eval {
@@ -470,7 +473,6 @@
                close $fh or die qq{Could not close "$helpfile": $!\n};
        }
 
-
        return $testdsn, $testuser, $helpconnect, $su, $testdir, $pg_ctl;
 }
 

Reply via email to