Skip to content

Commit 406b2f0

Browse files
committed
Fix TAP tests to use only standard command-line argument ordering.
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
1 parent c419321 commit 406b2f0

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

src/bin/initdb/t/001_initdb.pl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
system_or_bail "rm -rf '$tempdir'/*";
2222

23-
command_ok([ 'initdb', "$tempdir/data", '-X', "$tempdir/pgxlog" ],
23+
command_ok([ 'initdb', '-X', "$tempdir/pgxlog", "$tempdir/data" ],
2424
'separate xlog directory');
2525

2626
system_or_bail "rm -rf '$tempdir'/*";
@@ -30,15 +30,15 @@
3030

3131
system_or_bail "rm -rf '$tempdir'/*";
3232
mkdir "$tempdir/pgxlog";
33-
command_ok([ 'initdb', "$tempdir/data", '-X', "$tempdir/pgxlog" ],
33+
command_ok([ 'initdb', '-X', "$tempdir/pgxlog", "$tempdir/data" ],
3434
'existing empty xlog directory');
3535

3636
system_or_bail "rm -rf '$tempdir'/*";
3737
mkdir "$tempdir/pgxlog";
3838
mkdir "$tempdir/pgxlog/lost+found";
39-
command_fails([ 'initdb', "$tempdir/data", '-X', "$tempdir/pgxlog" ],
39+
command_fails([ 'initdb', '-X', "$tempdir/pgxlog", "$tempdir/data" ],
4040
'existing nonempty xlog directory');
4141

4242
system_or_bail "rm -rf '$tempdir'/*";
43-
command_ok([ 'initdb', "$tempdir/data", '-T', 'german' ],
43+
command_ok([ 'initdb', '-T', 'german', "$tempdir/data" ],
4444
'select default dictionary');

src/bin/scripts/t/010_clusterdb.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
psql 'postgres',
2222
'CREATE TABLE test1 (a int); CREATE INDEX test1x ON test1 (a); CLUSTER test1 USING test1x';
2323
issues_sql_like(
24-
[ 'clusterdb', 'postgres', '-t', 'test1' ],
24+
[ 'clusterdb', '-t', 'test1', 'postgres' ],
2525
qr/statement: CLUSTER test1;/,
2626
'cluster specific table');

src/bin/scripts/t/020_createdb.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
qr/statement: CREATE DATABASE foobar1/,
1616
'SQL CREATE DATABASE run');
1717
issues_sql_like(
18-
[ 'createdb', 'foobar2', '-l', 'C', '-E', 'LATIN1', '-T', 'template0' ],
18+
[ 'createdb', '-l', 'C', '-E', 'LATIN1', '-T', 'template0', 'foobar2' ],
1919
qr/statement: CREATE DATABASE foobar2 ENCODING 'LATIN1'/,
2020
'create database with encoding');
2121

src/bin/scripts/t/090_reindexdb.pl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,14 @@
2020
psql 'postgres',
2121
'CREATE TABLE test1 (a int); CREATE INDEX test1x ON test1 (a);';
2222
issues_sql_like(
23-
[ 'reindexdb', 'postgres', '-t', 'test1' ],
23+
[ 'reindexdb', '-t', 'test1', 'postgres' ],
2424
qr/statement: REINDEX TABLE test1;/,
2525
'reindex specific table');
2626
issues_sql_like(
27-
[ 'reindexdb', 'postgres', '-i', 'test1x' ],
27+
[ 'reindexdb', '-i', 'test1x', 'postgres' ],
2828
qr/statement: REINDEX INDEX test1x;/,
2929
'reindex specific index');
30-
3130
issues_sql_like(
32-
[ 'reindexdb', 'postgres', '-s' ],
31+
[ 'reindexdb', '-s', 'postgres' ],
3332
qr/statement: REINDEX SYSTEM postgres;/,
3433
'reindex system tables');

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy