diff options
| author | Michael Paquier | 2021-10-12 02:16:25 +0000 |
|---|---|---|
| committer | Michael Paquier | 2021-10-12 02:16:25 +0000 |
| commit | bab0ff2e44b781ec1b1180c5e96bdb95c385c80b (patch) | |
| tree | dbdee103f3f0258629b6e6f3aa70b187a2e1c8fc /src/bin | |
| parent | 08f37e2592920a6df9584821614aa8deb93ed39f (diff) | |
Add more $Test::Builder::Level in the TAP tests
Incrementing the level of the call stack reported is useful for
debugging purposes as it allows to control which part of the test is
exactly failing, especially if a test is structured with subroutines
that call routines from Test::More.
This adds more incrementations of $Test::Builder::Level where debugging
gets improved (for example it does not make sense for some paths like
pg_rewind where long subroutines are used).
A note is added to src/test/perl/README about that, based on a
suggestion from Andrew Dunstan and a wording coming from both of us.
Usage of Test::Builder::Level has spread in 12, so a backpatch down to
this version is done.
Reviewed-by: Andrew Dunstan, Peter Eisentraut, Daniel Gustafsson
Discussion: https://postgr.es/m/YV1CCFwgM1RV1LeS@paquier.xyz
Backpatch-through: 12
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl | 2 | ||||
| -rw-r--r-- | src/bin/pg_verifybackup/t/005_bad_manifest.pl | 6 | ||||
| -rw-r--r-- | src/bin/psql/t/010_tab_completion.pl | 4 |
3 files changed, 12 insertions, 0 deletions
diff --git a/src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl b/src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl index 22782d30420..3d196c8d861 100644 --- a/src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl +++ b/src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl @@ -69,6 +69,8 @@ command_fails_like( sub run_check { + local $Test::Builder::Level = $Test::Builder::Level + 1; + my ($suffix, $test_name) = @_; create_files(); diff --git a/src/bin/pg_verifybackup/t/005_bad_manifest.pl b/src/bin/pg_verifybackup/t/005_bad_manifest.pl index 5bd5556038c..dbd0c510376 100644 --- a/src/bin/pg_verifybackup/t/005_bad_manifest.pl +++ b/src/bin/pg_verifybackup/t/005_bad_manifest.pl @@ -173,6 +173,8 @@ EOM sub test_parse_error { + local $Test::Builder::Level = $Test::Builder::Level + 1; + my ($test_name, $manifest_contents) = @_; test_bad_manifest($test_name, @@ -183,6 +185,8 @@ sub test_parse_error sub test_fatal_error { + local $Test::Builder::Level = $Test::Builder::Level + 1; + my ($test_name, $manifest_contents) = @_; test_bad_manifest($test_name, qr/fatal: $test_name/, $manifest_contents); @@ -191,6 +195,8 @@ sub test_fatal_error sub test_bad_manifest { + local $Test::Builder::Level = $Test::Builder::Level + 1; + my ($test_name, $regexp, $manifest_contents) = @_; open(my $fh, '>', "$tempdir/backup_manifest") || die "open: $!"; diff --git a/src/bin/psql/t/010_tab_completion.pl b/src/bin/psql/t/010_tab_completion.pl index c27f216d392..bdf40ec7c05 100644 --- a/src/bin/psql/t/010_tab_completion.pl +++ b/src/bin/psql/t/010_tab_completion.pl @@ -124,6 +124,8 @@ sub check_completion # (won't work if we are inside a string literal!) sub clear_query { + local $Test::Builder::Level = $Test::Builder::Level + 1; + check_completion("\\r\n", qr/postgres=# /, "\\r works"); return; } @@ -133,6 +135,8 @@ sub clear_query # than clear_query because we lose evidence in the history file) sub clear_line { + local $Test::Builder::Level = $Test::Builder::Level + 1; + check_completion("\025\n", qr/postgres=# /, "control-U works"); return; } |
