1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-15 01:04:37 +02:00

Add HRN_STORAGE_TIME() harness macro.

Makes updating the time of a path/file more streamlined in tests.

Also update all tests where utime() was being used directly.
This commit is contained in:
David Steele
2021-03-12 12:54:34 -05:00
parent 3c85a497a6
commit e07040c2e4
5 changed files with 34 additions and 23 deletions

View File

@ -1,8 +1,6 @@
/***********************************************************************************************************************************
Test Backup Command
***********************************************************************************************************************************/
#include <utime.h>
#include "command/stanza/create.h"
#include "command/stanza/upgrade.h"
#include "common/crypto/hash.h"
@ -2571,11 +2569,7 @@ testRun(void)
harnessCfgLoad(cfgCmdBackup, argList);
// Update pg_control timestamp
THROW_ON_SYS_ERROR(
utime(
strZ(storagePathP(storagePg(), STRDEF("global/pg_control"))),
&(struct utimbuf){.actime = backupTimeStart, .modtime = backupTimeStart}) != 0, FileWriteError,
"unable to set time");
HRN_STORAGE_TIME(storagePg(), "global/pg_control", backupTimeStart);
// Run backup. Make sure that the timeline selected converts to hexdecimal that can't be interpreted as decimal.
testBackupPqScriptP(PG_VERSION_11, backupTimeStart, .timeline = 0x2C);