You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-07-15 01:04:37 +02:00
Rename TEST_SYSTEM*() to HRN_SYSTEM*().
These calls are not tests, rather they setup data for tests.
This commit is contained in:
@ -250,9 +250,9 @@ Macros to compare results of common data types
|
||||
TEST_RESULT_UINT_INT_PARAM(statement, expected, harnessTestResultOperationEq, comment)
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
Test system calls
|
||||
System call harness
|
||||
***********************************************************************************************************************************/
|
||||
#define TEST_SYSTEM(command) \
|
||||
#define HRN_SYSTEM(command) \
|
||||
do \
|
||||
{ \
|
||||
int TEST_SYSTEM_FMT_result = system(command); \
|
||||
@ -265,7 +265,7 @@ Test system calls
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define TEST_SYSTEM_FMT(...) \
|
||||
#define HRN_SYSTEM_FMT(...) \
|
||||
do \
|
||||
{ \
|
||||
char TEST_SYSTEM_FMT_buffer[8192]; \
|
||||
@ -273,7 +273,7 @@ Test system calls
|
||||
if (snprintf(TEST_SYSTEM_FMT_buffer, sizeof(TEST_SYSTEM_FMT_buffer), __VA_ARGS__) >= (int)sizeof(TEST_SYSTEM_FMT_buffer)) \
|
||||
THROW_FMT(AssertError, "command needs more than the %zu characters available", sizeof(TEST_SYSTEM_FMT_buffer)); \
|
||||
\
|
||||
TEST_SYSTEM(TEST_SYSTEM_FMT_buffer); \
|
||||
HRN_SYSTEM(TEST_SYSTEM_FMT_buffer); \
|
||||
} while (0)
|
||||
|
||||
/***********************************************************************************************************************************
|
||||
|
@ -1977,7 +1977,7 @@ testRun(void)
|
||||
FileOpenError, "unable to create symlink");
|
||||
|
||||
// Special files should not be in the repo
|
||||
TEST_SYSTEM_FMT(
|
||||
HRN_SYSTEM_FMT(
|
||||
"mkfifo -m 666 %s",
|
||||
strZ(storagePathP(storageRepo(), strNewFmt(STORAGE_REPO_BACKUP "/%s/pg_data/pipe", strZ(resumeLabel)))));
|
||||
|
||||
@ -2255,8 +2255,8 @@ testRun(void)
|
||||
|
||||
// Move pg1-path and put a link in its place. This tests that backup works when pg1-path is a symlink yet should be
|
||||
// completely invisible in the manifest and logging.
|
||||
TEST_SYSTEM_FMT("mv %s %s-data", strZ(pg1Path), strZ(pg1Path));
|
||||
TEST_SYSTEM_FMT("ln -s %s-data %s ", strZ(pg1Path), strZ(pg1Path));
|
||||
HRN_SYSTEM_FMT("mv %s %s-data", strZ(pg1Path), strZ(pg1Path));
|
||||
HRN_SYSTEM_FMT("ln -s %s-data %s ", strZ(pg1Path), strZ(pg1Path));
|
||||
|
||||
// Zeroed file which passes page checksums
|
||||
Buffer *relation = bufNew(PG_PAGE_SIZE_DEFAULT);
|
||||
|
@ -852,8 +852,8 @@ testRun(void)
|
||||
TEST_TITLE("expire via backup command");
|
||||
|
||||
// Copy the repo to another repo
|
||||
TEST_SYSTEM("mkdir " TEST_PATH "/repo2");
|
||||
TEST_SYSTEM("cp -r " TEST_PATH "/repo/* " TEST_PATH "/repo2/");
|
||||
HRN_SYSTEM("mkdir " TEST_PATH "/repo2");
|
||||
HRN_SYSTEM("cp -r " TEST_PATH "/repo/* " TEST_PATH "/repo2/");
|
||||
|
||||
// Configure multi-repo and set the repo option to expire the second repo (non-default) files
|
||||
argList = strLstDup(argListBase);
|
||||
|
@ -969,7 +969,7 @@ testRun(void)
|
||||
manifestPathAdd(manifest, &path);
|
||||
manifestFileAdd(manifest, &file);
|
||||
|
||||
TEST_SYSTEM_FMT("sudo chown 77777:77777 %s", strZ(pgPath));
|
||||
HRN_SYSTEM_FMT("sudo chown 77777:77777 %s", strZ(pgPath));
|
||||
|
||||
userLocalData.userName = STRDEF("root");
|
||||
userLocalData.groupName = STRDEF("root");
|
||||
@ -1101,7 +1101,7 @@ testRun(void)
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("succeed when all directories empty and ignore recovery.conf");
|
||||
|
||||
TEST_SYSTEM_FMT("rm -rf %s/*", strZ(pgPath));
|
||||
HRN_SYSTEM_FMT("rm -rf %s/*", strZ(pgPath));
|
||||
|
||||
argList = strLstNew();
|
||||
strLstAddZ(argList, "--stanza=test1");
|
||||
@ -1117,7 +1117,7 @@ testRun(void)
|
||||
"P00 DETAIL: check '" TEST_PATH "/conf' exists\n"
|
||||
"P00 DETAIL: create symlink '" TEST_PATH "/pg/pg_hba.conf' to '../conf/pg_hba.conf'");
|
||||
|
||||
TEST_SYSTEM_FMT("rm -rf %s/*", strZ(pgPath));
|
||||
HRN_SYSTEM_FMT("rm -rf %s/*", strZ(pgPath));
|
||||
|
||||
storagePutP(storageNewWriteP(storagePgWrite(), PG_FILE_RECOVERYCONF_STR), NULL);
|
||||
TEST_RESULT_VOID(restoreCleanBuild(manifest), "normal restore ignore recovery.conf");
|
||||
@ -1130,7 +1130,7 @@ testRun(void)
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("succeed when all directories empty and PG12 and preserve but no recovery files");
|
||||
|
||||
TEST_SYSTEM_FMT("rm -rf %s/*", strZ(pgPath));
|
||||
HRN_SYSTEM_FMT("rm -rf %s/*", strZ(pgPath));
|
||||
|
||||
manifest->pub.data.pgVersion = PG_VERSION_12;
|
||||
|
||||
@ -1144,7 +1144,7 @@ testRun(void)
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("succeed when all directories empty and ignore PG12 recovery files");
|
||||
|
||||
TEST_SYSTEM_FMT("rm -rf %s/*", strZ(pgPath));
|
||||
HRN_SYSTEM_FMT("rm -rf %s/*", strZ(pgPath));
|
||||
|
||||
manifestFileAdd(manifest, &(ManifestFile){.name = STRDEF(MANIFEST_TARGET_PGDATA "/" PG_FILE_POSTGRESQLAUTOCONF)});
|
||||
|
||||
@ -1163,7 +1163,7 @@ testRun(void)
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("succeed when all directories empty and PG12");
|
||||
|
||||
TEST_SYSTEM_FMT("rm -rf %s/*", strZ(pgPath));
|
||||
HRN_SYSTEM_FMT("rm -rf %s/*", strZ(pgPath));
|
||||
|
||||
argList = strLstNew();
|
||||
strLstAddZ(argList, "--stanza=test1");
|
||||
@ -1734,7 +1734,7 @@ testRun(void)
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("PG12 restore type none");
|
||||
|
||||
TEST_SYSTEM_FMT("rm -rf %s/*", strZ(pgPath));
|
||||
HRN_SYSTEM_FMT("rm -rf %s/*", strZ(pgPath));
|
||||
|
||||
storagePutP(
|
||||
storageNewWriteP(storagePgWrite(), PG_FILE_POSTGRESQLAUTOCONF_STR),
|
||||
@ -1757,7 +1757,7 @@ testRun(void)
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("PG12 restore type standby and remove existing recovery settings");
|
||||
|
||||
TEST_SYSTEM_FMT("rm -rf %s/*", strZ(pgPath));
|
||||
HRN_SYSTEM_FMT("rm -rf %s/*", strZ(pgPath));
|
||||
|
||||
storagePutP(
|
||||
storageNewWriteP(storagePgWrite(), PG_FILE_POSTGRESQLAUTOCONF_STR),
|
||||
@ -1795,7 +1795,7 @@ testRun(void)
|
||||
|
||||
Manifest *manifest = testManifestMinimal(STRDEF("20161219-212741F"), PG_VERSION_12, STRDEF("/pg"));
|
||||
|
||||
TEST_SYSTEM_FMT("rm -rf %s/*", strZ(pgPath));
|
||||
HRN_SYSTEM_FMT("rm -rf %s/*", strZ(pgPath));
|
||||
|
||||
storagePutP(storageNewWriteP(storagePgWrite(), PG_FILE_POSTGRESQLAUTOCONF_STR), BUFSTRDEF("# DO NOT MODIFY\n"));
|
||||
storagePutP(storageNewWriteP(storagePgWrite(), PG_FILE_STANDBYSIGNAL_STR), NULL);
|
||||
@ -1818,7 +1818,7 @@ testRun(void)
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("PG12 restore type default");
|
||||
|
||||
TEST_SYSTEM_FMT("rm -rf %s/*", strZ(pgPath));
|
||||
HRN_SYSTEM_FMT("rm -rf %s/*", strZ(pgPath));
|
||||
|
||||
storagePutP(
|
||||
storageNewWriteP(storagePgWrite(), PG_FILE_POSTGRESQLAUTOCONF_STR),
|
||||
@ -2062,7 +2062,7 @@ testRun(void)
|
||||
storagePutP(storageNewWriteP(storagePgWrite(), STRDEF("bogus-file")), NULL);
|
||||
|
||||
// Add a special file that will be removed
|
||||
TEST_SYSTEM_FMT("mkfifo %s/pipe", strZ(pgPath));
|
||||
HRN_SYSTEM_FMT("mkfifo %s/pipe", strZ(pgPath));
|
||||
|
||||
// Overwrite PG_VERSION with bogus content that will not be detected by delta force because the time and size are the same
|
||||
storagePutP(
|
||||
@ -2603,8 +2603,8 @@ testRun(void)
|
||||
|
||||
// Move pg1-path and put a link in its place. This tests that restore works when pg1-path is a symlink yet should be
|
||||
// completely invisible in the manifest and logging.
|
||||
TEST_SYSTEM_FMT("mv %s %s-data", strZ(pgPath), strZ(pgPath));
|
||||
TEST_SYSTEM_FMT("ln -s %s-data %s ", strZ(pgPath), strZ(pgPath));
|
||||
HRN_SYSTEM_FMT("mv %s %s-data", strZ(pgPath), strZ(pgPath));
|
||||
HRN_SYSTEM_FMT("ln -s %s-data %s ", strZ(pgPath), strZ(pgPath));
|
||||
|
||||
// Create the stanza archive pool path to check that it gets removed
|
||||
HRN_STORAGE_PUT_EMPTY(storageSpoolWrite(), STORAGE_SPOOL_ARCHIVE "/empty.txt");
|
||||
|
@ -98,7 +98,7 @@ testSuite(CompressType type, const char *decompressCmd)
|
||||
TEST_TITLE("compressed output can be decompressed with command-line tool");
|
||||
|
||||
storagePutP(storageNewWriteP(storageTest, STRDEF("test.cmp")), compressed);
|
||||
TEST_SYSTEM_FMT("%s " TEST_PATH "/test.cmp > " TEST_PATH "/test.out", decompressCmd);
|
||||
HRN_SYSTEM_FMT("%s " TEST_PATH "/test.cmp > " TEST_PATH "/test.out", decompressCmd);
|
||||
TEST_RESULT_BOOL(bufEq(decompressed, storageGetP(storageNewReadP(storageTest, STRDEF("test.out")))), true, "check output");
|
||||
|
||||
TEST_RESULT_BOOL(
|
||||
|
@ -138,7 +138,7 @@ testRun(void)
|
||||
const String *fileExists = STRDEF(TEST_PATH "/exists");
|
||||
const String *pathExists = STRDEF(TEST_PATH "/pathExists");
|
||||
TEST_RESULT_INT(system(strZ(strNewFmt("touch %s", strZ(fileExists)))), 0, "create exists file");
|
||||
TEST_SYSTEM_FMT("mkdir %s", strZ(pathExists));
|
||||
HRN_SYSTEM_FMT("mkdir %s", strZ(pathExists));
|
||||
|
||||
TEST_RESULT_BOOL(storageExistsP(storageTest, fileExists), true, "file exists");
|
||||
TEST_RESULT_BOOL(storageExistsP(storageTest, pathExists), false, "not a file");
|
||||
|
@ -147,7 +147,7 @@ testRun(void)
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("special info");
|
||||
|
||||
TEST_SYSTEM_FMT("mkfifo -m 666 %s", strZ(storagePathP(storageTest, STRDEF("repo/fifo"))));
|
||||
HRN_SYSTEM_FMT("mkfifo -m 666 %s", strZ(storagePathP(storageTest, STRDEF("repo/fifo"))));
|
||||
|
||||
TEST_ASSIGN(info, storageInfoP(storageRemote, STRDEF("fifo")), "valid fifo");
|
||||
TEST_RESULT_STR(info.name, NULL, " name is not set");
|
||||
@ -164,7 +164,7 @@ testRun(void)
|
||||
// -------------------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("link info");
|
||||
|
||||
TEST_SYSTEM_FMT("ln -s ../repo/test %s", strZ(storagePathP(storageTest, STRDEF("repo/link"))));
|
||||
HRN_SYSTEM_FMT("ln -s ../repo/test %s", strZ(storagePathP(storageTest, STRDEF("repo/link"))));
|
||||
|
||||
TEST_ASSIGN(info, storageInfoP(storageRemote, STRDEF("link")), "valid link");
|
||||
TEST_RESULT_STR(info.name, NULL, " name is not set");
|
||||
|
Reference in New Issue
Block a user