]> granicus.if.org Git - postgresql/commitdiff
Fix TAP tests to use only standard command-line argument ordering.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 4 Apr 2015 17:34:23 +0000 (13:34 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 4 Apr 2015 17:34:23 +0000 (13:34 -0400)
Some of the TAP tests were supposing that PG programs would accept switches
after non-switch arguments on their command lines.  While GNU getopt_long()
does allow that, our own implementation does not, and it's nowhere
suggested in our documentation that such cases should work.  Adjust the
tests to use only the documented syntax.

Back-patch to 9.4, since without this the TAP tests fail when run with
src/port's getopt_long() implementation.

Michael Paquier

src/bin/initdb/t/001_initdb.pl
src/bin/scripts/t/010_clusterdb.pl
src/bin/scripts/t/020_createdb.pl
src/bin/scripts/t/090_reindexdb.pl

index 149b3d1bb393656eb567d52eee2fc7aab1fc52dd..d12be842c1156e7996335fb0feed2eadf2e77602 100644 (file)
@@ -20,7 +20,7 @@ command_ok([ 'initdb', "$tempdir/data4" ], 'existing empty data directory');
 
 system_or_bail "rm -rf '$tempdir'/*";
 
-command_ok([ 'initdb', "$tempdir/data", '-X', "$tempdir/pgxlog" ],
+command_ok([ 'initdb', '-X', "$tempdir/pgxlog", "$tempdir/data" ],
        'separate xlog directory');
 
 system_or_bail "rm -rf '$tempdir'/*";
@@ -30,15 +30,15 @@ command_fails(
 
 system_or_bail "rm -rf '$tempdir'/*";
 mkdir "$tempdir/pgxlog";
-command_ok([ 'initdb', "$tempdir/data", '-X', "$tempdir/pgxlog" ],
+command_ok([ 'initdb', '-X', "$tempdir/pgxlog", "$tempdir/data" ],
        'existing empty xlog directory');
 
 system_or_bail "rm -rf '$tempdir'/*";
 mkdir "$tempdir/pgxlog";
 mkdir "$tempdir/pgxlog/lost+found";
-command_fails([ 'initdb', "$tempdir/data", '-X', "$tempdir/pgxlog" ],
+command_fails([ 'initdb', '-X', "$tempdir/pgxlog", "$tempdir/data" ],
        'existing nonempty xlog directory');
 
 system_or_bail "rm -rf '$tempdir'/*";
-command_ok([ 'initdb', "$tempdir/data", '-T', 'german' ],
+command_ok([ 'initdb', '-T', 'german', "$tempdir/data" ],
        'select default dictionary');
index cb9d04b0fe6bdeb67dc6e95d109d79814c871d0a..dc0d78a27d374edecf3682c3e19ae16ec8721fdd 100644 (file)
@@ -21,6 +21,6 @@ command_fails([ 'clusterdb', '-t', 'nonexistent', 'postgres' ],
 psql 'postgres',
 'CREATE TABLE test1 (a int); CREATE INDEX test1x ON test1 (a); CLUSTER test1 USING test1x';
 issues_sql_like(
-       [ 'clusterdb', 'postgres', '-t', 'test1' ],
+       [ 'clusterdb', '-t', 'test1', 'postgres' ],
        qr/statement: CLUSTER test1;/,
        'cluster specific table');
index 40fbc9278d03192c99a1e91bf16468a377d640cc..a44283c9458e90e5df6802e5e4024d274c656c29 100644 (file)
@@ -15,7 +15,7 @@ issues_sql_like(
        qr/statement: CREATE DATABASE foobar1/,
        'SQL CREATE DATABASE run');
 issues_sql_like(
-       [ 'createdb', 'foobar2', '-l', 'C', '-E', 'LATIN1', '-T', 'template0' ],
+       [ 'createdb', '-l', 'C', '-E', 'LATIN1', '-T', 'template0', 'foobar2' ],
        qr/statement: CREATE DATABASE foobar2 ENCODING 'LATIN1'/,
        'create database with encoding');
 
index d5b42dee034fe3a7d61a8049a384ad2cfd7f3905..bba1667b56f505a9c60ed37e5562e3f3682af02a 100644 (file)
@@ -20,15 +20,14 @@ issues_sql_like(
 psql 'postgres',
   'CREATE TABLE test1 (a int); CREATE INDEX test1x ON test1 (a);';
 issues_sql_like(
-       [ 'reindexdb', 'postgres', '-t', 'test1' ],
+       [ 'reindexdb', '-t', 'test1', 'postgres' ],
        qr/statement: REINDEX TABLE test1;/,
        'reindex specific table');
 issues_sql_like(
-       [ 'reindexdb', 'postgres', '-i', 'test1x' ],
+       [ 'reindexdb', '-i', 'test1x', 'postgres' ],
        qr/statement: REINDEX INDEX test1x;/,
        'reindex specific index');
-
 issues_sql_like(
-       [ 'reindexdb', 'postgres', '-s' ],
+       [ 'reindexdb', '-s', 'postgres' ],
        qr/statement: REINDEX SYSTEM postgres;/,
        'reindex system tables');