summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2019-02-18 14:23:30 +0900
committerMichael Paquier <michael@paquier.xyz>2019-02-18 14:23:30 +0900
commita916bdc496a9d3fde48ca7c72478e7e4aecc5597 (patch)
treea57451b11ccb3dd3914b386037120ca088487819 /src
parentf0cce9fcb5fd9f4158dbf5dfe11f263ad3b7b1dd (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_basebackup/t/010_pg_basebackup.pl8
-rw-r--r--src/bin/pg_verify_checksums/t/002_actions.pl2
2 files changed, 5 insertions, 5 deletions
diff --git a/src/bin/pg_basebackup/t/010_pg_basebackup.pl b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
index 3e1c3863c4f..33869fecc97 100644
--- a/src/bin/pg_basebackup/t/010_pg_basebackup.pl
+++ b/src/bin/pg_basebackup/t/010_pg_basebackup.pl
@@ -499,7 +499,7 @@ my $block_size = $node->safe_psql('postgres', 'SHOW block_size;');
system_or_bail 'pg_ctl', '-D', $pgdata, 'stop';
open $file, '+<', "$pgdata/$file_corrupt1";
seek($file, $pageheader_size, 0);
-syswrite($file, '\0\0\0\0\0\0\0\0\0');
+syswrite($file, "\0\0\0\0\0\0\0\0\0");
close $file;
system_or_bail 'pg_ctl', '-D', $pgdata, 'start';
@@ -518,7 +518,7 @@ for my $i (1 .. 5)
{
my $offset = $pageheader_size + $i * $block_size;
seek($file, $offset, 0);
- syswrite($file, '\0\0\0\0\0\0\0\0\0');
+ syswrite($file, "\0\0\0\0\0\0\0\0\0");
}
close $file;
system_or_bail 'pg_ctl', '-D', $pgdata, 'start';
@@ -534,8 +534,8 @@ rmtree("$tempdir/backup_corrupt2");
# induce corruption in a second file
system_or_bail 'pg_ctl', '-D', $pgdata, 'stop';
open $file, '+<', "$pgdata/$file_corrupt2";
-seek($file, 4000, 0);
-syswrite($file, '\0\0\0\0\0\0\0\0\0');
+seek($file, $pageheader_size, 0);
+syswrite($file, "\0\0\0\0\0\0\0\0\0");
close $file;
system_or_bail 'pg_ctl', '-D', $pgdata, 'start';
diff --git a/src/bin/pg_verify_checksums/t/002_actions.pl b/src/bin/pg_verify_checksums/t/002_actions.pl
index 5250b5a7286..74ad5ad7235 100644
--- a/src/bin/pg_verify_checksums/t/002_actions.pl
+++ b/src/bin/pg_verify_checksums/t/002_actions.pl
@@ -45,7 +45,7 @@ sub check_relation_corruption
# Time to create some corruption
open my $file, '+<', "$pgdata/$file_corrupted";
seek($file, $pageheader_size, 0);
- syswrite($file, '\0\0\0\0\0\0\0\0\0');
+ syswrite($file, "\0\0\0\0\0\0\0\0\0");
close $file;
# Checksum checks on single relfilenode fail