From c75a623304bc361b4456f916d455ea175ffd8055 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 22 Mar 2023 17:14:21 -0400 Subject: [PATCH] Fix new test case to work on (some?) big-endian architectures. Use of pack("L") gets around the basic endian problem, but it doesn't deal with the fact that the order of the bitfields within the struct may differ. This patch fixes it to work with gcc on NetBSD/macppc, but I wonder whether that will be enough --- in principle, there could be four different combinations of bitpatterns needed here. Discussion: https://postgr.es/m/1650745.1679513221@sss.pgh.pa.us --- src/bin/pg_amcheck/t/004_verify_heapam.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/pg_amcheck/t/004_verify_heapam.pl b/src/bin/pg_amcheck/t/004_verify_heapam.pl index 92898c2a63..cc4aa4af87 100644 --- a/src/bin/pg_amcheck/t/004_verify_heapam.pl +++ b/src/bin/pg_amcheck/t/004_verify_heapam.pl @@ -630,7 +630,7 @@ for (my $tupidx = 0; $tupidx < $ROWCOUNT; $tupidx++) die "offnum $offnum should be a redirect" if defined $tup; sysseek($file, 92, 0) or BAIL_OUT("sysseek failed: $!"); syswrite($file, - pack("L", $ENDIANNESS eq 'little' ? 0x00010011 : 0x11000100)) + pack("L", $ENDIANNESS eq 'little' ? 0x00010011 : 0x00230000)) or BAIL_OUT("syswrite failed: $!"); push @expected, qr/${header}redirected line pointer points to another redirected line pointer at offset \d+/; @@ -647,7 +647,7 @@ for (my $tupidx = 0; $tupidx < $ROWCOUNT; $tupidx++) # rewrite line pointer with lp.off = 25, lp_flags = 2, lp_len = 0 sysseek($file, 108, 0) or BAIL_OUT("sysseek failed: $!"); syswrite($file, - pack("L", $ENDIANNESS eq 'little' ? 0x00010019 : 0x19000100)) + pack("L", $ENDIANNESS eq 'little' ? 0x00010019 : 0x00330000)) or BAIL_OUT("syswrite failed: $!"); push @expected, qr/${header}redirect line pointer points to offset \d+, but offset \d+ also points there/;