Skip to content

Commit 87e3004

Browse files
committed
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 0d8c9c1. Per buildfarm.
1 parent 0d8c9c1 commit 87e3004

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/bin/pg_validatebackup/t/003_corruption.pl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,15 @@ sub create_extra_file
134134
open(my $fh, '>', $pathname) || die "open $pathname: $!";
135135
print $fh "This is an extra file.\n";
136136
close($fh);
137+
return;
137138
}
138139

139140
# Add a file into the root directory of the backup.
140141
sub mutilate_extra_file
141142
{
142143
my ($backup_path) = @_;
143144
create_extra_file($backup_path, "extra_file");
145+
return;
144146
}
145147

146148
# Add a file inside the user-defined tablespace.
@@ -155,6 +157,7 @@ sub mutilate_extra_tablespace_file
155157
slurp_dir("$backup_path/pg_tblspc/$tsoid/$catvdir");
156158
create_extra_file($backup_path,
157159
"pg_tblspc/$tsoid/$catvdir/$tsdboid/extra_ts_file");
160+
return;
158161
}
159162

160163
# Remove a file.
@@ -163,6 +166,7 @@ sub mutilate_missing_file
163166
my ($backup_path) = @_;
164167
my $pathname = "$backup_path/pg_xact/0000";
165168
unlink($pathname) || die "$pathname: $!";
169+
return;
166170
}
167171

168172
# Remove the symlink to the user-defined tablespace.
@@ -180,13 +184,15 @@ sub mutilate_missing_tablespace
180184
{
181185
unlink($pathname) || die "$pathname: $!";
182186
}
187+
return;
183188
}
184189

185190
# Append an additional bytes to a file.
186191
sub mutilate_append_to_file
187192
{
188193
my ($backup_path) = @_;
189194
append_to_file "$backup_path/global/pg_control", 'x';
195+
return;
190196
}
191197

192198
# Truncate a file to zero length.
@@ -196,6 +202,7 @@ sub mutilate_truncate_file
196202
my $pathname = "$backup_path/global/pg_control";
197203
open(my $fh, '>', $pathname) || die "open $pathname: $!";
198204
close($fh);
205+
return;
199206
}
200207

201208
# Replace a file's contents without changing the length of the file. This is
@@ -209,13 +216,15 @@ sub mutilate_replace_file
209216
open(my $fh, '>', $pathname) || die "open $pathname: $!";
210217
print $fh 'q' x length($contents);
211218
close($fh);
219+
return;
212220
}
213221

214222
# Corrupt the backup manifest.
215223
sub mutilate_bad_manifest
216224
{
217225
my ($backup_path) = @_;
218226
append_to_file "$backup_path/backup_manifest", "\n";
227+
return;
219228
}
220229

221230
# Create a file that can't be opened. (This is skipped on Windows.)
@@ -224,6 +233,7 @@ sub mutilate_open_file_fails
224233
my ($backup_path) = @_;
225234
my $pathname = "$backup_path/PG_VERSION";
226235
chmod(0, $pathname) || die "chmod $pathname: $!";
236+
return;
227237
}
228238

229239
# Create a directory that can't be opened. (This is skipped on Windows.)
@@ -232,6 +242,7 @@ sub mutilate_open_directory_fails
232242
my ($backup_path) = @_;
233243
my $pathname = "$backup_path/pg_subtrans";
234244
chmod(0, $pathname) || die "chmod $pathname: $!";
245+
return;
235246
}
236247

237248
# Create a directory that can't be searched. (This is skipped on Windows.)
@@ -240,6 +251,7 @@ sub mutilate_search_directory_fails
240251
my ($backup_path) = @_;
241252
my $pathname = "$backup_path/base";
242253
chmod(0400, $pathname) || die "chmod $pathname: $!";
254+
return;
243255
}
244256

245257
# rmtree can't cope with a mode 400 directory, so change back to 700.
@@ -248,4 +260,5 @@ sub cleanup_search_directory_fails
248260
my ($backup_path) = @_;
249261
my $pathname = "$backup_path/base";
250262
chmod(0700, $pathname) || die "chmod $pathname: $!";
263+
return;
251264
}

src/bin/pg_validatebackup/t/005_bad_manifest.pl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ sub test_parse_error
177177
test_bad_manifest($test_name,
178178
qr/could not parse backup manifest: $test_name/,
179179
$manifest_contents);
180+
return;
180181
}
181182

182183
sub test_fatal_error
@@ -186,6 +187,7 @@ sub test_fatal_error
186187
test_bad_manifest($test_name,
187188
qr/fatal: $test_name/,
188189
$manifest_contents);
190+
return;
189191
}
190192

191193
sub test_bad_manifest
@@ -198,4 +200,5 @@ sub test_bad_manifest
198200

199201
command_fails_like(['pg_validatebackup', $tempdir], $regexp,
200202
$test_name);
203+
return;
201204
}

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