1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-30 19:23:04 +03:00

Add support for testing on 64-bit big-endian architectures.

In particular add support for s390x but we hope this will work for other 64-bit big-endian architectures.

Run basic unit tests on Travis CI for 390x.
This commit is contained in:
David Steele
2020-07-20 09:59:16 -04:00
parent 55277357b8
commit 3f0b41eb9c
5 changed files with 19 additions and 4 deletions

View File

@ -60,6 +60,13 @@ jobs:
- PGB_CI="test --vm=none --param=no-coverage --param=module=command --param=module=storage" - PGB_CI="test --vm=none --param=no-coverage --param=module=command --param=module=storage"
services: services:
# Basic unit tests only. Coverage testing is also disabled to save time.
- arch: s390x
dist: bionic
env:
- PGB_CI="test --vm=none --param=no-coverage --param=module=command --param=module=storage"
services:
install: install:
- umask 0022 && cd ~ && pwd && whoami && umask && groups - umask 0022 && cd ~ && pwd && whoami && umask && groups
- df -Th && top -bn1 - df -Th && top -bn1

View File

@ -376,4 +376,9 @@ Is this a 64-bit system? If not then it is 32-bit since 16-bit systems are not
#define TEST_64BIT() \ #define TEST_64BIT() \
(sizeof(size_t) == 8) (sizeof(size_t) == 8)
/***********************************************************************************************************************************
Is this a big-endian system?
***********************************************************************************************************************************/
#define TEST_BIG_ENDIAN() (!*(unsigned char *)&(uint16_t){1})
#endif #endif

View File

@ -264,7 +264,8 @@ testRun(void)
// Check sha1 checksum against fixed values once to make sure they are not getting munged. After this we'll calculate them // Check sha1 checksum against fixed values once to make sure they are not getting munged. After this we'll calculate them
// directly from the buffers to reduce the cost of maintaining checksums. // directly from the buffers to reduce the cost of maintaining checksums.
const char *walBuffer1Sha1 = TEST_64BIT() ? const char *walBuffer1Sha1 = TEST_64BIT() ?
"aae7591a1dbc58f21d0d004886075094f622e6dd" : "28a13fd8cf6fcd9f9a8108aed4c8bcc58040863a"; (TEST_BIG_ENDIAN() ? "1c5f963d720bb199d7935dbd315447ea2ec3feb2" : "aae7591a1dbc58f21d0d004886075094f622e6dd") :
"28a13fd8cf6fcd9f9a8108aed4c8bcc58040863a";
storagePutP(storageNewWriteP(storagePgWrite(), strNew("pg_wal/000000010000000100000001")), walBuffer1); storagePutP(storageNewWriteP(storagePgWrite(), strNew("pg_wal/000000010000000100000001")), walBuffer1);

View File

@ -1487,7 +1487,9 @@ testRun(void)
"P01 INFO: backup file {[path]}/pg1/postgresql.conf (11B, 100%%) checksum e3db315c260e79211b7b52587123b7aa060f30ab\n" "P01 INFO: backup file {[path]}/pg1/postgresql.conf (11B, 100%%) checksum e3db315c260e79211b7b52587123b7aa060f30ab\n"
"P00 INFO: full backup size = 8KB\n" "P00 INFO: full backup size = 8KB\n"
"P00 INFO: new backup label = [FULL-1]", "P00 INFO: new backup label = [FULL-1]",
TEST_64BIT() ? "21e2ddc99cdf4cfca272eee4f38891146092e358" : "8bb70506d988a8698d9e8cf90736ada23634571b"); TEST_64BIT() ?
(TEST_BIG_ENDIAN() ? "749acedef8f8d5fe35fc20c0375657f876ccc38e" : "21e2ddc99cdf4cfca272eee4f38891146092e358") :
"8bb70506d988a8698d9e8cf90736ada23634571b");
// Make pg no longer appear to be running // Make pg no longer appear to be running
storageRemoveP(storagePgWrite(), PG_FILE_POSTMASTERPID_STR, .errorOnMissing = true); storageRemoveP(storagePgWrite(), PG_FILE_POSTMASTERPID_STR, .errorOnMissing = true);

View File

@ -190,8 +190,8 @@ testRun(void)
unsigned char page[PG_PAGE_SIZE_DEFAULT]; unsigned char page[PG_PAGE_SIZE_DEFAULT];
memset(page, 0xFF, PG_PAGE_SIZE_DEFAULT); memset(page, 0xFF, PG_PAGE_SIZE_DEFAULT);
TEST_RESULT_UINT(pgPageChecksum(page, 0), 0x0E1C, "check 0xFF filled page, block 0"); TEST_RESULT_UINT(pgPageChecksum(page, 0), TEST_BIG_ENDIAN() ? 0xF55E : 0x0E1C, "check 0xFF filled page, block 0");
TEST_RESULT_UINT(pgPageChecksum(page, 999), 0x0EC3, "check 0xFF filled page, block 999"); TEST_RESULT_UINT(pgPageChecksum(page, 999), TEST_BIG_ENDIAN() ? 0xF1B9 : 0x0EC3, "check 0xFF filled page, block 999");
} }
// ***************************************************************************************************************************** // *****************************************************************************************************************************