1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-01-30 05:39:12 +02:00

Update TEST_RESULT_PTR() to TEST_RESULT_STR() where appropriate.

These were missed in d41eea68 when the functionality of TEST_RESULT_STR() was changed. Using TEST_RESULT_STR() instead of TEST_RESULT_PTR() is more type-safe and clearer.

Add a comment to make it clear that TEST_RESULT_PTR() should be used only when a better alternative is not available.
This commit is contained in:
David Steele 2020-06-17 09:46:09 -04:00
parent c4fe09dabe
commit ea984c4d3e
20 changed files with 67 additions and 65 deletions

View File

@ -217,6 +217,8 @@ Macros to compare results of common data types
} \
while (0)
// Compare raw pointers. When checking for NULL use the type-specific macro when available, e.g. TEST_RESULT_STR(). This is more
// type-safe and makes it clearer what is being tested.
#define TEST_RESULT_PTR(statement, expected, ...) \
TEST_RESULT_PTR_PARAM(statement, expected, harnessTestResultOperationEq, __VA_ARGS__);
#define TEST_RESULT_PTR_NE(statement, expected, ...) \

View File

@ -231,10 +231,10 @@ testRun(void)
strLstAddZ(argList, "archive-get");
harnessCfgLoad(cfgCmdArchiveGet, argList);
TEST_RESULT_PTR(walSegmentFind(storageRepo(), strNew("9.6-2"), strNew("123456781234567812345678"), 0), NULL, "no path");
TEST_RESULT_STR(walSegmentFind(storageRepo(), strNew("9.6-2"), strNew("123456781234567812345678"), 0), NULL, "no path");
storagePathCreateP(storageTest, strNew("archive/db/9.6-2/1234567812345678"));
TEST_RESULT_PTR(walSegmentFind(storageRepo(), strNew("9.6-2"), strNew("123456781234567812345678"), 0), NULL, "no segment");
TEST_RESULT_STR(walSegmentFind(storageRepo(), strNew("9.6-2"), strNew("123456781234567812345678"), 0), NULL, "no segment");
TEST_ERROR(
walSegmentFind(storageRepo(), strNew("9.6-2"), strNew("123456781234567812345678"), 100), ArchiveTimeoutError,
"WAL segment 123456781234567812345678 was not archived before the 100ms timeout\n"
@ -281,7 +281,7 @@ testRun(void)
", 123456781234567812345678-bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.gz"
"\nHINT: are multiple primaries archiving to this stanza?");
TEST_RESULT_PTR(
TEST_RESULT_STR(
walSegmentFind(storageRepo(), strNew("9.6-2"), strNew("123456781234567812345678.partial"), 0), NULL,
"did not find partial segment");
}

View File

@ -76,7 +76,7 @@ testRun(void)
"3={\"db-id\":18072658121562454734,\"db-version\":\"9.6\"}\n"
"4={\"db-id\":18072658121562454734,\"db-version\":\"10\"}"));
TEST_RESULT_PTR(
TEST_RESULT_STR(
archiveGetCheck(strNew("876543218765432187654321"), cipherTypeNone, NULL).archiveFileActual, NULL, "no segment found");
// Write segment into an older archive path
@ -107,7 +107,7 @@ testRun(void)
// Get history file
// -------------------------------------------------------------------------------------------------------------------------
TEST_RESULT_PTR(
TEST_RESULT_STR(
archiveGetCheck(strNew("00000009.history"), cipherTypeNone, NULL).archiveFileActual, NULL, "history file not found");
storagePutP(storageNewWriteP(storageTest, strNew("repo/archive/test1/10-4/00000009.history")), NULL);

View File

@ -1200,7 +1200,7 @@ testRun(void)
}
MEM_CONTEXT_END();
TEST_RESULT_PTR(restoreSelectiveExpression(manifest), NULL, "all databases selected");
TEST_RESULT_STR(restoreSelectiveExpression(manifest), NULL, "all databases selected");
TEST_RESULT_LOG(
"P00 DETAIL: databases found for selective restore (1, 16384)\n"

View File

@ -145,7 +145,7 @@ testRun(void)
TEST_ERROR(iniGet(ini, strNew("section2"), strNew("key2")), FormatError, "section 'section2', key 'key2' does not exist");
TEST_RESULT_STR_Z(iniGetDefault(ini, strNew("section1"), strNew("key1"), NULL), "11", "get section, key, int");
TEST_RESULT_PTR(iniGetDefault(ini, strNew("section2"), strNew("key2"), NULL), NULL, "get section, key, NULL");
TEST_RESULT_STR(iniGetDefault(ini, strNew("section2"), strNew("key2"), NULL), NULL, "get section, key, NULL");
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");

View File

@ -20,7 +20,7 @@ testRun(void)
// *****************************************************************************************************************************
if (testBegin("httpUriEncode"))
{
TEST_RESULT_PTR(httpUriEncode(NULL, false), NULL, "null encodes to null");
TEST_RESULT_STR(httpUriEncode(NULL, false), NULL, "null encodes to null");
TEST_RESULT_STR_Z(httpUriEncode(strNew("0-9_~/A Z.az"), false), "0-9_~%2FA%20Z.az", "non-path encoding");
TEST_RESULT_STR_Z(httpUriEncode(strNew("0-9_~/A Z.az"), true), "0-9_~/A%20Z.az", "path encoding");
}
@ -58,7 +58,7 @@ testRun(void)
TEST_RESULT_STR_Z(httpHeaderGet(header, strNew("key1")), "value1", "get value");
TEST_RESULT_STR_Z(httpHeaderGet(header, strNew("key2")), "value2a, value2b", "get value");
TEST_RESULT_PTR(httpHeaderGet(header, strNew(BOGUS_STR)), NULL, "get missing value");
TEST_RESULT_STR(httpHeaderGet(header, strNew(BOGUS_STR)), NULL, "get missing value");
TEST_RESULT_STR_Z(httpHeaderToLog(header), "{key1: 'value1', key2: 'value2a, value2b'}", "log output");
@ -103,8 +103,8 @@ testRun(void)
}
MEM_CONTEXT_TEMP_END();
TEST_RESULT_PTR(httpQueryRender(NULL), NULL, "null query renders null");
TEST_RESULT_PTR(httpQueryRender(query), NULL, "empty query renders null");
TEST_RESULT_STR(httpQueryRender(NULL), NULL, "null query renders null");
TEST_RESULT_STR(httpQueryRender(query), NULL, "empty query renders null");
TEST_RESULT_PTR(httpQueryAdd(query, strNew("key2"), strNew("value2")), query, "add query");
TEST_ERROR(httpQueryAdd(query, strNew("key2"), strNew("value2")), AssertError, "key 'key2' already exists");
@ -117,7 +117,7 @@ testRun(void)
TEST_RESULT_STR_Z(httpQueryGet(query, strNew("key1")), "value 1?", "get value");
TEST_RESULT_STR_Z(httpQueryGet(query, strNew("key2")), "value2a", "get value");
TEST_RESULT_PTR(httpQueryGet(query, strNew(BOGUS_STR)), NULL, "get missing value");
TEST_RESULT_STR(httpQueryGet(query, strNew(BOGUS_STR)), NULL, "get missing value");
TEST_RESULT_STR_Z(httpQueryToLog(query), "{key1: 'value 1?', key2: 'value2a'}", "log output");
@ -132,7 +132,7 @@ testRun(void)
// Reset statistics
httpClientStatLocal = (HttpClientStat){0};
TEST_RESULT_PTR(httpClientStatStr(), NULL, "no stats yet");
TEST_RESULT_STR(httpClientStatStr(), NULL, "no stats yet");
TEST_ASSIGN(
client, httpClientNew(strNew("localhost"), hrnTlsServerPort(), 500, testContainer(), NULL, NULL),

View File

@ -364,9 +364,9 @@ testRun(void)
// Reset statistics
sckClientStatLocal = (SocketClientStat){0};
TEST_RESULT_PTR(sckClientStatStr(), NULL, "no stats yet");
TEST_RESULT_STR(sckClientStatStr(), NULL, "no stats yet");
tlsClientStatLocal = (TlsClientStat){0};
TEST_RESULT_PTR(tlsClientStatStr(), NULL, "no stats yet");
TEST_RESULT_STR(tlsClientStatStr(), NULL, "no stats yet");
HARNESS_FORK_BEGIN()
{

View File

@ -48,7 +48,7 @@ testRun(void)
TEST_RESULT_BOOL(regExpMatch(regExp, strNew("bcdef")), false, "no match regexp");
TEST_RESULT_PTR(regExpMatchPtr(regExp), NULL, "check ptr");
TEST_RESULT_UINT(regExpMatchSize(regExp), 0, "check size");
TEST_RESULT_PTR(regExpMatchStr(regExp), NULL, "check str");
TEST_RESULT_STR(regExpMatchStr(regExp), NULL, "check str");
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("free regexp");
@ -59,10 +59,10 @@ testRun(void)
// *****************************************************************************************************************************
if (testBegin("regExpPrefix()"))
{
TEST_RESULT_PTR(regExpPrefix(NULL), NULL, "null expression has no prefix");
TEST_RESULT_PTR(regExpPrefix(strNew("")), NULL, "empty expression has no prefix");
TEST_RESULT_PTR(regExpPrefix(strNew("ABC")), NULL, "expression without begin anchor has no prefix");
TEST_RESULT_PTR(regExpPrefix(strNew("^.")), NULL, "expression with no regular character has no prefix");
TEST_RESULT_STR(regExpPrefix(NULL), NULL, "null expression has no prefix");
TEST_RESULT_STR(regExpPrefix(strNew("")), NULL, "empty expression has no prefix");
TEST_RESULT_STR(regExpPrefix(strNew("ABC")), NULL, "expression without begin anchor has no prefix");
TEST_RESULT_STR(regExpPrefix(strNew("^.")), NULL, "expression with no regular character has no prefix");
TEST_RESULT_STR_Z(regExpPrefix(strNew("^ABC$")), "ABC", "prefix stops at special character");
TEST_RESULT_STR_Z(regExpPrefix(strNew("^ABC*")), "ABC", "prefix stops at special character");

View File

@ -40,7 +40,7 @@ testRun(void)
TEST_ERROR(jsonToStr(strNew("\"normal\"L")), JsonFormatError, "unexpected characters after string at 'L'");
TEST_ERROR(jsonToStr(strNew("nullz")), JsonFormatError, "unexpected characters after string at 'z'");
TEST_RESULT_PTR(jsonToStr(strNew("null")), NULL, "null string");
TEST_RESULT_STR(jsonToStr(strNew("null")), NULL, "null string");
TEST_RESULT_STR_Z(jsonToStr(strNew(" \"test\"")), "test", "simple string");
TEST_RESULT_STR_Z(jsonToStr(strNew("\"te\\\"st\" ")), "te\"st", "string with quote");
TEST_RESULT_STR_Z(jsonToStr(strNew("\"\\\"\\\\\\/\\b\\n\\r\\t\\f\"")), "\"\\/\b\n\r\t\f", "string with escapes");

View File

@ -47,7 +47,7 @@ testRun(void)
// -------------------------------------------------------------------------------------------------------------------------
string = strNewFmt("formatted %s %04d", "string", 1);
TEST_RESULT_STR_Z(string, "formatted string 0001", "new with formatted string");
TEST_RESULT_PTR(strPtr(NULL), NULL, "null string pointer");
TEST_RESULT_STR(NULL, NULL, "null string pointer");
TEST_RESULT_VOID(strFree(string), "free string");
TEST_RESULT_VOID(strFree(NULL), "free null string");
@ -120,7 +120,7 @@ testRun(void)
String *stringDup = strDup(string);
TEST_RESULT_STR(stringDup, string, "duplicated strings match");
TEST_RESULT_PTR(strDup(NULL), NULL, "duplicate null string");
TEST_RESULT_STR(strDup(NULL), NULL, "duplicate null string");
}
// *****************************************************************************************************************************
@ -290,7 +290,7 @@ testRun(void)
{
if (listIdx == 0)
{
TEST_RESULT_PTR(strLstAdd(list, NULL), NULL, "add null item");
TEST_RESULT_STR(strLstAdd(list, NULL), NULL, "add null item");
}
else
{
@ -311,7 +311,7 @@ testRun(void)
{
if (listIdx == 0)
{
TEST_RESULT_PTR(strLstGet(list, listIdx), NULL, "check null item");
TEST_RESULT_STR(strLstGet(list, listIdx), NULL, "check null item");
}
else
{

View File

@ -294,14 +294,14 @@ testRun(void)
TEST_RESULT_UINT(sizeof(VariantString), TEST_64BIT() ? 24 : 12, "check VariantString size");
// -------------------------------------------------------------------------------------------------------------------------
TEST_RESULT_PTR(strPtr(varStr(varNewStr(NULL))), NULL, "new null str");
TEST_RESULT_STR(varStr(varNewStr(NULL)), NULL, "new null str");
// -------------------------------------------------------------------------------------------------------------------------
Variant *string = varNewStr(strNew("test-str"));
TEST_RESULT_STR_Z(varStr(string), "test-str", "string pointer");
varFree(string);
TEST_RESULT_PTR(varStr(NULL), NULL, "get null string variant");
TEST_RESULT_STR(varStr(NULL), NULL, "get null string variant");
// -------------------------------------------------------------------------------------------------------------------------
TEST_ERROR(varStr(varNewBool(true)), AssertError, "assertion 'this->type == varTypeString' failed");
@ -338,8 +338,8 @@ testRun(void)
// -------------------------------------------------------------------------------------------------------------------------
TEST_RESULT_STR_Z(varStr(VARSTRDEF("test-z-str")), "test-z-str", "new zero-terminated string");
TEST_RESULT_PTR(strPtr(varStr(VARSTR(NULL))), NULL, "new null strz");
TEST_RESULT_PTR(strPtr(varStr(varNewStrZ(NULL))), NULL, "new null strz");
TEST_RESULT_STR(varStr(VARSTR(NULL)), NULL, "new null strz");
TEST_RESULT_STR(varStr(varNewStrZ(NULL)), NULL, "new null strz");
// -------------------------------------------------------------------------------------------------------------------------
TEST_RESULT_STR_Z(varStr(varDup(VARSTRDEF("yabba-dabba-doo"))), "yabba-dabba-doo", "dup string");

View File

@ -50,7 +50,7 @@ testRun(void)
TEST_ASSIGN(nodeMaxKeys, xmlNodeChild(rootNode, strNew("MaxKeys"), true), "get max keys");
TEST_RESULT_STR_Z(xmlNodeContent(nodeMaxKeys), "1000", " check MaxKeys content");
TEST_RESULT_PTR(xmlNodeContent(NULL), NULL, " get null content for null node");
TEST_RESULT_STR(xmlNodeContent(NULL), NULL, " get null content for null node");
TEST_RESULT_VOID(xmlNodeFree(nodeMaxKeys), "free node");
TEST_RESULT_VOID(xmlNodeFree(NULL), "free null node");
@ -79,7 +79,7 @@ testRun(void)
"unable to find child 'Contents':2 in node 'ListBucketResult'");
TEST_RESULT_PTR(xmlNodeChildN(rootNode, strNew("Contents"), 2, false), NULL, "get missing child without error");
TEST_RESULT_PTR(xmlNodeAttribute(rootNode, strNew(BOGUS_STR)), NULL, "attempt to get missing attribute");
TEST_RESULT_STR(xmlNodeAttribute(rootNode, strNew(BOGUS_STR)), NULL, "attempt to get missing attribute");
TEST_RESULT_STR_Z(xmlNodeAttribute(xmlNodeChild(rootNode, strNew("Name"), true), strNew("id")), "test", "get attribute");
TEST_RESULT_VOID(xmlDocumentFree(xmlDocument), "free xmldoc");

View File

@ -121,7 +121,7 @@ testRun(void)
TEST_RESULT_INT(strLstSize(cfgCommandParam()), 1, "command param list is set");
// -------------------------------------------------------------------------------------------------------------------------
TEST_RESULT_PTR(cfgExe(), NULL, "exe defaults to null");
TEST_RESULT_STR(cfgExe(), NULL, "exe defaults to null");
TEST_RESULT_VOID(cfgExeSet(strNew("/path/to/exe")), "set exe");
TEST_RESULT_Z(strPtr(cfgExe()), "/path/to/exe", "exe is set");
@ -200,7 +200,7 @@ testRun(void)
TEST_ERROR(cfgOptionStr(cfgOptStanza), AssertError, "option 'stanza' is not valid for the current command");
TEST_RESULT_VOID(cfgOptionValidSet(cfgOptStanza, true), "set stanza valid");
TEST_ERROR(cfgOptionStr(cfgOptStanza), AssertError, "option 'stanza' is null but non-null was requested");
TEST_RESULT_PTR(cfgOptionStrNull(cfgOptStanza), NULL, "stanza defaults to null");
TEST_RESULT_STR(cfgOptionStrNull(cfgOptStanza), NULL, "stanza defaults to null");
TEST_ERROR(
cfgOptionSet(cfgOptStanza, cfgSourceParam, varNewDbl(1.1)), AssertError,
"option 'stanza' must be set with String variant");

View File

@ -38,7 +38,7 @@ testRun(void)
TEST_ASSIGN(info, infoArchiveNewLoad(ioBufferReadNew(contentLoad)), " load new archive info");
TEST_RESULT_STR_Z(infoArchiveId(info), "9.4-1", " archiveId set");
TEST_RESULT_PTR(infoArchivePg(info), info->infoPg, " infoPg set");
TEST_RESULT_PTR(infoArchiveCipherPass(info), NULL, " no cipher sub");
TEST_RESULT_STR(infoArchiveCipherPass(info), NULL, " no cipher sub");
// Save info and verify
Buffer *contentSave = bufNew(0);
@ -52,7 +52,7 @@ testRun(void)
info, infoArchiveNew(PG_VERSION_94, 6569239123849665679, NULL), "infoArchiveNew() - no sub cipher");
TEST_RESULT_STR_Z(infoArchiveId(info), "9.4-1", " archiveId set");
TEST_RESULT_PTR(infoArchivePg(info), info->infoPg, " infoPg set");
TEST_RESULT_PTR(infoArchiveCipherPass(info), NULL, " no cipher sub");
TEST_RESULT_STR(infoArchiveCipherPass(info), NULL, " no cipher sub");
TEST_RESULT_INT(infoPgDataTotal(info->infoPg), 1, " history set");
Buffer *contentCompare = bufNew(0);

View File

@ -60,7 +60,7 @@ testRun(void)
TEST_ASSIGN(infoBackup, infoBackupNewLoad(ioBufferReadNew(contentCompare)), "load backup info");
TEST_RESULT_PTR(infoBackupPg(infoBackup), infoBackup->infoPg, " infoPg set");
TEST_RESULT_PTR(infoBackupCipherPass(infoBackup), NULL, " cipher sub not set");
TEST_RESULT_STR(infoBackupCipherPass(infoBackup), NULL, " cipher sub not set");
TEST_RESULT_INT(infoBackupDataTotal(infoBackup), 0, " infoBackupDataTotal returns 0");
// Check cipher pass
@ -150,7 +150,7 @@ testRun(void)
TEST_RESULT_UINT(backupData.backupInfoSize, 26897030, " backup size");
TEST_RESULT_UINT(backupData.backupInfoSizeDelta, 26897030, " backup delta");
TEST_RESULT_INT(backupData.backupPgId, 1, " pg id");
TEST_RESULT_PTR(backupData.backupPrior, NULL, " backup prior NULL");
TEST_RESULT_STR(backupData.backupPrior, NULL, " backup prior NULL");
TEST_RESULT_PTR(backupData.backupReference, NULL, " backup reference NULL");
TEST_RESULT_INT(backupData.backupTimestampStart, 1482182846, " timestamp start");
TEST_RESULT_INT(backupData.backupTimestampStop, 1482182861, " timestamp stop");
@ -170,8 +170,8 @@ testRun(void)
backupData = infoBackupData(infoBackup, 2);
TEST_RESULT_STR_Z(backupData.backupLabel, "20161219-212741F_20161219-212918I", "incr backup label");
TEST_RESULT_PTR(backupData.backupArchiveStart, NULL, " archive start NULL");
TEST_RESULT_PTR(backupData.backupArchiveStop, NULL, " archive stop NULL");
TEST_RESULT_STR(backupData.backupArchiveStart, NULL, " archive start NULL");
TEST_RESULT_STR(backupData.backupArchiveStop, NULL, " archive stop NULL");
TEST_RESULT_STR_Z(backupData.backupType, "incr", " backup type incr");
TEST_RESULT_STR_Z(backupData.backupPrior, "20161219-212741F", " backup prior exists");
TEST_RESULT_BOOL(
@ -304,10 +304,10 @@ testRun(void)
TEST_RESULT_UINT(backupData.backrestFormat, REPOSITORY_FORMAT, "backrest format");
TEST_RESULT_STR_Z(backupData.backrestVersion, PROJECT_VERSION, "backuprest version");
TEST_RESULT_INT(backupData.backupPgId, 1, "pg id");
TEST_RESULT_PTR(backupData.backupArchiveStart, NULL, "archive start NULL");
TEST_RESULT_PTR(backupData.backupArchiveStop, NULL, "archive stop NULL");
TEST_RESULT_STR(backupData.backupArchiveStart, NULL, "archive start NULL");
TEST_RESULT_STR(backupData.backupArchiveStop, NULL, "archive stop NULL");
TEST_RESULT_STR_Z(backupData.backupType, "full", "backup type set");
TEST_RESULT_PTR(strPtr(backupData.backupPrior), NULL, "no backup prior");
TEST_RESULT_STR(backupData.backupPrior, NULL, "no backup prior");
TEST_RESULT_PTR(backupData.backupReference, NULL, "no backup reference");
TEST_RESULT_INT(backupData.backupTimestampStart, 1565282140, "timestamp start");
TEST_RESULT_INT(backupData.backupTimestampStop, 1565282142, "timestamp stop");

View File

@ -122,7 +122,7 @@ testRun(void)
TEST_RESULT_UINT(pgData.systemId, 6569239123849665679, " system-id set");
TEST_RESULT_INT(infoPgDataTotal(infoPg), 1, " check pg data total");
TEST_RESULT_STR_Z(infoPgArchiveId(infoPg, 0), "9.4-1", " check pg archive id");
TEST_RESULT_PTR(infoPgCipherPass(infoPg), NULL, " no cipher passphrase");
TEST_RESULT_STR(infoPgCipherPass(infoPg), NULL, " no cipher passphrase");
Buffer *contentSave = bufNew(0);

View File

@ -82,7 +82,7 @@ testRun(void)
TEST_RESULT_STR_Z(infoCipherPass(info), "123xyz", " cipherPass is set");
TEST_ASSIGN(info, infoNew(NULL), "infoNew(NULL)");
TEST_RESULT_PTR(infoCipherPass(info), NULL, " cipherPass is NULL");
TEST_RESULT_STR(infoCipherPass(info), NULL, " cipherPass is NULL");
}
// *****************************************************************************************************************************
@ -155,7 +155,7 @@ testRun(void)
TEST_ASSIGN(
info, infoNewLoad(ioBufferReadNew(contentLoad), harnessInfoLoadNewCallback, callbackContent), "info with other cipher");
TEST_RESULT_STR_Z(callbackContent, "", " check callback content");
TEST_RESULT_PTR(infoCipherPass(info), NULL, " check cipher pass not set");
TEST_RESULT_STR(infoCipherPass(info), NULL, " check cipher pass not set");
// Base file with content
// --------------------------------------------------------------------------------------------------------------------------
@ -171,7 +171,7 @@ testRun(void)
TEST_ASSIGN(
info, infoNewLoad(ioBufferReadNew(contentLoad), harnessInfoLoadNewCallback, callbackContent), "info with content");
TEST_RESULT_STR_Z(callbackContent, "[c] key=1\n[d] key=1\n", " check callback content");
TEST_RESULT_PTR(infoCipherPass(info), NULL, " check cipher pass not set");
TEST_RESULT_STR(infoCipherPass(info), NULL, " check cipher pass not set");
Buffer *contentSave = bufNew(0);

View File

@ -107,7 +107,7 @@ testRun(void)
TEST_RESULT_PTR(storageInterface(storageTest).info, storageTest->interface.info, " check interface");
TEST_RESULT_PTR(storageDriver(storageTest), storageTest->driver, " check driver");
TEST_RESULT_PTR(storageType(storageTest), storageTest->type, " check type");
TEST_RESULT_STR(storageType(storageTest), storageTest->type, " check type");
TEST_RESULT_BOOL(storageFeature(storageTest, storageFeaturePath), true, " check path feature");
TEST_RESULT_BOOL(storageFeature(storageTest, storageFeatureCompress), true, " check compress feature");
@ -209,13 +209,13 @@ testRun(void)
THROW_ON_SYS_ERROR_FMT(utime(testPath(), &utimeTest) != 0, FileWriteError, "unable to set time for '%s'", testPath());
TEST_ASSIGN(info, storageInfoP(storageTest, strNew(testPath())), "get path info");
TEST_RESULT_PTR(info.name, NULL, " name is not set");
TEST_RESULT_STR(info.name, NULL, " name is not set");
TEST_RESULT_BOOL(info.exists, true, " check exists");
TEST_RESULT_INT(info.type, storageTypePath, " check type");
TEST_RESULT_UINT(info.size, 0, " check size");
TEST_RESULT_INT(info.mode, 0770, " check mode");
TEST_RESULT_INT(info.timeModified, 1555160000, " check mod time");
TEST_RESULT_PTR(info.linkDestination, NULL, " no link destination");
TEST_RESULT_STR(info.linkDestination, NULL, " no link destination");
TEST_RESULT_UINT(info.userId, getuid(), " check user id");
TEST_RESULT_STR_Z(info.user, testUser(), " check user");
TEST_RESULT_UINT(info.groupId, getgid(), " check group id");
@ -233,13 +233,13 @@ testRun(void)
#endif // TEST_CONTAINER_REQUIRED
TEST_ASSIGN(info, storageInfoP(storageTest, fileName), "get file info");
TEST_RESULT_PTR(info.name, NULL, " name is not set");
TEST_RESULT_STR(info.name, NULL, " name is not set");
TEST_RESULT_BOOL(info.exists, true, " check exists");
TEST_RESULT_INT(info.type, storageTypeFile, " check type");
TEST_RESULT_UINT(info.size, 8, " check size");
TEST_RESULT_INT(info.mode, 0640, " check mode");
TEST_RESULT_INT(info.timeModified, 1555155555, " check mod time");
TEST_RESULT_PTR(info.linkDestination, NULL, " no link destination");
TEST_RESULT_STR(info.linkDestination, NULL, " no link destination");
#ifdef TEST_CONTAINER_REQUIRED
TEST_RESULT_STR(info.user, NULL, " check user");
TEST_RESULT_STR(info.group, NULL, " check group");
@ -252,7 +252,7 @@ testRun(void)
TEST_RESULT_INT(system(strPtr(strNewFmt("ln -s /tmp %s", strPtr(linkName)))), 0, "create link");
TEST_ASSIGN(info, storageInfoP(storageTest, linkName), "get link info");
TEST_RESULT_PTR(info.name, NULL, " name is not set");
TEST_RESULT_STR(info.name, NULL, " name is not set");
TEST_RESULT_BOOL(info.exists, true, " check exists");
TEST_RESULT_INT(info.type, storageTypeLink, " check type");
TEST_RESULT_UINT(info.size, 0, " check size");
@ -262,7 +262,7 @@ testRun(void)
TEST_RESULT_STR_Z(info.group, testGroup(), " check group");
TEST_ASSIGN(info, storageInfoP(storageTest, linkName, .followLink = true), "get info from path pointed to by link");
TEST_RESULT_PTR(info.name, NULL, " name is not set");
TEST_RESULT_STR(info.name, NULL, " name is not set");
TEST_RESULT_BOOL(info.exists, true, " check exists");
TEST_RESULT_INT(info.type, storageTypePath, " check type");
TEST_RESULT_UINT(info.size, 0, " check size");
@ -278,7 +278,7 @@ testRun(void)
TEST_RESULT_INT(system(strPtr(strNewFmt("mkfifo -m 666 %s", strPtr(pipeName)))), 0, "create pipe");
TEST_ASSIGN(info, storageInfoP(storageTest, pipeName), "get info from pipe (special file)");
TEST_RESULT_PTR(info.name, NULL, " name is not set");
TEST_RESULT_STR(info.name, NULL, " name is not set");
TEST_RESULT_BOOL(info.exists, true, " check exists");
TEST_RESULT_INT(info.type, storageTypeSpecial, " check type");
TEST_RESULT_UINT(info.size, 0, " check size");
@ -1209,7 +1209,7 @@ testRun(void)
harnessCfgLoad(cfgCmdInfo, argList);
TEST_ASSIGN(storage, storageRepo(), "new repo storage no stanza");
TEST_RESULT_PTR(storageHelper.stanza, NULL, "stanza NULL");
TEST_RESULT_STR(storageHelper.stanza, NULL, "stanza NULL");
TEST_RESULT_STR(
storagePathP(storage, STORAGE_REPO_ARCHIVE_STR), strNewFmt("%s/archive", testPath()),

View File

@ -112,13 +112,13 @@ testRun(void)
StorageInfo info = {.exists = false};
TEST_ASSIGN(info, storageInfoP(storageRemote, NULL), "valid path");
TEST_RESULT_PTR(info.name, NULL, " name is not set");
TEST_RESULT_STR(info.name, NULL, " name is not set");
TEST_RESULT_BOOL(info.exists, true, " check exists");
TEST_RESULT_INT(info.type, storageTypePath, " check type");
TEST_RESULT_UINT(info.size, 0, " check size");
TEST_RESULT_INT(info.mode, 0750, " check mode");
TEST_RESULT_INT(info.timeModified, 1555160000, " check mod time");
TEST_RESULT_PTR(info.linkDestination, NULL, " no link destination");
TEST_RESULT_STR(info.linkDestination, NULL, " no link destination");
TEST_RESULT_UINT(info.userId, getuid(), " check user id");
TEST_RESULT_STR_Z(info.user, testUser(), " check user");
TEST_RESULT_UINT(info.groupId, getgid(), " check group id");
@ -130,13 +130,13 @@ testRun(void)
storagePutP(storageNewWriteP(storageRemote, strNew("test"), .timeModified = 1555160001), BUFSTRDEF("TESTME"));
TEST_ASSIGN(info, storageInfoP(storageRemote, strNew("test")), "valid file");
TEST_RESULT_PTR(info.name, NULL, " name is not set");
TEST_RESULT_STR(info.name, NULL, " name is not set");
TEST_RESULT_BOOL(info.exists, true, " check exists");
TEST_RESULT_INT(info.type, storageTypeFile, " check type");
TEST_RESULT_UINT(info.size, 6, " check size");
TEST_RESULT_INT(info.mode, 0640, " check mode");
TEST_RESULT_INT(info.timeModified, 1555160001, " check mod time");
TEST_RESULT_PTR(info.linkDestination, NULL, " no link destination");
TEST_RESULT_STR(info.linkDestination, NULL, " no link destination");
TEST_RESULT_UINT(info.userId, getuid(), " check user id");
TEST_RESULT_STR_Z(info.user, testUser(), " check user");
TEST_RESULT_UINT(info.groupId, getgid(), " check group id");
@ -148,12 +148,12 @@ testRun(void)
TEST_SYSTEM_FMT("mkfifo -m 666 %s", strPtr(storagePathP(storageTest, strNew("repo/fifo"))));
TEST_ASSIGN(info, storageInfoP(storageRemote, strNew("fifo")), "valid fifo");
TEST_RESULT_PTR(info.name, NULL, " name is not set");
TEST_RESULT_STR(info.name, NULL, " name is not set");
TEST_RESULT_BOOL(info.exists, true, " check exists");
TEST_RESULT_INT(info.type, storageTypeSpecial, " check type");
TEST_RESULT_UINT(info.size, 0, " check size");
TEST_RESULT_INT(info.mode, 0666, " check mode");
TEST_RESULT_PTR(info.linkDestination, NULL, " no link destination");
TEST_RESULT_STR(info.linkDestination, NULL, " no link destination");
TEST_RESULT_UINT(info.userId, getuid(), " check user id");
TEST_RESULT_STR_Z(info.user, testUser(), " check user");
TEST_RESULT_UINT(info.groupId, getgid(), " check group id");
@ -165,7 +165,7 @@ testRun(void)
TEST_SYSTEM_FMT("ln -s ../repo/test %s", strPtr(storagePathP(storageTest, strNew("repo/link"))));
TEST_ASSIGN(info, storageInfoP(storageRemote, strNew("link")), "valid link");
TEST_RESULT_PTR(info.name, NULL, " name is not set");
TEST_RESULT_STR(info.name, NULL, " name is not set");
TEST_RESULT_BOOL(info.exists, true, " check exists");
TEST_RESULT_INT(info.type, storageTypeLink, " check type");
TEST_RESULT_UINT(info.size, 0, " check size");
@ -180,12 +180,12 @@ testRun(void)
TEST_TITLE("link info follow");
TEST_ASSIGN(info, storageInfoP(storageRemote, strNew("link"), .followLink = true), "valid link follow");
TEST_RESULT_PTR(info.name, NULL, " name is not set");
TEST_RESULT_STR(info.name, NULL, " name is not set");
TEST_RESULT_BOOL(info.exists, true, " check exists");
TEST_RESULT_INT(info.type, storageTypeFile, " check type");
TEST_RESULT_UINT(info.size, 6, " check size");
TEST_RESULT_INT(info.mode, 0640, " check mode");
TEST_RESULT_PTR(info.linkDestination, NULL, " no link destination");
TEST_RESULT_STR(info.linkDestination, NULL, " no link destination");
TEST_RESULT_UINT(info.userId, getuid(), " check user id");
TEST_RESULT_STR_Z(info.user, testUser(), " check user");
TEST_RESULT_UINT(info.groupId, getgid(), " check group id");

View File

@ -187,7 +187,7 @@ testRun(void)
((StorageS3 *)storage->driver)->bucketEndpoint, strNewFmt("%s.%s", strPtr(bucket), strPtr(endPoint)), " check host");
TEST_RESULT_STR(((StorageS3 *)storage->driver)->accessKey, accessKey, " check access key");
TEST_RESULT_STR(((StorageS3 *)storage->driver)->secretAccessKey, secretAccessKey, " check secret access key");
TEST_RESULT_PTR(((StorageS3 *)storage->driver)->securityToken, NULL, " check security token");
TEST_RESULT_STR(((StorageS3 *)storage->driver)->securityToken, NULL, " check security token");
TEST_RESULT_BOOL(storageFeature(storage, storageFeaturePath), false, " check path feature");
TEST_RESULT_BOOL(storageFeature(storage, storageFeatureCompress), false, " check compress feature");