From 455044d55a89d16d888f289aeaf1229a04a04b9f Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 23 Jul 2014 21:41:59 -0400 Subject: [PATCH] Fix TAP installcheck tests when current directory name contains spaces This fixes the installcheck part. The check part has additional problems that will be addressed in a separate commit. --- src/bin/initdb/t/001_initdb.pl | 10 +++++----- src/bin/pg_controldata/t/001_pg_controldata.pl | 2 +- src/bin/pg_ctl/t/002_status.pl | 2 +- src/test/perl/TestLib.pm | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/bin/initdb/t/001_initdb.pl b/src/bin/initdb/t/001_initdb.pl index a7bea76f52..db92a88a4e 100644 --- a/src/bin/initdb/t/001_initdb.pl +++ b/src/bin/initdb/t/001_initdb.pl @@ -18,27 +18,27 @@ command_fails([ 'initdb', '-S', "$tempdir/data3" ], mkdir "$tempdir/data4" or BAIL_OUT($!); command_ok([ 'initdb', "$tempdir/data4" ], 'existing empty data directory'); -system_or_bail "rm -rf $tempdir/*"; +system_or_bail "rm -rf '$tempdir'/*"; command_ok([ 'initdb', "$tempdir/data", '-X', "$tempdir/pgxlog" ], 'separate xlog directory'); -system_or_bail "rm -rf $tempdir/*"; +system_or_bail "rm -rf '$tempdir'/*"; command_fails( [ 'initdb', "$tempdir/data", '-X', 'pgxlog' ], 'relative xlog directory not allowed'); -system_or_bail "rm -rf $tempdir/*"; +system_or_bail "rm -rf '$tempdir'/*"; mkdir "$tempdir/pgxlog"; command_ok([ 'initdb', "$tempdir/data", '-X', "$tempdir/pgxlog" ], 'existing empty xlog directory'); -system_or_bail "rm -rf $tempdir/*"; +system_or_bail "rm -rf '$tempdir'/*"; mkdir "$tempdir/pgxlog"; mkdir "$tempdir/pgxlog/lost+found"; command_fails([ 'initdb', "$tempdir/data", '-X', "$tempdir/pgxlog" ], 'existing nonempty xlog directory'); -system_or_bail "rm -rf $tempdir/*"; +system_or_bail "rm -rf '$tempdir'/*"; command_ok([ 'initdb', "$tempdir/data", '-T', 'german' ], 'select default dictionary'); diff --git a/src/bin/pg_controldata/t/001_pg_controldata.pl b/src/bin/pg_controldata/t/001_pg_controldata.pl index 84c2fb25f3..35ad10a25c 100644 --- a/src/bin/pg_controldata/t/001_pg_controldata.pl +++ b/src/bin/pg_controldata/t/001_pg_controldata.pl @@ -11,6 +11,6 @@ program_options_handling_ok('pg_controldata'); command_fails(['pg_controldata'], 'pg_controldata without arguments fails'); command_fails([ 'pg_controldata', 'nonexistent' ], 'pg_controldata with nonexistent directory fails'); -system_or_bail "initdb -D $tempdir/data -A trust >/dev/null"; +system_or_bail "initdb -D '$tempdir'/data -A trust >/dev/null"; command_like([ 'pg_controldata', "$tempdir/data" ], qr/checkpoint/, 'pg_controldata produces output'); diff --git a/src/bin/pg_ctl/t/002_status.pl b/src/bin/pg_ctl/t/002_status.pl index 28c0a2a98e..e10fd1b3e3 100644 --- a/src/bin/pg_ctl/t/002_status.pl +++ b/src/bin/pg_ctl/t/002_status.pl @@ -6,7 +6,7 @@ use Test::More tests => 2; my $tempdir = TestLib::tempdir; my $tempdir_short = TestLib::tempdir_short; -system_or_bail "initdb -D $tempdir/data -A trust >/dev/null"; +system_or_bail "initdb -D '$tempdir'/data -A trust >/dev/null"; open CONF, ">>$tempdir/data/postgresql.conf"; print CONF "listen_addresses = ''\n"; print CONF "unix_socket_directories = '$tempdir_short'\n"; diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm index e6a8a4ebe3..899844baf7 100644 --- a/src/test/perl/TestLib.pm +++ b/src/test/perl/TestLib.pm @@ -88,7 +88,7 @@ sub start_test_server my $tempdir_short = tempdir_short; - system "initdb -D $tempdir/pgdata -A trust -N >/dev/null"; + system "initdb -D '$tempdir'/pgdata -A trust -N >/dev/null"; $ret = system 'pg_ctl', '-D', "$tempdir/pgdata", '-s', '-w', '-l', "$tempdir/logfile", '-o', "--fsync=off -k $tempdir_short --listen-addresses='' --log-statement=all", @@ -223,7 +223,7 @@ sub issues_sql_like truncate $test_server_logfile, 0; my $result = run $cmd, '>', \$stdout, '2>', \$stderr; ok($result, "@$cmd exit code 0"); - my $log = `cat $test_server_logfile`; + my $log = `cat '$test_server_logfile'`; like($log, $expected_sql, "$test_name: SQL found in server log"); }; }