Skip to content

Commit a916bdc

Browse files
committed
Fix some issues with TAP tests of pg_basebackup and pg_verify_checksums
ee9e145 has fixed the tests of pg_basebackup for checksums a first time, still one seek() call missed the shot. Also, the data written in files to emulate corruptions was not actually writing zeros as the quoting style was incorrect. Backpatch the portion for pg_basebackup to v11 where these tests have been introduced. The tests of pg_verify_checksums are new as of v12. Author: Michael Banck Discussion: https://postgr.es/m/1550153276.796.35.camel@credativ.de Backpatch-through: 11
1 parent f0cce9f commit a916bdc

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/bin/pg_basebackup/t/010_pg_basebackup.pl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@
499499
system_or_bail 'pg_ctl', '-D', $pgdata, 'stop';
500500
open $file, '+<', "$pgdata/$file_corrupt1";
501501
seek($file, $pageheader_size, 0);
502-
syswrite($file, '\0\0\0\0\0\0\0\0\0');
502+
syswrite($file, "\0\0\0\0\0\0\0\0\0");
503503
close $file;
504504
system_or_bail 'pg_ctl', '-D', $pgdata, 'start';
505505

@@ -518,7 +518,7 @@
518518
{
519519
my $offset = $pageheader_size + $i * $block_size;
520520
seek($file, $offset, 0);
521-
syswrite($file, '\0\0\0\0\0\0\0\0\0');
521+
syswrite($file, "\0\0\0\0\0\0\0\0\0");
522522
}
523523
close $file;
524524
system_or_bail 'pg_ctl', '-D', $pgdata, 'start';
@@ -534,8 +534,8 @@
534534
# induce corruption in a second file
535535
system_or_bail 'pg_ctl', '-D', $pgdata, 'stop';
536536
open $file, '+<', "$pgdata/$file_corrupt2";
537-
seek($file, 4000, 0);
538-
syswrite($file, '\0\0\0\0\0\0\0\0\0');
537+
seek($file, $pageheader_size, 0);
538+
syswrite($file, "\0\0\0\0\0\0\0\0\0");
539539
close $file;
540540
system_or_bail 'pg_ctl', '-D', $pgdata, 'start';
541541

src/bin/pg_verify_checksums/t/002_actions.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ sub check_relation_corruption
4545
# Time to create some corruption
4646
open my $file, '+<', "$pgdata/$file_corrupted";
4747
seek($file, $pageheader_size, 0);
48-
syswrite($file, '\0\0\0\0\0\0\0\0\0');
48+
syswrite($file, "\0\0\0\0\0\0\0\0\0");
4949
close $file;
5050

5151
# Checksum checks on single relfilenode fail

0 commit comments

Comments
 (0)