aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2020-04-03 15:28:59 -0400
committerRobert Haas <rhaas@postgresql.org>2020-04-03 15:28:59 -0400
commit87e300434058a157bbc4ef8d039937abdefa7610 (patch)
treecbaaa23aceab6ef95b786b3a3704ab06f5f171bf
parent0d8c9c1210c44b36ec2efcb223a1dfbe897a3661 (diff)
downloadpostgresql-87e300434058a157bbc4ef8d039937abdefa7610.tar.gz
postgresql-87e300434058a157bbc4ef8d039937abdefa7610.zip
pg_validatebackup: Adjust TAP tests to placate perlcritic.
It seems that we have a policy that every Perl subroutine should end with an explicit "return", so add explicit "return" statements to all the new subroutines added by my prior commit 0d8c9c1210c44b36ec2efcb223a1dfbe897a3661. Per buildfarm.
-rw-r--r--src/bin/pg_validatebackup/t/003_corruption.pl13
-rw-r--r--src/bin/pg_validatebackup/t/005_bad_manifest.pl3
2 files changed, 16 insertions, 0 deletions
diff --git a/src/bin/pg_validatebackup/t/003_corruption.pl b/src/bin/pg_validatebackup/t/003_corruption.pl
index 6ad29a031f8..787fdde0044 100644
--- a/src/bin/pg_validatebackup/t/003_corruption.pl
+++ b/src/bin/pg_validatebackup/t/003_corruption.pl
@@ -134,6 +134,7 @@ sub create_extra_file
open(my $fh, '>', $pathname) || die "open $pathname: $!";
print $fh "This is an extra file.\n";
close($fh);
+ return;
}
# Add a file into the root directory of the backup.
@@ -141,6 +142,7 @@ sub mutilate_extra_file
{
my ($backup_path) = @_;
create_extra_file($backup_path, "extra_file");
+ return;
}
# Add a file inside the user-defined tablespace.
@@ -155,6 +157,7 @@ sub mutilate_extra_tablespace_file
slurp_dir("$backup_path/pg_tblspc/$tsoid/$catvdir");
create_extra_file($backup_path,
"pg_tblspc/$tsoid/$catvdir/$tsdboid/extra_ts_file");
+ return;
}
# Remove a file.
@@ -163,6 +166,7 @@ sub mutilate_missing_file
my ($backup_path) = @_;
my $pathname = "$backup_path/pg_xact/0000";
unlink($pathname) || die "$pathname: $!";
+ return;
}
# Remove the symlink to the user-defined tablespace.
@@ -180,6 +184,7 @@ sub mutilate_missing_tablespace
{
unlink($pathname) || die "$pathname: $!";
}
+ return;
}
# Append an additional bytes to a file.
@@ -187,6 +192,7 @@ sub mutilate_append_to_file
{
my ($backup_path) = @_;
append_to_file "$backup_path/global/pg_control", 'x';
+ return;
}
# Truncate a file to zero length.
@@ -196,6 +202,7 @@ sub mutilate_truncate_file
my $pathname = "$backup_path/global/pg_control";
open(my $fh, '>', $pathname) || die "open $pathname: $!";
close($fh);
+ return;
}
# Replace a file's contents without changing the length of the file. This is
@@ -209,6 +216,7 @@ sub mutilate_replace_file
open(my $fh, '>', $pathname) || die "open $pathname: $!";
print $fh 'q' x length($contents);
close($fh);
+ return;
}
# Corrupt the backup manifest.
@@ -216,6 +224,7 @@ sub mutilate_bad_manifest
{
my ($backup_path) = @_;
append_to_file "$backup_path/backup_manifest", "\n";
+ return;
}
# Create a file that can't be opened. (This is skipped on Windows.)
@@ -224,6 +233,7 @@ sub mutilate_open_file_fails
my ($backup_path) = @_;
my $pathname = "$backup_path/PG_VERSION";
chmod(0, $pathname) || die "chmod $pathname: $!";
+ return;
}
# Create a directory that can't be opened. (This is skipped on Windows.)
@@ -232,6 +242,7 @@ sub mutilate_open_directory_fails
my ($backup_path) = @_;
my $pathname = "$backup_path/pg_subtrans";
chmod(0, $pathname) || die "chmod $pathname: $!";
+ return;
}
# Create a directory that can't be searched. (This is skipped on Windows.)
@@ -240,6 +251,7 @@ sub mutilate_search_directory_fails
my ($backup_path) = @_;
my $pathname = "$backup_path/base";
chmod(0400, $pathname) || die "chmod $pathname: $!";
+ return;
}
# rmtree can't cope with a mode 400 directory, so change back to 700.
@@ -248,4 +260,5 @@ sub cleanup_search_directory_fails
my ($backup_path) = @_;
my $pathname = "$backup_path/base";
chmod(0700, $pathname) || die "chmod $pathname: $!";
+ return;
}
diff --git a/src/bin/pg_validatebackup/t/005_bad_manifest.pl b/src/bin/pg_validatebackup/t/005_bad_manifest.pl
index 8f2a486c83c..f52a8b71ea9 100644
--- a/src/bin/pg_validatebackup/t/005_bad_manifest.pl
+++ b/src/bin/pg_validatebackup/t/005_bad_manifest.pl
@@ -177,6 +177,7 @@ sub test_parse_error
test_bad_manifest($test_name,
qr/could not parse backup manifest: $test_name/,
$manifest_contents);
+ return;
}
sub test_fatal_error
@@ -186,6 +187,7 @@ sub test_fatal_error
test_bad_manifest($test_name,
qr/fatal: $test_name/,
$manifest_contents);
+ return;
}
sub test_bad_manifest
@@ -198,4 +200,5 @@ sub test_bad_manifest
command_fails_like(['pg_validatebackup', $tempdir], $regexp,
$test_name);
+ return;
}