Allow TAP tests to run under Msys
authorAndrew Dunstan <andrew@dunslane.net>
Mon, 3 Aug 2015 00:58:18 +0000 (20:58 -0400)
committerAndrew Dunstan <andrew@dunslane.net>
Mon, 3 Aug 2015 00:58:18 +0000 (20:58 -0400)
The Msys DTK perl, which is required to run TAP tests under Msys as a
native perl won't recognize the correct virtual paths, has its osname
recorded in the Config module as 'msys' instead of 'MSWin32'. To avoid
having to repeat the test a variable is created that is true iff the
osname is either of these values, and is then used everywhere that
matters.

src/bin/pg_basebackup/t/010_pg_basebackup.pl
src/bin/pg_ctl/t/001_start_stop.pl
src/test/perl/TestLib.pm

index 4dbf8ca5224374546d0bc1a586fe15fd0db2a28f..5fa0caa3053469e6422401a14938c0516746d5a4 100644 (file)
@@ -92,7 +92,7 @@ unlink "$tempdir/pgdata/$superlongname";
 # The following tests test symlinks. Windows doesn't have symlinks, so
 # skip on Windows.
 SKIP: {
-    skip "symlinks not supported on Windows", 10 if ($Config{osname} eq "MSWin32");
+    skip "symlinks not supported on Windows", 10 if ($windows_os);
 
    # Create a temporary directory in the system location and symlink it
    # to our physical temp location.  That way we can use shorter names
index 015e4d8931c801c9312bf7735a89f585b4a45e00..dae47a80135a33f39856f57232ec66f30a084e65 100644 (file)
@@ -20,7 +20,7 @@ command_ok(
        "$tempdir/data" ],
    'configure authentication');
 open CONF, ">>$tempdir/data/postgresql.conf";
-if ($Config{osname} ne "MSWin32")
+if (! $windows_os)
 {
    print CONF "listen_addresses = ''\n";
    print CONF "unix_socket_directories = '$tempdir_short'\n";
index 6677a57990ccc4acf385f00b75c60a27a164fbfb..8fd6f2c92a82ecee7b3bc6e8821b9a0e52e51276 100644 (file)
@@ -30,6 +30,7 @@ our @EXPORT = qw(
 
   $tmp_check
   $log_path
+  $windows_os
 );
 
 use Cwd;
@@ -42,6 +43,8 @@ use SimpleTee;
 
 use Test::More;
 
+our $windows_os = $Config{osname} eq 'MSWin32' || $Config{osname} eq 'msys';
+
 # Open log file. For each test, the log file name uses the name of the
 # file launching this module, without the .pl suffix.
 our ($tmp_check, $log_path);
@@ -140,7 +143,7 @@ sub standard_initdb
 
    open CONF, ">>$pgdata/postgresql.conf";
    print CONF "\n# Added by TestLib.pm)\n";
-   if ($Config{osname} eq "MSWin32")
+   if ($windows_os)
    {
        print CONF "listen_addresses = '127.0.0.1'\n";
    }
@@ -151,7 +154,7 @@ sub standard_initdb
    }
    close CONF;
 
-   $ENV{PGHOST}         = ($Config{osname} eq "MSWin32") ? "127.0.0.1" : $tempdir_short;
+   $ENV{PGHOST}         = $windows_os ? "127.0.0.1" : $tempdir_short;
 }
 
 # Set up the cluster to allow replication connections, in the same way that
@@ -162,7 +165,7 @@ sub configure_hba_for_replication
 
    open HBA, ">>$pgdata/pg_hba.conf";
    print HBA "\n# Allow replication (set up by TestLib.pm)\n";
-   if ($Config{osname} ne "MSWin32")
+   if (! $windows_os)
    {
        print HBA "local replication all trust\n";
    }