|
4 | 4 | use Config;
|
5 | 5 | use PostgresNode;
|
6 | 6 | use TestLib;
|
7 |
| -use Test::Moretests=>15; |
| 7 | +use Test::Moretests=>42; |
8 | 8 |
|
9 | 9 | my$tempdir = TestLib::tempdir;
|
10 | 10 | my$tempdir_short = TestLib::tempdir_short;
|
|
16 | 16 | program_version_ok('pg_dump');
|
17 | 17 | program_options_handling_ok('pg_dump');
|
18 | 18 |
|
| 19 | +program_help_ok('pg_restore'); |
| 20 | +program_version_ok('pg_restore'); |
| 21 | +program_options_handling_ok('pg_restore'); |
| 22 | + |
| 23 | +program_help_ok('pg_dumpall'); |
| 24 | +program_version_ok('pg_dumpall'); |
| 25 | +program_options_handling_ok('pg_dumpall'); |
| 26 | + |
19 | 27 | #########################################
|
20 | 28 | # Test various invalid options and disallowed combinations
|
21 | 29 | # Doesn't require a PG instance to be set up, so do this first.
|
22 | 30 |
|
23 | 31 | command_exit_is(['pg_dump','qqq','abc' ],
|
24 | 32 | 1,'pg_dump: too many command-line arguments (first is "asd")');
|
25 | 33 |
|
| 34 | +command_exit_is(['pg_restore','qqq','abc' ], |
| 35 | +1,'pg_restore too many command-line arguments (first is "asd")'); |
| 36 | + |
| 37 | +command_exit_is(['pg_dumpall','qqq','abc' ], |
| 38 | +1,'pg_dumpall: too many command-line arguments (first is "qqq")'); |
| 39 | + |
26 | 40 | command_exit_is(
|
27 | 41 | ['pg_dump','-s','-a' ],
|
28 | 42 | 1,
|
29 | 43 | 'pg_dump: options -s/--schema-only and -a/--data-only cannot be used together'
|
30 | 44 | );
|
31 | 45 |
|
| 46 | +command_exit_is( |
| 47 | +['pg_restore','-s','-a' ], |
| 48 | +1, |
| 49 | +'pg_restore: options -s/--schema-only and -a/--data-only cannot be used together' |
| 50 | +); |
| 51 | + |
| 52 | +command_exit_is( |
| 53 | +['pg_restore','-d','xxx','-f','xxx' ], |
| 54 | +1, |
| 55 | +'pg_restore: options -d/--dbname and -f/--file cannot be used together' |
| 56 | +); |
| 57 | + |
32 | 58 | command_exit_is(
|
33 | 59 | ['pg_dump','-c','-a' ],
|
34 | 60 | 1,
|
35 | 61 | 'pg_dump: options -c/--clean and -a/--data-only cannot be used together');
|
36 | 62 |
|
| 63 | +command_exit_is( |
| 64 | +['pg_restore','-c','-a' ], |
| 65 | +1, |
| 66 | +'pg_restore: options -c/--clean and -a/--data-only cannot be used together'); |
| 67 | + |
37 | 68 | command_exit_is(
|
38 | 69 | ['pg_dump','--inserts','-o' ],
|
39 | 70 | 1,
|
|
48 | 79 |
|
49 | 80 | command_exit_is(['pg_dump','-j3' ],
|
50 | 81 | 1,'pg_dump: parallel backup only supported by the directory format');
|
| 82 | + |
| 83 | +command_exit_is(['pg_restore','--single-transaction','-j3' ], |
| 84 | +1,'pg_restore: cannot specify both --single-transaction and multiple jobs'); |
| 85 | + |
| 86 | +command_exit_is(['pg_restore','--if-exists' ], |
| 87 | +1,'pg_restore: option --if-exists requires option -c/--clean'); |
| 88 | + |
| 89 | +# pg_dumpall command-line argument checks |
| 90 | +command_exit_is( |
| 91 | +['pg_dumpall','-g','-r' ], |
| 92 | +1, |
| 93 | +'pg_restore: options -g/--globals-only and -r/--roles-only cannot be used together' |
| 94 | +); |
| 95 | + |
| 96 | +command_exit_is( |
| 97 | +['pg_dumpall','-g','-t' ], |
| 98 | +1, |
| 99 | +'pg_restore: options -g/--globals-only and -t/--tablespaces-only cannot be used together' |
| 100 | +); |
| 101 | + |
| 102 | +command_exit_is( |
| 103 | +['pg_dumpall','-r','-t' ], |
| 104 | +1, |
| 105 | +'pg_restore: options -r/--roles-only and -t/--tablespaces-only cannot be used together' |
| 106 | +); |
| 107 | + |
| 108 | +command_exit_is(['pg_dumpall','--if-exists' ], |
| 109 | +1,'pg_dumpall: option --if-exists requires option -c/--clean'); |