mirror of https://github.com/postgres/postgres
Both tools never had safeguard checks for the options provided, and it was possible to make pg_test_fsync run an infinite amount of time or pass down buggy values to pg_test_timing. These behaviors have existed for a long time, with no actual complaints, so no backpatch is done. Basic TAP tests are introduced for both tools. Author: Michael Paquier Reviewed-by: Peter Eisentraut Discussion: https://postgr.es/m/20200806062759.GE16470@paquier.xyzpull/57/head
parent
41efb83408
commit
4d29e6dbd0
@ -1 +1,3 @@ |
||||
/pg_test_fsync |
||||
|
||||
/tmp_check/ |
||||
|
||||
@ -0,0 +1,25 @@ |
||||
use strict; |
||||
use warnings; |
||||
|
||||
use Config; |
||||
use TestLib; |
||||
use Test::More tests => 12; |
||||
|
||||
######################################### |
||||
# Basic checks |
||||
|
||||
program_help_ok('pg_test_fsync'); |
||||
program_version_ok('pg_test_fsync'); |
||||
program_options_handling_ok('pg_test_fsync'); |
||||
|
||||
######################################### |
||||
# Test invalid option combinations |
||||
|
||||
command_fails_like( |
||||
[ 'pg_test_fsync', '--secs-per-test', 'a' ], |
||||
qr/\Qpg_test_fsync: error: invalid argument for option --secs-per-test\E/, |
||||
'pg_test_fsync: invalid argument for option --secs-per-test'); |
||||
command_fails_like( |
||||
[ 'pg_test_fsync', '--secs-per-test', '0' ], |
||||
qr/\Qpg_test_fsync: error: --secs-per-test must be in range 1..4294967295\E/, |
||||
'pg_test_fsync: --secs-per-test must be in range'); |
||||
@ -1 +1,3 @@ |
||||
/pg_test_timing |
||||
|
||||
/tmp_check/ |
||||
|
||||
@ -0,0 +1,25 @@ |
||||
use strict; |
||||
use warnings; |
||||
|
||||
use Config; |
||||
use TestLib; |
||||
use Test::More tests => 12; |
||||
|
||||
######################################### |
||||
# Basic checks |
||||
|
||||
program_help_ok('pg_test_timing'); |
||||
program_version_ok('pg_test_timing'); |
||||
program_options_handling_ok('pg_test_timing'); |
||||
|
||||
######################################### |
||||
# Test invalid option combinations |
||||
|
||||
command_fails_like( |
||||
[ 'pg_test_timing', '--duration', 'a' ], |
||||
qr/\Qpg_test_timing: invalid argument for option --duration\E/, |
||||
'pg_test_timing: invalid argument for option --duration'); |
||||
command_fails_like( |
||||
[ 'pg_test_timing', '--duration', '0' ], |
||||
qr/\Qpg_test_timing: --duration must be in range 1..4294967295\E/, |
||||
'pg_test_timing: --duration must be in range'); |
||||
Loading…
Reference in new issue