diff --git a/test/src/common/harnessTest.c b/test/src/common/harnessTest.c index 7f80ec813..a50878de5 100644 --- a/test/src/common/harnessTest.c +++ b/test/src/common/harnessTest.c @@ -650,6 +650,19 @@ void hrnTestResultPtr(const void *actual, const void *expected, HarnessTestResul hrnTestResultEnd(); } +void +hrnTestResultStringList(const StringList *actual, const void *expected, HarnessTestResultOperation operation) +{ + // Return NULL if list is empty + if (strLstSize(actual) == 0) + { + hrnTestResultZ(NULL, expected, operation); + return; + } + + hrnTestResultZ(strZ(strCatZ(strLstJoin(actual, "\n"), "\n")), expected, operation); +} + void hrnTestResultUInt64(uint64_t actual, uint64_t expected, HarnessTestResultOperation operation) { ASSERT(harnessTestLocal.result.running); diff --git a/test/src/common/harnessTest.h b/test/src/common/harnessTest.h index 1eaeb5995..d37682181 100644 --- a/test/src/common/harnessTest.h +++ b/test/src/common/harnessTest.h @@ -247,6 +247,19 @@ Macros to compare results of common data types #define TEST_RESULT_Z_STR(statement, resultExpected, ...) \ TEST_RESULT_Z(statement, strZNull(resultExpected), __VA_ARGS__); +// Compare a string list to a \n delimited string +#define TEST_RESULT_STRLST_Z(statement, resultExpected, ...) \ + do \ + { \ + TEST_RESULT_INFO(__VA_ARGS__); \ + hrnTestResultBegin(#statement, __LINE__, true); \ + hrnTestResultStringList(statement, resultExpected, harnessTestResultOperationEq); \ + } \ + while (0) + +#define TEST_RESULT_STRLST_STR(statement, resultExpected, ...) \ + TEST_RESULT_STRLST_Z(statement, strZNull(resultExpected), __VA_ARGS__); + #define TEST_RESULT_UINT_PARAM(statement, expected, operation, ...) \ do \ { \ diff --git a/test/src/common/harnessTest.intern.h b/test/src/common/harnessTest.intern.h index beb27f214..233d89102 100644 --- a/test/src/common/harnessTest.intern.h +++ b/test/src/common/harnessTest.intern.h @@ -6,6 +6,8 @@ C Test Harness Internal #include +#include "common/type/stringList.h" + #include "common/harnessTest.h" /*********************************************************************************************************************************** @@ -42,6 +44,7 @@ void hrnTestResultBool(int actual, int expected); void hrnTestResultDouble(double actual, double expected); void hrnTestResultInt64(int64_t actual, int64_t expected, HarnessTestResultOperation operation); void hrnTestResultPtr(const void *actual, const void *expected, HarnessTestResultOperation operation); +void hrnTestResultStringList(const StringList *actual, const void *expected, HarnessTestResultOperation operation); void hrnTestResultUInt64(uint64_t actual, uint64_t expected, HarnessTestResultOperation operation); void hrnTestResultUInt64Int64(uint64_t actual, int64_t expected, HarnessTestResultOperation operation); void hrnTestResultZ(const char *actual, const char *expected, HarnessTestResultOperation operation); diff --git a/test/src/module/command/archiveCommonTest.c b/test/src/module/command/archiveCommonTest.c index 339b5647a..3dedcd488 100644 --- a/test/src/module/command/archiveCommonTest.c +++ b/test/src/module/command/archiveCommonTest.c @@ -313,25 +313,25 @@ testRun(void) // ***************************************************************************************************************************** if (testBegin("walSegmentRange()")) { - TEST_RESULT_STR_Z( - strLstJoin(walSegmentRange(strNew("000000010000000100000000"), 16 * 1024 * 1024, PG_VERSION_92, 1), "|"), - "000000010000000100000000", "get single"); - TEST_RESULT_STR_Z( - strLstJoin(walSegmentRange(strNew("0000000100000001000000FD"), 16 * 1024 * 1024, PG_VERSION_92, 4), "|"), - "0000000100000001000000FD|0000000100000001000000FE|000000010000000200000000|000000010000000200000001", + TEST_RESULT_STRLST_Z( + walSegmentRange(strNew("000000010000000100000000"), 16 * 1024 * 1024, PG_VERSION_92, 1), "000000010000000100000000\n", + "get single"); + TEST_RESULT_STRLST_Z( + walSegmentRange(strNew("0000000100000001000000FD"), 16 * 1024 * 1024, PG_VERSION_92, 4), + "0000000100000001000000FD\n0000000100000001000000FE\n000000010000000200000000\n000000010000000200000001\n", "get range < 9.3"); - TEST_RESULT_STR_Z( - strLstJoin(walSegmentRange(strNew("0000000100000001000000FD"), 16 * 1024 * 1024, PG_VERSION_93, 4), "|"), - "0000000100000001000000FD|0000000100000001000000FE|0000000100000001000000FF|000000010000000200000000", + TEST_RESULT_STRLST_Z( + walSegmentRange(strNew("0000000100000001000000FD"), 16 * 1024 * 1024, PG_VERSION_93, 4), + "0000000100000001000000FD\n0000000100000001000000FE\n0000000100000001000000FF\n000000010000000200000000\n", "get range >= 9.3"); - TEST_RESULT_STR_Z( - strLstJoin(walSegmentRange(strNew("000000080000000A00000000"), 1024 * 1024 * 1024, PG_VERSION_11, 8), "|"), - "000000080000000A00000000|000000080000000A00000001|000000080000000A00000002|000000080000000A00000003|" - "000000080000000B00000000|000000080000000B00000001|000000080000000B00000002|000000080000000B00000003", + TEST_RESULT_STRLST_Z( + walSegmentRange(strNew("000000080000000A00000000"), 1024 * 1024 * 1024, PG_VERSION_11, 8), + "000000080000000A00000000\n000000080000000A00000001\n000000080000000A00000002\n000000080000000A00000003\n" + "000000080000000B00000000\n000000080000000B00000001\n000000080000000B00000002\n000000080000000B00000003\n", "get range >= 11/1GB"); - TEST_RESULT_STR_Z( - strLstJoin(walSegmentRange(strNew("000000070000000700000FFE"), 1024 * 1024, PG_VERSION_11, 4), "|"), - "000000070000000700000FFE|000000070000000700000FFF|000000070000000800000000|000000070000000800000001", + TEST_RESULT_STRLST_Z( + walSegmentRange(strNew("000000070000000700000FFE"), 1024 * 1024, PG_VERSION_11, 4), + "000000070000000700000FFE\n000000070000000700000FFF\n000000070000000800000000\n000000070000000800000001\n", "get range >= 11/1MB"); } @@ -347,10 +347,10 @@ testRun(void) strLstAddZ(list, "11-10"); strLstAddZ(list, "9.6-1"); - TEST_RESULT_STR_Z(strLstJoin(strLstSort(list, sortOrderAsc), ", "), "9.6-1, 10-4, 11-10", "sort ascending"); + TEST_RESULT_STRLST_Z(strLstSort(list, sortOrderAsc), "9.6-1\n10-4\n11-10\n", "sort ascending"); strLstAddZ(list, "9.4-2"); - TEST_RESULT_STR_Z(strLstJoin(strLstSort(list, sortOrderDesc), ", "), "11-10, 10-4, 9.4-2, 9.6-1", "sort descending"); + TEST_RESULT_STRLST_Z(strLstSort(list, sortOrderDesc), "11-10\n10-4\n9.4-2\n9.6-1\n", "sort descending"); } FUNCTION_HARNESS_RESULT_VOID(); diff --git a/test/src/module/command/archiveGetTest.c b/test/src/module/command/archiveGetTest.c index 292f01982..409c5d87d 100644 --- a/test/src/module/command/archiveGetTest.c +++ b/test/src/module/command/archiveGetTest.c @@ -263,16 +263,16 @@ testRun(void) // ------------------------------------------------------------------------------------------------------------------------- storagePathCreateP(storageSpoolWrite(), strNew(STORAGE_SPOOL_ARCHIVE_IN)); - TEST_RESULT_STR_Z( - strLstJoin(queueNeed(strNew("000000010000000100000001"), false, queueSize, walSegmentSize, PG_VERSION_92), "|"), - "000000010000000100000001|000000010000000100000002", "queue size smaller than min"); + TEST_RESULT_STRLST_Z( + queueNeed(STRDEF("000000010000000100000001"), false, queueSize, walSegmentSize, PG_VERSION_92), + "000000010000000100000001\n000000010000000100000002\n", "queue size smaller than min"); // ------------------------------------------------------------------------------------------------------------------------- queueSize = (16 * 1024 * 1024) * 3; - TEST_RESULT_STR_Z( - strLstJoin(queueNeed(strNew("000000010000000100000001"), false, queueSize, walSegmentSize, PG_VERSION_92), "|"), - "000000010000000100000001|000000010000000100000002|000000010000000100000003", "empty queue"); + TEST_RESULT_STRLST_Z( + queueNeed(strNew("000000010000000100000001"), false, queueSize, walSegmentSize, PG_VERSION_92), + "000000010000000100000001\n000000010000000100000002\n000000010000000100000003\n", "empty queue"); // ------------------------------------------------------------------------------------------------------------------------- Buffer *walSegmentBuffer = bufNew(walSegmentSize); @@ -285,13 +285,12 @@ testRun(void) storageNewWriteP( storageSpoolWrite(), strNew(STORAGE_SPOOL_ARCHIVE_IN "/0000000100000001000000FF")), walSegmentBuffer); - TEST_RESULT_STR_Z( - strLstJoin(queueNeed(strNew("0000000100000001000000FE"), false, queueSize, walSegmentSize, PG_VERSION_92), "|"), - "000000010000000200000000|000000010000000200000001", "queue has wal < 9.3"); + TEST_RESULT_STRLST_Z( + queueNeed(strNew("0000000100000001000000FE"), false, queueSize, walSegmentSize, PG_VERSION_92), + "000000010000000200000000\n000000010000000200000001\n", "queue has wal < 9.3"); - TEST_RESULT_STR_Z( - strLstJoin(storageListP(storageSpoolWrite(), strNew(STORAGE_SPOOL_ARCHIVE_IN)), "|"), "0000000100000001000000FE", - "check queue"); + TEST_RESULT_STRLST_Z( + storageListP(storageSpoolWrite(), strNew(STORAGE_SPOOL_ARCHIVE_IN)), "0000000100000001000000FE\n", "check queue"); // ------------------------------------------------------------------------------------------------------------------------- walSegmentSize = 1024 * 1024; @@ -305,13 +304,13 @@ testRun(void) storageNewWriteP( storageSpoolWrite(), strNew(STORAGE_SPOOL_ARCHIVE_IN "/000000010000000A00000FFF")), walSegmentBuffer); - TEST_RESULT_STR_Z( - strLstJoin(queueNeed(strNew("000000010000000A00000FFD"), true, queueSize, walSegmentSize, PG_VERSION_11), "|"), - "000000010000000B00000000|000000010000000B00000001|000000010000000B00000002", "queue has wal >= 9.3"); + TEST_RESULT_STRLST_Z( + queueNeed(strNew("000000010000000A00000FFD"), true, queueSize, walSegmentSize, PG_VERSION_11), + "000000010000000B00000000\n000000010000000B00000001\n000000010000000B00000002\n", "queue has wal >= 9.3"); - TEST_RESULT_STR_Z( - strLstJoin(strLstSort(storageListP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_IN)), sortOrderAsc), "|"), - "000000010000000A00000FFE|000000010000000A00000FFF", "check queue"); + TEST_RESULT_STRLST_Z( + strLstSort(storageListP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_IN)), sortOrderAsc), + "000000010000000A00000FFE\n000000010000000A00000FFF\n", "check queue"); } diff --git a/test/src/module/command/archivePushTest.c b/test/src/module/command/archivePushTest.c index 119a73a88..eae1a93bf 100644 --- a/test/src/module/command/archivePushTest.c +++ b/test/src/module/command/archivePushTest.c @@ -67,13 +67,13 @@ testRun(void) storagePutP(storageNewWriteP(storagePgWrite(), strNew("pg_wal/archive_status/000000010000000100000005.ready")), NULL); storagePutP(storageNewWriteP(storagePgWrite(), strNew("pg_wal/archive_status/000000010000000100000006.ready")), NULL); - TEST_RESULT_STR_Z( - strLstJoin(archivePushProcessList(strNewFmt("%s/db/pg_wal", testPath())), "|"), - "000000010000000100000002|000000010000000100000005|000000010000000100000006", "ready list"); + TEST_RESULT_STRLST_Z( + archivePushProcessList(strNewFmt("%s/db/pg_wal", testPath())), + "000000010000000100000002\n000000010000000100000005\n000000010000000100000006\n", "ready list"); - TEST_RESULT_STR_Z( - strLstJoin(strLstSort(storageListP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_OUT)), sortOrderAsc), "|"), - "000000010000000100000003.ok", "remaining status list"); + TEST_RESULT_STRLST_Z( + strLstSort(storageListP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_OUT)), sortOrderAsc), + "000000010000000100000003.ok\n", "remaining status list"); // Test drop // ------------------------------------------------------------------------------------------------------------------------- @@ -633,9 +633,9 @@ testRun(void) strNewBuf(storageGetP(storageNewReadP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_OUT "/global.error")))), "25\nno WAL files to process", "check global.error"); - TEST_RESULT_STR_Z( - strLstJoin(strLstSort(storageListP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_OUT)), sortOrderAsc), "|"), - "global.error", "check status files"); + TEST_RESULT_STRLST_Z( + strLstSort(storageListP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_OUT)), sortOrderAsc), + "global.error\n", "check status files"); // ------------------------------------------------------------------------------------------------------------------------- TEST_TITLE("push already pushed WAL and error on missing WAL"); @@ -663,9 +663,9 @@ testRun(void) storageTest, strNewFmt("repo/archive/test/9.4-1/0000000100000001/000000010000000100000001-%s", walBuffer1Sha1)), true, "check repo for WAL 1 file"); - TEST_RESULT_STR_Z( - strLstJoin(strLstSort(storageListP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_OUT)), sortOrderAsc), "|"), - "000000010000000100000001.ok|000000010000000100000002.error", "check status files"); + TEST_RESULT_STRLST_Z( + strLstSort(storageListP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_OUT)), sortOrderAsc), + "000000010000000100000001.ok\n000000010000000100000002.error\n", "check status files"); // ------------------------------------------------------------------------------------------------------------------------- TEST_TITLE("create and push previously missing WAL"); @@ -693,9 +693,9 @@ testRun(void) storageTest, strNewFmt("repo/archive/test/9.4-1/0000000100000001/000000010000000100000002-%s", walBuffer2Sha1)), true, "check repo for WAL 2 file"); - TEST_RESULT_STR_Z( - strLstJoin(strLstSort(storageListP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_OUT)), sortOrderAsc), "|"), - "000000010000000100000001.ok|000000010000000100000002.ok", "check status files"); + TEST_RESULT_STRLST_Z( + strLstSort(storageListP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_OUT)), sortOrderAsc), + "000000010000000100000001.ok\n000000010000000100000002.ok\n", "check status files"); // Check that drop functionality works // ------------------------------------------------------------------------------------------------------------------------- @@ -723,9 +723,9 @@ testRun(void) storageGetP(storageNewReadP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_OUT "/000000010000000100000002.ok")))), "0\ndropped WAL file '000000010000000100000002' because archive queue exceeded 16MB", "check WAL 2 warning"); - TEST_RESULT_STR_Z( - strLstJoin(strLstSort(storageListP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_OUT)), sortOrderAsc), "|"), - "000000010000000100000001.ok|000000010000000100000002.ok", "check status files"); + TEST_RESULT_STRLST_Z( + strLstSort(storageListP(storageSpool(), strNew(STORAGE_SPOOL_ARCHIVE_OUT)), sortOrderAsc), + "000000010000000100000001.ok\n000000010000000100000002.ok\n", "check status files"); } FUNCTION_HARNESS_RESULT_VOID(); diff --git a/test/src/module/command/expireTest.c b/test/src/module/command/expireTest.c index e4710f492..f6f51e727 100644 --- a/test/src/module/command/expireTest.c +++ b/test/src/module/command/expireTest.c @@ -54,10 +54,7 @@ archiveExpectList(const unsigned int start, unsigned int end, const char *majorW else wal = strNewFmt("%s000000%u-9baedd24b61aa15305732ac678c4e2c102435a09", majorWal, i); - if (strSize(result) == 0) - strCat(result, wal); - else - strCatFmt(result, ", %s", strZ(wal)); + strCatFmt(result, "%s\n", strZ(wal)); } return result; @@ -201,9 +198,9 @@ testRun(void) TEST_RESULT_VOID(expireBackup(infoBackup, full2), "expire backup with no manifest - does not error"); - TEST_RESULT_STR_Z( - strLstJoin(infoBackupDataLabelList(infoBackup, NULL), ", "), - "20181119-152900F, 20181119-152900F_20181119-152600D", + TEST_RESULT_STRLST_Z( + infoBackupDataLabelList(infoBackup, NULL), + "20181119-152900F\n20181119-152900F_20181119-152600D\n", "only backups in set passed to expireBackup are removed from backup:current (result is sorted)"); } @@ -236,10 +233,10 @@ testRun(void) TEST_RESULT_UINT(expireFullBackup(infoBackup), 1, "retention-full=2 - one full backup expired"); TEST_RESULT_UINT(infoBackupDataTotal(infoBackup), 5, "current backups reduced by 1 full - no dependencies"); - TEST_RESULT_STR_Z( - strLstJoin(infoBackupDataLabelList(infoBackup, NULL), ", "), - "20181119-152800F, 20181119-152800F_20181119-152152D, 20181119-152800F_20181119-152155I" - ", 20181119-152900F, 20181119-152900F_20181119-152600D", + TEST_RESULT_STRLST_Z( + infoBackupDataLabelList(infoBackup, NULL), + "20181119-152800F\n20181119-152800F_20181119-152152D\n20181119-152800F_20181119-152155I\n20181119-152900F\n" + "20181119-152900F_20181119-152600D\n", "remaining backups correct"); harnessLogResult("P00 INFO: expire full backup 20181119-152138F"); @@ -252,8 +249,8 @@ testRun(void) TEST_RESULT_UINT(expireFullBackup(infoBackup), 3, "retention-full=1 - one full backup and dependencies expired"); TEST_RESULT_UINT(infoBackupDataTotal(infoBackup), 2, "current backups reduced by 1 full and dependencies"); - TEST_RESULT_STR_Z( - strLstJoin(infoBackupDataLabelList(infoBackup, NULL), ", "), "20181119-152900F, 20181119-152900F_20181119-152600D", + TEST_RESULT_STRLST_Z( + infoBackupDataLabelList(infoBackup, NULL), "20181119-152900F\n20181119-152900F_20181119-152600D\n", "remaining backups correct"); harnessLogResult( "P00 INFO: expire full backup set: 20181119-152800F, 20181119-152800F_20181119-152152D, " @@ -263,8 +260,8 @@ testRun(void) TEST_TITLE("retention-full set - no backups expired"); TEST_RESULT_UINT(expireFullBackup(infoBackup), 0, "retention-full=1 - not enough backups to expire any"); - TEST_RESULT_STR_Z( - strLstJoin(infoBackupDataLabelList(infoBackup, NULL), ", "), "20181119-152900F, 20181119-152900F_20181119-152600D", + TEST_RESULT_STRLST_Z( + infoBackupDataLabelList(infoBackup, NULL), "20181119-152900F\n20181119-152900F_20181119-152600D\n", " remaining backups correct"); } @@ -304,9 +301,9 @@ testRun(void) TEST_RESULT_UINT(expireDiffBackup(infoBackup), 2, "retention-diff=2 - full considered in diff"); TEST_RESULT_UINT(infoBackupDataTotal(infoBackup), 4, "current backups reduced by 1 diff and dependent increment"); - TEST_RESULT_STR_Z( - strLstJoin(infoBackupDataLabelList(infoBackup, NULL), ", "), - "20181119-152138F, 20181119-152800F, 20181119-152900F, 20181119-152900F_20181119-152600D", + TEST_RESULT_STRLST_Z( + infoBackupDataLabelList(infoBackup, NULL), + "20181119-152138F\n20181119-152800F\n20181119-152900F\n20181119-152900F_20181119-152600D\n", "remaining backups correct"); harnessLogResult( "P00 INFO: expire diff backup set: 20181119-152800F_20181119-152152D, 20181119-152800F_20181119-152155I"); @@ -321,9 +318,9 @@ testRun(void) TEST_ASSIGN(infoBackup, infoBackupNewLoad(ioBufferReadNew(backupInfoBase)), "get backup.info"); TEST_RESULT_UINT(expireDiffBackup(infoBackup), 2, "retention-diff set to 1 - full considered in diff"); - TEST_RESULT_STR_Z( - strLstJoin(infoBackupDataLabelList(infoBackup, NULL), ", "), - "20181119-152138F, 20181119-152800F, 20181119-152900F, 20181119-152900F_20181119-152600D", + TEST_RESULT_STRLST_Z( + infoBackupDataLabelList(infoBackup, NULL), + "20181119-152138F\n20181119-152800F\n20181119-152900F\n20181119-152900F_20181119-152600D\n", " remaining backups correct"); harnessLogResult( "P00 INFO: expire diff backup set: 20181119-152800F_20181119-152152D, 20181119-152800F_20181119-152155I"); @@ -381,8 +378,8 @@ testRun(void) TEST_RESULT_UINT(expireDiffBackup(infoBackup), 1, "retention-diff set - only oldest diff expired"); TEST_RESULT_UINT(infoBackupDataTotal(infoBackup), 2, "current backups reduced by one"); - TEST_RESULT_STR_Z( - strLstJoin(infoBackupDataLabelList(infoBackup, NULL), ", "), "20181119-152800F, 20181119-152800F_20181119-152155D", + TEST_RESULT_STRLST_Z( + infoBackupDataLabelList(infoBackup, NULL), "20181119-152800F\n20181119-152800F_20181119-152155D\n", "remaining backups correct"); harnessLogResult( "P00 INFO: expire diff backup 20181119-152800F_20181119-152152D"); @@ -452,9 +449,9 @@ testRun(void) "P00 INFO: remove expired backup 20181119-152100F_20181119-152152D\n" "P00 INFO: remove expired backup 20181119-152100F"); - TEST_RESULT_STR_Z( - strLstJoin(strLstSort(storageListP(storageTest, backupStanzaPath), sortOrderAsc), ", "), - "20181118-152100F_20181119-152152D.save, 20181119-152138F, backup.info, bogus", + TEST_RESULT_STRLST_Z( + strLstSort(storageListP(storageTest, backupStanzaPath), sortOrderAsc), + "20181118-152100F_20181119-152152D.save\n20181119-152138F\nbackup.info\nbogus\n", "remaining file/directories correct"); //-------------------------------------------------------------------------------------------------------------------------- @@ -480,9 +477,9 @@ testRun(void) TEST_RESULT_VOID(removeExpiredBackup(infoBackup, NULL), "remove backups - backup.info current empty"); harnessLogResult("P00 INFO: remove expired backup 20181119-152138F"); - TEST_RESULT_STR_Z( - strLstJoin(strLstSort(storageListP(storageTest, backupStanzaPath), sortOrderAsc), ", "), - "20181118-152100F_20181119-152152D.save, backup.info, bogus", "remaining file/directories correct"); + TEST_RESULT_STRLST_Z( + strLstSort(storageListP(storageTest, backupStanzaPath), sortOrderAsc), + "20181118-152100F_20181119-152152D.save\nbackup.info\nbogus\n", "remaining file/directories correct"); } // ***************************************************************************************************************************** @@ -672,18 +669,18 @@ testRun(void) TEST_RESULT_VOID(removeExpiredArchive(infoBackup, false), "archive retention type = full (default), repo1-retention-archive=3"); - TEST_RESULT_STR( - strLstJoin(strLstSort(storageListP( - storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc), ", "), + TEST_RESULT_STRLST_STR( + strLstSort(storageListP( + storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc), archiveExpectList(2, 10, "0000000100000000"), "only 9.4-1/0000000100000000/000000010000000000000001 removed"); - TEST_RESULT_STR( - strLstJoin(strLstSort(storageListP( - storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000200000000")), sortOrderAsc), ", "), + TEST_RESULT_STRLST_STR( + strLstSort(storageListP( + storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000200000000")), sortOrderAsc), archiveExpectList(1, 10, "0000000200000000"), "none removed from 9.4-1/0000000200000000 - crossing timelines to play through PITR"); - TEST_RESULT_STR( - strLstJoin(strLstSort(storageListP( - storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-2", "0000000100000000")), sortOrderAsc), ", "), + TEST_RESULT_STRLST_STR( + strLstSort(storageListP( + storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-2", "0000000100000000")), sortOrderAsc), archiveExpectList(3, 10, "0000000100000000"), "000000010000000000000001 and 000000010000000000000002 removed from 10-2/0000000100000000"); @@ -696,19 +693,19 @@ testRun(void) TEST_RESULT_VOID(removeExpiredArchive(infoBackup, false), "archive retention type = full (default), repo1-retention-archive=2"); - TEST_RESULT_STR( - strLstJoin(strLstSort(storageListP( - storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc), ", "), + TEST_RESULT_STRLST_STR( + strLstSort(storageListP( + storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc), archiveExpectList(2, 2, "0000000100000000"), "only 9.4-1/0000000100000000/000000010000000000000002 remains in major wal 1"); - TEST_RESULT_STR( - strLstJoin(strLstSort(storageListP( - storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000200000000")), sortOrderAsc), ", "), + TEST_RESULT_STRLST_STR( + strLstSort(storageListP( + storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000200000000")), sortOrderAsc), archiveExpectList(2, 10, "0000000200000000"), "only 9.4-1/0000000200000000/000000010000000000000001 removed from major wal 2"); - TEST_RESULT_STR( - strLstJoin(strLstSort(storageListP( - storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-2", "0000000100000000")), sortOrderAsc), ", "), + TEST_RESULT_STRLST_STR( + strLstSort(storageListP( + storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-2", "0000000100000000")), sortOrderAsc), archiveExpectList(3, 10, "0000000100000000"), "none removed from 10-2/0000000100000000"); @@ -721,19 +718,19 @@ testRun(void) TEST_RESULT_VOID(removeExpiredArchive(infoBackup, false), "archive retention type = full (default), repo1-retention-archive=1"); - TEST_RESULT_STR( - strLstJoin(strLstSort(storageListP( - storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc), ", "), + TEST_RESULT_STRLST_STR( + strLstSort(storageListP( + storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc), archiveExpectList(2, 2, "0000000100000000"), "only 9.4-1/0000000100000000/000000010000000000000002 remains in major wal 1"); - TEST_RESULT_STR( - strLstJoin(strLstSort(storageListP( - storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000200000000")), sortOrderAsc), ", "), + TEST_RESULT_STRLST_STR( + strLstSort(storageListP( + storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000200000000")), sortOrderAsc), archiveExpectList(2, 10, "0000000200000000"), "nothing removed from 9.4-1/0000000200000000 major wal 2 - each archiveId must have one backup to play through PITR"); - TEST_RESULT_STR( - strLstJoin(strLstSort(storageListP( - storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-2", "0000000100000000")), sortOrderAsc), ", "), + TEST_RESULT_STRLST_STR( + strLstSort(storageListP( + storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-2", "0000000100000000")), sortOrderAsc), archiveExpectList(3, 10, "0000000100000000"), "none removed from 10-2/0000000100000000"); //-------------------------------------------------------------------------------------------------------------------------- @@ -752,22 +749,22 @@ testRun(void) String *result = strNew(""); strCatFmt( result, - "%s, %s, %s, %s", + "%s%s%s%s", strZ(archiveExpectList(2, 2, "0000000200000000")), strZ(archiveExpectList(4, 5, "0000000200000000")), strZ(archiveExpectList(7, 7, "0000000200000000")), strZ(archiveExpectList(9, 10, "0000000200000000"))); - TEST_RESULT_STR( - strLstJoin(strLstSort(storageListP( - storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc), ", "), + TEST_RESULT_STRLST_STR( + strLstSort(storageListP( + storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc), archiveExpectList(2, 2, "0000000100000000"), "only 9.4-1/0000000100000000/000000010000000000000002 remains in major wal 1"); - TEST_RESULT_STR( - strLstJoin(strLstSort(storageListP( - storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000200000000")), sortOrderAsc), ", "), + TEST_RESULT_STRLST_STR( + strLstSort(storageListP( + storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000200000000")), sortOrderAsc), result, "all in-between removed from 9.4-1/0000000200000000 major wal 2 - last backup able to play through PITR"); - TEST_RESULT_STR( - strLstJoin(strLstSort(storageListP( - storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-2", "0000000100000000")), sortOrderAsc), ", "), + TEST_RESULT_STRLST_STR( + strLstSort(storageListP( + storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-2", "0000000100000000")), sortOrderAsc), archiveExpectList(3, 10, "0000000100000000"), "none removed from 10-2/0000000100000000"); //-------------------------------------------------------------------------------------------------------------------------- @@ -786,22 +783,22 @@ testRun(void) result = strNew(""); strCatFmt( result, - "%s, %s, %s", + "%s%s%s", strZ(archiveExpectList(2, 2, "0000000200000000")), strZ(archiveExpectList(4, 5, "0000000200000000")), strZ(archiveExpectList(7, 10, "0000000200000000"))); - TEST_RESULT_STR( - strLstJoin(strLstSort(storageListP( - storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc), ", "), + TEST_RESULT_STRLST_STR( + strLstSort(storageListP( + storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc), archiveExpectList(2, 2, "0000000100000000"), "only 9.4-1/0000000100000000/000000010000000000000002 remains in major wal 1"); - TEST_RESULT_STR( - strLstJoin(strLstSort(storageListP( - storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000200000000")), sortOrderAsc), ", "), + TEST_RESULT_STRLST_STR( + strLstSort(storageListP( + storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000200000000")), sortOrderAsc), result, "incremental and after remain in 9.4-1/0000000200000000 major wal 2"); - TEST_RESULT_STR( - strLstJoin(strLstSort(storageListP( - storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-2", "0000000100000000")), sortOrderAsc), ", "), + TEST_RESULT_STRLST_STR( + strLstSort(storageListP( + storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-2", "0000000100000000")), sortOrderAsc), archiveExpectList(3, 10, "0000000100000000"), "none removed from 10-2/0000000100000000"); //-------------------------------------------------------------------------------------------------------------------------- @@ -962,9 +959,9 @@ testRun(void) TEST_ASSIGN(infoBackup, infoBackupLoadFile(storageTest, backupInfoFileName, cipherTypeNone, NULL), "get backup.info"); TEST_RESULT_UINT(infoBackupDataTotal(infoBackup), 2, "backup.info updated on disk"); - TEST_RESULT_STR_Z( - strLstJoin(strLstSort(infoBackupDataLabelList(infoBackup, NULL), sortOrderAsc), ", "), - "20181119-152900F, 20181119-152900F_20181119-152500I", "remaining current backups correct"); + TEST_RESULT_STRLST_Z( + strLstSort(infoBackupDataLabelList(infoBackup, NULL), sortOrderAsc), + "20181119-152900F\n20181119-152900F_20181119-152500I\n", "remaining current backups correct"); //-------------------------------------------------------------------------------------------------------------------------- TEST_TITLE("expire command - archive removed"); @@ -1032,9 +1029,9 @@ testRun(void) TEST_RESULT_VOID( removeExpiredArchive(infoBackup, false), "backup selected for retention does not have archive-start so do nothing"); - TEST_RESULT_STR( - strLstJoin(strLstSort(storageListP( - storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc), ", "), + TEST_RESULT_STRLST_STR( + strLstSort(storageListP( + storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc), archiveExpectList(1, 5, "0000000100000000"), "nothing removed from 9.4-1/0000000100000000"); //-------------------------------------------------------------------------------------------------------------------------- @@ -1284,13 +1281,13 @@ testRun(void) harnessLogResult( "P00 INFO: expire full backup 20181119-152138F\n" "P00 INFO: remove expired backup 20181119-152138F"); - TEST_RESULT_STR( - strLstJoin(strLstSort(storageListP( - storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-1", "0000000100000000")), sortOrderAsc), ", "), + TEST_RESULT_STRLST_STR( + strLstSort(storageListP( + storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-1", "0000000100000000")), sortOrderAsc), archiveExpectList(1, 7, "0000000100000000"), "none removed from 10-1/0000000100000000"); - TEST_RESULT_STR( - strLstJoin(strLstSort(storageListP( - storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-2", "0000000100000000")), sortOrderAsc), ", "), + TEST_RESULT_STRLST_STR( + strLstSort(storageListP( + storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-2", "0000000100000000")), sortOrderAsc), archiveExpectList(1, 7, "0000000100000000"), "none removed from 10-2/0000000100000000"); //-------------------------------------------------------------------------------------------------------------------------- @@ -1408,13 +1405,13 @@ testRun(void) "P00 INFO: expire full backup 20181119-152800F\n" "P00 INFO: remove expired backup 20181119-152800F\n" "P00 INFO: remove expired backup 20181119-152138F"); - TEST_RESULT_STR( - strLstJoin(strLstSort(storageListP( - storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-1", "0000000100000000")), sortOrderAsc), ", "), + TEST_RESULT_STRLST_STR( + strLstSort(storageListP( + storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-1", "0000000100000000")), sortOrderAsc), archiveExpectList(1, 7, "0000000100000000"), "none removed from 10-1/0000000100000000"); - TEST_RESULT_STR( - strLstJoin(strLstSort(storageListP( - storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-2", "0000000100000000")), sortOrderAsc), ", "), + TEST_RESULT_STRLST_STR( + strLstSort(storageListP( + storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "10-2", "0000000100000000")), sortOrderAsc), archiveExpectList(6, 7, "0000000100000000"), "all prior to 000000010000000000000006 removed from 10-2/0000000100000000"); } @@ -1700,7 +1697,7 @@ testRun(void) String *archiveRemaining = strNew(""); strCatFmt( - archiveRemaining, "%s, %s", strZ(archiveExpectList(2, 4, "0000000100000000")), + archiveRemaining, "%s%s", strZ(archiveExpectList(2, 4, "0000000100000000")), strZ(archiveExpectList(6, 10, "0000000100000000"))); TEST_RESULT_VOID(cmdExpire(), "adhoc expire latest backup"); @@ -1728,9 +1725,9 @@ testRun(void) "P00 DETAIL: no archive to remove, archiveId = 12-2"); TEST_RESULT_STR(storageInfoP(storageRepo(), STRDEF(STORAGE_REPO_BACKUP "/latest")).linkDestination, STRDEF("20181119-152850F"), "latest link updated"); - TEST_RESULT_STR( - strLstJoin(strLstSort(storageListP( - storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "12-2", "0000000100000000")), sortOrderAsc), ", "), + TEST_RESULT_STRLST_STR( + strLstSort(storageListP( + storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "12-2", "0000000100000000")), sortOrderAsc), archiveRemaining, "no archives removed from latest except what was already removed"); @@ -2040,25 +2037,25 @@ testRun(void) TEST_RESULT_UINT( expireTimeBasedBackup(infoBackup, (time_t)(timeNow - (40 * SEC_PER_DAY))), 0, "oldest backup stop time equals retention time"); - TEST_RESULT_STR_Z( - strLstJoin(infoBackupDataLabelList(infoBackup, NULL), ", "), - "20181119-152138F, 20181119-152800F, 20181119-152800F_20181119-152152D, 20181119-152800F_20181119-152155I, " - "20181119-152900F, 20181119-152900F_20181119-152600D", "no backups expired"); + TEST_RESULT_STRLST_Z( + infoBackupDataLabelList(infoBackup, NULL), + "20181119-152138F\n20181119-152800F\n20181119-152800F_20181119-152152D\n20181119-152800F_20181119-152155I\n" + "20181119-152900F\n20181119-152900F_20181119-152600D\n", "no backups expired"); // Add a time period strLstAddZ(argList, "--repo1-retention-full=35"); harnessCfgLoad(cfgCmdExpire, argList); TEST_RESULT_VOID(cmdExpire(), "oldest backup older but other backups too young"); - TEST_RESULT_STR( - strLstJoin(strLstSort(storageListP( - storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc), ", "), + TEST_RESULT_STRLST_STR( + strLstSort(storageListP( + storageTest, strNewFmt("%s/%s/%s", strZ(archiveStanzaPath), "9.4-1", "0000000100000000")), sortOrderAsc), archiveExpectList(1, 11, "0000000100000000"), "no archives expired"); - TEST_RESULT_STR_Z( - strLstJoin(infoBackupDataLabelList(infoBackup, NULL), ", "), - "20181119-152138F, 20181119-152800F, 20181119-152800F_20181119-152152D, 20181119-152800F_20181119-152155I, " - "20181119-152900F, 20181119-152900F_20181119-152600D", "no backups expired"); + TEST_RESULT_STRLST_Z( + infoBackupDataLabelList(infoBackup, NULL), + "20181119-152138F\n20181119-152800F\n20181119-152800F_20181119-152152D\n20181119-152800F_20181119-152155I\n" + "20181119-152900F\n20181119-152900F_20181119-152600D\n", "no backups expired"); harnessLogResult("P00 INFO: time-based archive retention not met - archive logs will not be expired"); //-------------------------------------------------------------------------------------------------------------------------- diff --git a/test/src/module/command/verifyTest.c b/test/src/module/command/verifyTest.c index 498fab4e4..00a03aa60 100644 --- a/test/src/module/command/verifyTest.c +++ b/test/src/module/command/verifyTest.c @@ -227,11 +227,11 @@ testRun(void) "P00 ERROR: [028]: invalid WAL '0000000200000001000000FF' for '9.2-1' exists, skipping\n" "P00 ERROR: [028]: duplicate WAL '000000020000000200000001' for '9.2-1' exists, skipping"); - TEST_RESULT_STR_Z( - strLstJoin(walFileList, ", "), - "0000000200000001000000FD-daa497dba64008db824607940609ba1cd7c6c501.gz, " - "0000000200000001000000FE-a6e1a64f0813352bc2e97f116a1800377e17d2e4.gz, " - "000000020000000200000000, 000000020000000200000002", + TEST_RESULT_STRLST_Z( + walFileList, + "0000000200000001000000FD-daa497dba64008db824607940609ba1cd7c6c501.gz\n" + "0000000200000001000000FE-a6e1a64f0813352bc2e97f116a1800377e17d2e4.gz\n" + "000000020000000200000000\n000000020000000200000002\n", "skipped files removed"); //-------------------------------------------------------------------------------------------------------------------------- diff --git a/test/src/module/common/iniTest.c b/test/src/module/common/iniTest.c index 558b68811..a85fa57d9 100644 --- a/test/src/module/common/iniTest.c +++ b/test/src/module/common/iniTest.c @@ -150,16 +150,16 @@ testRun(void) TEST_RESULT_STR_Z(iniGetDefault(ini, strNew("section3"), strNew("key3"), strNew("true")), "true", "get section, key, bool"); TEST_RESULT_INT(strLstSize(iniSectionKeyList(ini, strNew("bogus"))), 0, "get keys for missing section"); - TEST_RESULT_STR_Z(strLstJoin(iniSectionKeyList(ini, strNew("section1")), "|"), "key1|key2", "get keys for section"); + TEST_RESULT_STRLST_Z(iniSectionKeyList(ini, strNew("section1")), "key1\nkey2\n", "get keys for section"); TEST_RESULT_VOID(iniSet(ini, strNew("section2"), strNew("key2"), strNew("2")), "set section2, key"); TEST_RESULT_INT(strLstSize(iniSectionList(ini)), 2, "number of sections"); - TEST_RESULT_STR_Z(strLstJoin(iniSectionList(ini), "|"), "section1|section2", "get sections"); + TEST_RESULT_STRLST_Z(iniSectionList(ini), "section1\nsection2\n", "get sections"); TEST_RESULT_BOOL(iniSectionKeyIsList(ini, strNew("section1"), strNew("key1")), false, "single value is not list"); TEST_RESULT_VOID(iniSet(ini, strNew("section2"), strNew("key2"), strNew("7")), "set section2, key"); TEST_RESULT_BOOL(iniSectionKeyIsList(ini, strNew("section2"), strNew("key2")), true, "section2, key2 is a list"); - TEST_RESULT_STR_Z(strLstJoin(iniGetList(ini, strNew("section2"), strNew("key2")), "|"), "2|7", "get list"); + TEST_RESULT_STRLST_Z(iniGetList(ini, strNew("section2"), strNew("key2")), "2\n7\n", "get list"); TEST_RESULT_PTR(iniGetList(ini, strNew("section2"), strNew("key-missing")), NULL, "get missing list"); TEST_RESULT_VOID(iniFree(ini), "free ini"); diff --git a/test/src/module/common/ioHttpTest.c b/test/src/module/common/ioHttpTest.c index 235fb052a..7b42b7687 100644 --- a/test/src/module/common/ioHttpTest.c +++ b/test/src/module/common/ioHttpTest.c @@ -71,7 +71,7 @@ testRun(void) TEST_RESULT_PTR(httpHeaderAdd(header, strNew("key2"), strNew("value2b")), header, "add header"); TEST_RESULT_PTR(httpHeaderAdd(header, strNew("key1"), strNew("value1")), header, "add header"); - TEST_RESULT_STR_Z(strLstJoin(httpHeaderList(header), ", "), "key1, key2", "header list"); + TEST_RESULT_STRLST_Z(httpHeaderList(header), "key1\nkey2\n", "header list"); TEST_RESULT_STR_Z(httpHeaderGet(header, strNew("key1")), "value1", "get value"); TEST_RESULT_STR_Z(httpHeaderGet(header, strNew("key2")), "value2a, value2b", "get value"); @@ -132,7 +132,7 @@ testRun(void) TEST_RESULT_STR_Z(httpQueryRenderP(query), "key2=value2a", "render one query item"); TEST_RESULT_PTR(httpQueryAdd(query, strNew("key1"), strNew("value 1?")), query, "add query"); - TEST_RESULT_STR_Z(strLstJoin(httpQueryList(query), ", "), "key1, key2", "query list"); + TEST_RESULT_STRLST_Z(httpQueryList(query), "key1\nkey2\n", "query list"); TEST_RESULT_STR_Z(httpQueryRenderP(query), "key1=value%201%3F&key2=value2a", "render two query items"); TEST_RESULT_STR_Z( httpQueryRenderP(query, .redact = true), "key1=value%201%3F&key2=", "render two query items with redaction"); diff --git a/test/src/module/common/typeJsonTest.c b/test/src/module/common/typeJsonTest.c index c23dbe9e8..3945d1712 100644 --- a/test/src/module/common/typeJsonTest.c +++ b/test/src/module/common/typeJsonTest.c @@ -114,7 +114,7 @@ testRun(void) TEST_ERROR(jsonToVarLst(strNew("[")), JsonFormatError, "expected data"); TEST_ERROR(jsonToVarLst(strNew(" [] ZZZ")), JsonFormatError, "unexpected characters after array at 'ZZZ'"); - TEST_RESULT_STR_Z(strLstJoin(strLstNewVarLst(jsonToVarLst(strNew("[\"e1\", \"e2\"]"))), "|"), "e1|e2", "json list"); + TEST_RESULT_STRLST_Z(strLstNewVarLst(jsonToVarLst(strNew("[\"e1\", \"e2\"]"))), "e1\ne2\n", "json list"); } // ***************************************************************************************************************************** diff --git a/test/src/module/common/typeVariantTest.c b/test/src/module/common/typeVariantTest.c index 40368efd7..6c771e9fc 100644 --- a/test/src/module/common/typeVariantTest.c +++ b/test/src/module/common/typeVariantTest.c @@ -398,7 +398,7 @@ testRun(void) varLstAdd(list, varNewStrZ("string1")); varLstAdd(list, varNewStrZ("string2")); - TEST_RESULT_STR_Z(strLstJoin(strLstNewVarLst(varLstDup(list)), ", "), "string1, string2", "duplicate variant list"); + TEST_RESULT_STRLST_Z(strLstNewVarLst(varLstDup(list)), "string1\nstring2\n", "duplicate variant list"); TEST_RESULT_PTR(varLstDup(NULL), NULL, "duplicate null list"); } @@ -411,8 +411,7 @@ testRun(void) strLstAdd(listStr, strNew("string1")); strLstAdd(listStr, strNew("string2")); - TEST_RESULT_STR_Z( - strLstJoin(strLstNewVarLst(varLstNewStrLst(listStr)), ", "), "string1, string2", "variant list from string list"); + TEST_RESULT_STRLST_Z(strLstNewVarLst(varLstNewStrLst(listStr)), "string1\nstring2\n", "variant list from string list"); TEST_RESULT_PTR(varLstNewStrLst(NULL), NULL, "variant list from null string list"); } diff --git a/test/src/module/config/execTest.c b/test/src/module/config/execTest.c index e8a76e655..f4e8be75d 100644 --- a/test/src/module/config/execTest.c +++ b/test/src/module/config/execTest.c @@ -33,20 +33,17 @@ testRun(void) harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList)); unsetenv("PGBACKREST_REPO1_CIPHER_PASS"); - TEST_RESULT_STR( - strLstJoin(cfgExecParam(cfgCmdArchiveGet, cfgCmdRoleAsync, NULL, false, true), "|"), - strNewFmt( - "--archive-async|--no-config|--exec-id=1-test|--log-subprocess|--reset-neutral-umask" - "|--pg1-path=\"%s/db path\"|--pg2-path=/db2|--repo1-path=%s/repo|--stanza=test1|archive-get:async", - testPath(), testPath()), + TEST_RESULT_STRLST_Z( + cfgExecParam(cfgCmdArchiveGet, cfgCmdRoleAsync, NULL, false, true), + "--archive-async\n--no-config\n--exec-id=1-test\n--log-subprocess\n--reset-neutral-umask\n" + "--pg1-path=\"" TEST_PATH "/db path\"\n--pg2-path=/db2\n--repo1-path=" TEST_PATH "/repo\n--stanza=test1\n" + "archive-get:async\n", "exec archive-get -> archive-get:async"); - TEST_RESULT_STR( - strLstJoin(cfgExecParam(cfgCmdBackup, cfgCmdRoleDefault, NULL, false, false), "|"), - strNewFmt( - "--archive-timeout=5|--no-config|--exec-id=1-test|--log-subprocess|--reset-neutral-umask|--pg1-path=%s/db path" - "|--pg2-path=/db2|--repo1-path=%s/repo|--stanza=test1|backup", - testPath(), testPath()), + TEST_RESULT_STRLST_Z( + cfgExecParam(cfgCmdBackup, cfgCmdRoleDefault, NULL, false, false), + "--archive-timeout=5\n--no-config\n--exec-id=1-test\n--log-subprocess\n--reset-neutral-umask\n" + "--pg1-path=" TEST_PATH "/db path\n--pg2-path=/db2\n--repo1-path=" TEST_PATH "/repo\n--stanza=test1\nbackup\n", "exec archive-get -> backup"); // ------------------------------------------------------------------------------------------------------------------------- @@ -71,12 +68,10 @@ testRun(void) kvPut(optionReplace, varNewStr(strNew("stanza")), NULL); kvPut(optionReplace, VARSTRDEF(CFGOPT_LOG_PATH), VARSTRDEF("/log")); - TEST_RESULT_STR( - strLstJoin(cfgExecParam(cfgCmdRestore, cfgCmdRoleDefault, optionReplace, true, false), "|"), - strNewFmt( - "--db-include=1|--db-include=2|--exec-id=1-test|--log-path=/log|--pg1-path=%s/db path|--recovery-option=a=b" - "|--recovery-option=c=d|--repo1-path=/replace/path|restore", - testPath()), + TEST_RESULT_STRLST_Z( + cfgExecParam(cfgCmdRestore, cfgCmdRoleDefault, optionReplace, true, false), + "--db-include=1\n--db-include=2\n--exec-id=1-test\n--log-path=/log\n--pg1-path=" TEST_PATH "/db path\n" + "--recovery-option=a=b\n--recovery-option=c=d\n--repo1-path=/replace/path\nrestore\n", "exec restore -> restore"); } diff --git a/test/src/module/config/parseTest.c b/test/src/module/config/parseTest.c index 980b8c63c..87343543b 100644 --- a/test/src/module/config/parseTest.c +++ b/test/src/module/config/parseTest.c @@ -1127,9 +1127,8 @@ testRun(void) strLstAdd(argList, strNew("000000010000000200000003")); strLstAdd(argList, strNew("/path/to/wal/RECOVERYWAL")); TEST_RESULT_VOID(configParse(strLstSize(argList), strLstPtr(argList), false), "command arguments"); - TEST_RESULT_STR_Z( - strLstJoin(cfgCommandParam(), "|"), "000000010000000200000003|/path/to/wal/RECOVERYWAL", - " check command arguments"); + TEST_RESULT_STRLST_Z( + cfgCommandParam(), "000000010000000200000003\n/path/to/wal/RECOVERYWAL\n", " check command arguments"); // ------------------------------------------------------------------------------------------------------------------------- argList = strLstNew(); @@ -1152,7 +1151,7 @@ testRun(void) TEST_RESULT_UINT(cfgLogLevelDefault(), logLevelInfo, " backup defaults to log level warn"); TEST_RESULT_BOOL(cfgLogFile(), true, " backup command does file logging"); TEST_RESULT_BOOL(cfgLockRemoteRequired(), true, " backup command requires remote lock"); - TEST_RESULT_STR_Z(strLstJoin(cfgCommandParam(), "|"), "", " check command arguments"); + TEST_RESULT_STRLST_Z(cfgCommandParam(), NULL, " check command arguments"); TEST_RESULT_UINT(cfgCommandRoleEnum(NULL), cfgCmdRoleDefault, "command role default enum"); TEST_ERROR(cfgCommandRoleEnum(STRDEF("bogus")), CommandInvalidError, "invalid command role 'bogus'"); TEST_RESULT_INT(cfgCommandRole(), cfgCmdRoleDefault, " command role is default"); diff --git a/test/src/module/config/protocolTest.c b/test/src/module/config/protocolTest.c index 196ff381c..91ce974d8 100644 --- a/test/src/module/config/protocolTest.c +++ b/test/src/module/config/protocolTest.c @@ -55,8 +55,8 @@ testRun(void) varLstAdd(list, varNewStr(strNew("repo1-host"))); varLstAdd(list, varNewStr(strNew("repo1-host-user"))); - TEST_RESULT_STR_Z( - strLstJoin(strLstNewVarLst(configProtocolOption(client, list)), "|"), "repo-host|repo-host-user", + TEST_RESULT_STRLST_Z( + strLstNewVarLst(configProtocolOption(client, list)), "repo-host\nrepo-host-user\n", "get options"); protocolClientFree(client); diff --git a/test/src/module/info/infoBackupTest.c b/test/src/module/info/infoBackupTest.c index 358c27600..c8e24199a 100644 --- a/test/src/module/info/infoBackupTest.c +++ b/test/src/module/info/infoBackupTest.c @@ -203,30 +203,29 @@ testRun(void) // infoBackupDataLabelList and infoBackupDataDelete // ------------------------------------------------------------------------------------------------------------------------- - TEST_RESULT_STR_Z( - strLstJoin(strLstSort(infoBackupDataLabelList(infoBackup, NULL), sortOrderAsc), ", "), - "20161219-212741F, 20161219-212741F_20161219-212803D, 20161219-212741F_20161219-212918I", + TEST_RESULT_STRLST_Z( + strLstSort(infoBackupDataLabelList(infoBackup, NULL), sortOrderAsc), + "20161219-212741F\n20161219-212741F_20161219-212803D\n20161219-212741F_20161219-212918I\n", "infoBackupDataLabelList without expression"); - TEST_RESULT_STR_Z( - strLstJoin( - strLstSort( - infoBackupDataLabelList( - infoBackup, backupRegExpP(.full = true, .differential = true, .incremental = true)), sortOrderAsc), ", "), - "20161219-212741F, 20161219-212741F_20161219-212803D, 20161219-212741F_20161219-212918I", + TEST_RESULT_STRLST_Z( + strLstSort( + infoBackupDataLabelList( + infoBackup, backupRegExpP(.full = true, .differential = true, .incremental = true)), sortOrderAsc), + "20161219-212741F\n20161219-212741F_20161219-212803D\n20161219-212741F_20161219-212918I\n", "infoBackupDataLabelList with expression"); - TEST_RESULT_STR_Z( - strLstJoin(infoBackupDataLabelList(infoBackup, backupRegExpP(.full=true)), ", "), "20161219-212741F", " full=true"); - TEST_RESULT_STR_Z( - strLstJoin(infoBackupDataLabelList(infoBackup, backupRegExpP(.differential=true)), ", "), - "20161219-212741F_20161219-212803D", "differential=true"); - TEST_RESULT_STR_Z( - strLstJoin(infoBackupDataLabelList(infoBackup, backupRegExpP(.incremental=true)), ", "), - "20161219-212741F_20161219-212918I", "incremental=true"); + TEST_RESULT_STRLST_Z( + infoBackupDataLabelList(infoBackup, backupRegExpP(.full=true)), "20161219-212741F\n", " full=true"); + TEST_RESULT_STRLST_Z( + infoBackupDataLabelList(infoBackup, backupRegExpP(.differential=true)), "20161219-212741F_20161219-212803D\n", + "differential=true"); + TEST_RESULT_STRLST_Z( + infoBackupDataLabelList(infoBackup, backupRegExpP(.incremental=true)), "20161219-212741F_20161219-212918I\n", + "incremental=true"); TEST_RESULT_VOID(infoBackupDataDelete(infoBackup, strNew("20161219-212741F_20161219-212918I")), "delete a backup"); - TEST_RESULT_STR_Z( - strLstJoin(strLstSort(infoBackupDataLabelList(infoBackup, NULL), sortOrderAsc), ", "), - "20161219-212741F, 20161219-212741F_20161219-212803D", " backup deleted"); + TEST_RESULT_STRLST_Z( + strLstSort(infoBackupDataLabelList(infoBackup, NULL), sortOrderAsc), + "20161219-212741F\n20161219-212741F_20161219-212803D\n", " backup deleted"); TEST_RESULT_VOID(infoBackupDataDelete(infoBackup, strNew("20161219-212741F_20161219-212803D")), "delete all backups"); TEST_RESULT_VOID(infoBackupDataDelete(infoBackup, strNew("20161219-212741F")), " deleted"); @@ -425,9 +424,9 @@ testRun(void) TEST_RESULT_STR_Z(backupData.backupArchiveStop, "000000030000028500000090", "archive stop set"); TEST_RESULT_STR_Z(backupData.backupType, "diff", "backup type set"); TEST_RESULT_STR_Z(backupData.backupPrior, "20190818-084502F", "backup prior set"); - TEST_RESULT_STR_Z( - strLstJoin(backupData.backupReference, ", "), - "20190818-084502F, 20190818-084502F_20190819-084506D, 20190818-084502F_20190819-084506I", + TEST_RESULT_STRLST_Z( + backupData.backupReference, + "20190818-084502F\n20190818-084502F_20190819-084506D\n20190818-084502F_20190819-084506I\n", "backup reference set and ordered"); TEST_RESULT_BOOL(backupData.optionArchiveCheck, true, "option archive check"); TEST_RESULT_BOOL(backupData.optionArchiveCopy, true, "option archive copy"); @@ -687,16 +686,14 @@ testRun(void) storagePathCreateP(storageRepoWrite(), strNew(STORAGE_REPO_BACKUP "/20190818-084502F")), "create backup on disk that is in current but no manifest"); - TEST_RESULT_STR_Z( - strLstJoin( - strLstSort( - storageListP( - storageRepo(), STORAGE_REPO_BACKUP_STR, - .expression = backupRegExpP(.full = true, .differential = true, .incremental = true)), - sortOrderAsc), - ", "), - "20190818-084444F, 20190818-084502F, 20190818-084502F_20190820-084502I, 20190818-084555F, 20190818-084666F, " - "20190818-084777F, 20190923-164324F", "confirm backups on disk"); + TEST_RESULT_STRLST_Z( + strLstSort( + storageListP( + storageRepo(), STORAGE_REPO_BACKUP_STR, + .expression = backupRegExpP(.full = true, .differential = true, .incremental = true)), + sortOrderAsc), + "20190818-084444F\n20190818-084502F\n20190818-084502F_20190820-084502I\n20190818-084555F\n20190818-084666F\n" + "20190818-084777F\n20190923-164324F\n", "confirm backups on disk"); // With the infoBackup from above, upgrade the DB so there a 2 histories then save to disk TEST_ASSIGN( @@ -805,9 +802,9 @@ testRun(void) TEST_ASSIGN( infoBackup, infoBackupLoadFileReconstruct(storageRepo(), INFO_BACKUP_PATH_FILE_STR, cipherTypeNone, NULL), "reconstruct"); - TEST_RESULT_STR_Z( - strLstJoin(infoBackupDataLabelList(infoBackup, NULL), ", "), - "20190818-084444F, 20190818-084444F_20190924-084502D, 20190923-164324F", + TEST_RESULT_STRLST_Z( + infoBackupDataLabelList(infoBackup, NULL), + "20190818-084444F\n20190818-084444F_20190924-084502D\n20190923-164324F\n", "previously ignored pgId=1 manifest copy-only now added before existing, and add dependent found"); harnessLogResult( "P00 WARN: backup '20190818-084444F' found in repository added to backup.info\n" @@ -925,27 +922,26 @@ testRun(void) TEST_ASSIGN( dependencyList, infoBackupDataDependentList(infoBackup, STRDEF("20200317-181625F")), "full"); - TEST_RESULT_STR_Z( - strLstJoin(dependencyList, ", "), - "20200317-181625F, 20200317-181625F_20200317-182239D, 20200317-181625F_20200317-182300D, " - "20200317-181625F_20200317-182324I, 20200317-181625F_20200317-182340I, 20200317-181625F_20200317-182340D", + TEST_RESULT_STRLST_Z( + dependencyList, + "20200317-181625F\n20200317-181625F_20200317-182239D\n20200317-181625F_20200317-182300D\n" + "20200317-181625F_20200317-182324I\n20200317-181625F_20200317-182340I\n20200317-181625F_20200317-182340D\n", "all dependents"); TEST_ASSIGN( dependencyList, infoBackupDataDependentList(infoBackup, STRDEF("20200317-181416F")), "full"); - TEST_RESULT_STR_Z(strLstJoin(dependencyList, ", "), "20200317-181416F", "no dependents"); + TEST_RESULT_STRLST_Z(dependencyList, "20200317-181416F\n", "no dependents"); TEST_ASSIGN( dependencyList, infoBackupDataDependentList(infoBackup, STRDEF("20200317-181625F_20200317-182300D")), "diff"); - TEST_RESULT_STR_Z( - strLstJoin(dependencyList, ", "), - "20200317-181625F_20200317-182300D, 20200317-181625F_20200317-182324I, 20200317-181625F_20200317-182340I", + TEST_RESULT_STRLST_Z( + dependencyList, + "20200317-181625F_20200317-182300D\n20200317-181625F_20200317-182324I\n20200317-181625F_20200317-182340I\n", "all dependents"); TEST_ASSIGN( dependencyList, infoBackupDataDependentList(infoBackup, STRDEF("20200317-181625F_20200317-182324I")), "incr"); - TEST_RESULT_STR_Z( - strLstJoin(dependencyList, ", "), "20200317-181625F_20200317-182324I, 20200317-181625F_20200317-182340I", - "all dependents"); + TEST_RESULT_STRLST_Z( + dependencyList, "20200317-181625F_20200317-182324I\n20200317-181625F_20200317-182340I\n", "all dependents"); } } diff --git a/test/src/module/postgres/interfaceTest.c b/test/src/module/postgres/interfaceTest.c index e9a64fc63..ff1b580f5 100644 --- a/test/src/module/postgres/interfaceTest.c +++ b/test/src/module/postgres/interfaceTest.c @@ -126,40 +126,30 @@ testRun(void) TEST_RESULT_UINT( pgLsnFromWalSegment(STRDEF("00000001FFFFFFFF00000001"), 0x40000000), 0xFFFFFFFF40000000, "1G wal segment to lsn"); - TEST_RESULT_STR_Z( - strLstJoin( - pgLsnRangeToWalSegmentList( - PG_VERSION_92, 1, pgLsnFromStr(STRDEF("1/60")), pgLsnFromStr(STRDEF("1/60")), 16 * 1024 * 1024), - ", "), - "000000010000000100000000", "get single"); - TEST_RESULT_STR_Z( - strLstJoin( - pgLsnRangeToWalSegmentList( - PG_VERSION_92, 2, pgLsnFromStr(STRDEF("1/FD000000")), pgLsnFromStr(STRDEF("2/1000000")), 16 * 1024 * 1024), - ", "), - "0000000200000001000000FD, 0000000200000001000000FE, 000000020000000200000000, 000000020000000200000001", + TEST_RESULT_STRLST_Z( + pgLsnRangeToWalSegmentList( + PG_VERSION_92, 1, pgLsnFromStr(STRDEF("1/60")), pgLsnFromStr(STRDEF("1/60")), 16 * 1024 * 1024), + "000000010000000100000000\n", "get single"); + TEST_RESULT_STRLST_Z( + pgLsnRangeToWalSegmentList( + PG_VERSION_92, 2, pgLsnFromStr(STRDEF("1/FD000000")), pgLsnFromStr(STRDEF("2/1000000")), 16 * 1024 * 1024), + "0000000200000001000000FD\n0000000200000001000000FE\n000000020000000200000000\n000000020000000200000001\n", "get range <= 9.2"); - TEST_RESULT_STR_Z( - strLstJoin( - pgLsnRangeToWalSegmentList( - PG_VERSION_93, 2, pgLsnFromStr(STRDEF("1/FD000000")), pgLsnFromStr(STRDEF("2/60")), 16 * 1024 * 1024), - ", "), - "0000000200000001000000FD, 0000000200000001000000FE, 0000000200000001000000FF, 000000020000000200000000", + TEST_RESULT_STRLST_Z( + pgLsnRangeToWalSegmentList( + PG_VERSION_93, 2, pgLsnFromStr(STRDEF("1/FD000000")), pgLsnFromStr(STRDEF("2/60")), 16 * 1024 * 1024), + "0000000200000001000000FD\n0000000200000001000000FE\n0000000200000001000000FF\n000000020000000200000000\n", "get range > 9.2"); - TEST_RESULT_STR_Z( - strLstJoin( - pgLsnRangeToWalSegmentList( - PG_VERSION_11, 2, pgLsnFromStr(STRDEF("A/800")), pgLsnFromStr(STRDEF("B/C0000000")), 1024 * 1024 * 1024), - ", "), - "000000020000000A00000000, 000000020000000A00000001, 000000020000000A00000002, 000000020000000A00000003" - ", 000000020000000B00000000, 000000020000000B00000001, 000000020000000B00000002, 000000020000000B00000003", + TEST_RESULT_STRLST_Z( + pgLsnRangeToWalSegmentList( + PG_VERSION_11, 2, pgLsnFromStr(STRDEF("A/800")), pgLsnFromStr(STRDEF("B/C0000000")), 1024 * 1024 * 1024), + "000000020000000A00000000\n000000020000000A00000001\n000000020000000A00000002\n000000020000000A00000003\n" + "000000020000000B00000000\n000000020000000B00000001\n000000020000000B00000002\n000000020000000B00000003\n", "get range >= 11/1GB"); - TEST_RESULT_STR_Z( - strLstJoin( - pgLsnRangeToWalSegmentList( - PG_VERSION_11, 3, pgLsnFromStr(STRDEF("7/FFEFFFFF")), pgLsnFromStr(STRDEF("8/001AAAAA")), 1024 * 1024), - ", "), - "000000030000000700000FFE, 000000030000000700000FFF, 000000030000000800000000, 000000030000000800000001", + TEST_RESULT_STRLST_Z( + pgLsnRangeToWalSegmentList( + PG_VERSION_11, 3, pgLsnFromStr(STRDEF("7/FFEFFFFF")), pgLsnFromStr(STRDEF("8/001AAAAA")), 1024 * 1024), + "000000030000000700000FFE\n000000030000000700000FFF\n000000030000000800000000\n000000030000000800000001\n", "get range >= 11/1MB"); } diff --git a/test/src/module/protocol/protocolTest.c b/test/src/module/protocol/protocolTest.c index 277bc6ec7..db6c9060f 100644 --- a/test/src/module/protocol/protocolTest.c +++ b/test/src/module/protocol/protocolTest.c @@ -225,10 +225,10 @@ testRun(void) strLstAddZ(argList, "archive-get"); harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList)); - TEST_RESULT_STR_Z( - strLstJoin(protocolLocalParam(protocolStorageTypeRepo, 0, 0), "|"), - "--exec-id=1-test|--log-level-console=off|--log-level-file=off|--log-level-stderr=error|--pg1-path=/path/to/pg" - "|--process=0|--remote-type=repo|--stanza=test1|archive-get:local", + TEST_RESULT_STRLST_Z( + protocolLocalParam(protocolStorageTypeRepo, 0, 0), + "--exec-id=1-test\n--log-level-console=off\n--log-level-file=off\n--log-level-stderr=error\n--pg1-path=/path/to/pg\n" + "--process=0\n--remote-type=repo\n--stanza=test1\narchive-get:local\n", "local repo protocol params"); // ------------------------------------------------------------------------------------------------------------------------- @@ -241,10 +241,10 @@ testRun(void) strLstAddZ(argList, "backup"); harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList)); - TEST_RESULT_STR_Z( - strLstJoin(protocolLocalParam(protocolStorageTypePg, 0, 1), "|"), - "--exec-id=1-test|--log-level-console=off|--log-level-file=info|--log-level-stderr=error|--log-subprocess|--pg=1" - "|--pg1-path=/pg|--process=1|--remote-type=pg|--stanza=test1|backup:local", + TEST_RESULT_STRLST_Z( + protocolLocalParam(protocolStorageTypePg, 0, 1), + "--exec-id=1-test\n--log-level-console=off\n--log-level-file=info\n--log-level-stderr=error\n--log-subprocess\n--pg=1\n" + "--pg1-path=/pg\n--process=1\n--remote-type=pg\n--stanza=test1\nbackup:local\n", "local pg protocol params"); } @@ -266,11 +266,11 @@ testRun(void) strLstAddZ(argList, "archive-get"); harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList)); - TEST_RESULT_STR_Z( - strLstJoin(protocolRemoteParam(protocolStorageTypeRepo, 0), "|"), - "-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|repo-host-user@repo-host" - "|pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error" - " --pg1-path=/path/to/pg --process=0 --remote-type=repo --stanza=test1 archive-get:remote", + TEST_RESULT_STRLST_Z( + protocolRemoteParam(protocolStorageTypeRepo, 0), + "-o\nLogLevel=error\n-o\nCompression=no\n-o\nPasswordAuthentication=no\nrepo-host-user@repo-host\n" + "pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error" + " --pg1-path=/path/to/pg --process=0 --remote-type=repo --stanza=test1 archive-get:remote\n", "remote protocol params"); // ------------------------------------------------------------------------------------------------------------------------- @@ -289,12 +289,12 @@ testRun(void) strLstAddZ(argList, CFGCMD_CHECK); harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList)); - TEST_RESULT_STR_Z( - strLstJoin(protocolRemoteParam(protocolStorageTypeRepo, 0), "|"), - "-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|-p|444|repo-host-user@repo-host" - "|pgbackrest --config=/path/pgbackrest.conf --config-include-path=/path/include --config-path=/path/config" + TEST_RESULT_STRLST_Z( + protocolRemoteParam(protocolStorageTypeRepo, 0), + "-o\nLogLevel=error\n-o\nCompression=no\n-o\nPasswordAuthentication=no\n-p\n444\nrepo-host-user@repo-host\n" + "pgbackrest --config=/path/pgbackrest.conf --config-include-path=/path/include --config-path=/path/config" " --exec-id=1-test --log-level-console=off --log-level-file=info --log-level-stderr=error --log-subprocess" - " --pg1-path=/unused --process=0 --remote-type=repo --stanza=test1 check:remote", + " --pg1-path=/unused --process=0 --remote-type=repo --stanza=test1 check:remote\n", "remote protocol params with replacements"); // ------------------------------------------------------------------------------------------------------------------------- @@ -308,11 +308,11 @@ testRun(void) strLstAddZ(argList, CFGCMD_ARCHIVE_GET ":" CONFIG_COMMAND_ROLE_LOCAL); harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList)); - TEST_RESULT_STR_Z( - strLstJoin(protocolRemoteParam(protocolStorageTypeRepo, 0), "|"), - "-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|pgbackrest@repo-host" - "|pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error" - " --pg1-path=/path/to/pg --process=3 --remote-type=repo --stanza=test1 archive-get:remote", + TEST_RESULT_STRLST_Z( + protocolRemoteParam(protocolStorageTypeRepo, 0), + "-o\nLogLevel=error\n-o\nCompression=no\n-o\nPasswordAuthentication=no\npgbackrest@repo-host\n" + "pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error" + " --pg1-path=/path/to/pg --process=3 --remote-type=repo --stanza=test1 archive-get:remote\n", "remote protocol params for backup local"); // ------------------------------------------------------------------------------------------------------------------------- @@ -325,11 +325,11 @@ testRun(void) strLstAddZ(argList, "backup"); harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList)); - TEST_RESULT_STR_Z( - strLstJoin(protocolRemoteParam(protocolStorageTypePg, 0), "|"), - "-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|postgres@pg1-host" - "|pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error" - " --pg1-path=/path/to/1 --process=0 --remote-type=pg --stanza=test1 backup:remote", + TEST_RESULT_STRLST_Z( + protocolRemoteParam(protocolStorageTypePg, 0), + "-o\nLogLevel=error\n-o\nCompression=no\n-o\nPasswordAuthentication=no\npostgres@pg1-host\n" + "pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error" + " --pg1-path=/path/to/1 --process=0 --remote-type=pg --stanza=test1 backup:remote\n", "remote protocol params for db backup"); // ------------------------------------------------------------------------------------------------------------------------- @@ -347,11 +347,11 @@ testRun(void) strLstAddZ(argList, CFGCMD_BACKUP ":" CONFIG_COMMAND_ROLE_LOCAL); harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList)); - TEST_RESULT_STR_Z( - strLstJoin(protocolRemoteParam(protocolStorageTypePg, 1), "|"), - "-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|postgres@pg2-host" - "|pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error" - " --pg1-path=/path/to/2 --process=4 --remote-type=pg --stanza=test1 backup:remote", + TEST_RESULT_STRLST_Z( + protocolRemoteParam(protocolStorageTypePg, 1), + "-o\nLogLevel=error\n-o\nCompression=no\n-o\nPasswordAuthentication=no\npostgres@pg2-host\n" + "pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error" + " --pg1-path=/path/to/2 --process=4 --remote-type=pg --stanza=test1 backup:remote\n", "remote protocol params for db local"); // ------------------------------------------------------------------------------------------------------------------------- @@ -369,12 +369,12 @@ testRun(void) strLstAddZ(argList, CFGCMD_BACKUP ":" CONFIG_COMMAND_ROLE_LOCAL); harnessCfgLoadRaw(strLstSize(argList), strLstPtr(argList)); - TEST_RESULT_STR_Z( - strLstJoin(protocolRemoteParam(protocolStorageTypePg, 1), "|"), - "-o|LogLevel=error|-o|Compression=no|-o|PasswordAuthentication=no|postgres@pg3-host" - "|pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error" + TEST_RESULT_STRLST_Z( + protocolRemoteParam(protocolStorageTypePg, 1), + "-o\nLogLevel=error\n-o\nCompression=no\n-o\nPasswordAuthentication=no\npostgres@pg3-host\n" + "pgbackrest --exec-id=1-test --log-level-console=off --log-level-file=off --log-level-stderr=error" " --pg1-path=/path/to/3 --pg1-port=3333 --pg1-socket-path=/socket3 --process=4 --remote-type=pg --stanza=test1" - " backup:remote", + " backup:remote\n", "remote protocol params for db local"); } diff --git a/test/src/module/storage/posixTest.c b/test/src/module/storage/posixTest.c index 2843f524f..e16465df3 100644 --- a/test/src/module/storage/posixTest.c +++ b/test/src/module/storage/posixTest.c @@ -455,17 +455,16 @@ testRun(void) // ------------------------------------------------------------------------------------------------------------------------- TEST_RESULT_VOID( storagePutP(storageNewWriteP(storageTest, strNew(".aaa.txt")), BUFSTRDEF("aaa")), "write aaa.text"); - TEST_RESULT_STR_Z( - strLstJoin(strLstSort(storageListP(storageTest, NULL), sortOrderAsc), ", "), - ".aaa.txt" + TEST_RESULT_STRLST_Z( + strLstSort(storageListP(storageTest, NULL), sortOrderAsc), ".aaa.txt\n" #ifdef TEST_CONTAINER_REQUIRED - ", noperm" + "noperm\n" #endif // TEST_CONTAINER_REQUIRED , "dir list"); TEST_RESULT_VOID( storagePutP(storageNewWriteP(storageTest, strNew("bbb.txt")), BUFSTRDEF("bbb")), "write bbb.text"); - TEST_RESULT_STR_Z(strLstJoin(storageListP(storageTest, NULL, .expression = strNew("^bbb")), ", "), "bbb.txt", "dir list"); + TEST_RESULT_STRLST_Z(storageListP(storageTest, NULL, .expression = strNew("^bbb")), "bbb.txt\n", "dir list"); } // *****************************************************************************************************************************