From 024500782e9fde91cf236db70a584beb52586d38 Mon Sep 17 00:00:00 2001 From: David Steele Date: Thu, 12 May 2022 17:02:08 -0400 Subject: [PATCH] Reduce encrypted WAL segments sizes in command tests. The encrypted archive-push and repo tests were running very slowly on 32-bit with Valgrind enabled. This appears to be an issue with a newer version of Valgrind, but it has been going on long enough that bisecting does not seem to be worthwhile. Reduce the size of the encrypted test segments where possible to improve overall test performance. --- test/src/module/command/archivePushTest.c | 8 ++++++++ test/src/module/command/repoTest.c | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/test/src/module/command/archivePushTest.c b/test/src/module/command/archivePushTest.c index 0c41090b9..b563687c6 100644 --- a/test/src/module/command/archivePushTest.c +++ b/test/src/module/command/archivePushTest.c @@ -459,6 +459,14 @@ testRun(void) // Remove old repo HRN_STORAGE_PATH_REMOVE(storageTest, "repo", .errorOnMissing = true, .recurse = true); + // Create an artificially small WAL file to save time on encryption + walBuffer2 = bufNew(1024); + bufUsedSet(walBuffer2, bufSize(walBuffer2)); + memset(bufPtr(walBuffer2), 0xFF, bufSize(walBuffer2)); + hrnPgWalToBuffer((PgWal){.version = PG_VERSION_11}, walBuffer2); + walBuffer2Sha1 = strZ(bufHex(cryptoHashOne(HASH_TYPE_SHA1_STR, walBuffer2))); + HRN_STORAGE_PUT(storageTest, "pg/pg_wal/000000010000000100000002", walBuffer2, .comment = "write WAL"); + argListTemp = strLstNew(); hrnCfgArgRawZ(argListTemp, cfgOptStanza, "test"); hrnCfgArgKeyRawZ(argListTemp, cfgOptPgPath, 1, TEST_PATH "/pg"); diff --git a/test/src/module/command/repoTest.c b/test/src/module/command/repoTest.c index 8a22037ab..a90008209 100644 --- a/test/src/module/command/repoTest.c +++ b/test/src/module/command/repoTest.c @@ -436,9 +436,9 @@ testRun(void) // ------------------------------------------------------------------------------------------------------------------------- TEST_TITLE("put encrypted WAL archive file"); - // Create WAL segment + // Create WAL segment. Keep it small since encryption/decryption takes time (esp on 32-bit). ioBufferSizeSet(oldBufferSize); - Buffer *archiveFileBuffer = bufNew(16 * 1024 * 1024); + Buffer *archiveFileBuffer = bufNew(1024); memset(bufPtr(archiveFileBuffer), 0, bufSize(archiveFileBuffer)); bufUsedSet(archiveFileBuffer, bufSize(archiveFileBuffer));