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

Move dummy storage driver to test harness.

The dummy driver is the basis for creating test storage drivers so it makes sense to locate it in the harness where all tests can access it.
This commit is contained in:
David Steele
2020-07-25 08:44:41 -04:00
parent cbf5dd19c2
commit 216a61d936
3 changed files with 61 additions and 52 deletions

View File

@ -9,6 +9,7 @@ stress testing as needed.
***********************************************************************************************************************************/
#include "common/harnessConfig.h"
#include "common/harnessFork.h"
#include "common/harnessStorage.h"
#include "common/crypto/hash.h"
#include "common/compress/gz/compress.h"
@ -25,58 +26,6 @@ stress testing as needed.
#include "protocol/server.h"
#include "storage/posix/storage.h"
#include "storage/remote/protocol.h"
#include "storage/storage.intern.h"
/***********************************************************************************************************************************
Dummy functions and interface for constructing test drivers
***********************************************************************************************************************************/
static StorageInfo
storageTestDummyInfo(THIS_VOID, const String *file, StorageInfoLevel level, StorageInterfaceInfoParam param)
{
(void)thisVoid; (void)file; (void)level; (void)param; return (StorageInfo){.exists = false};
}
static bool
storageTestDummyInfoList(
THIS_VOID, const String *path, StorageInfoLevel level, StorageInfoListCallback callback, void *callbackData,
StorageInterfaceInfoListParam param)
{
(void)thisVoid; (void)path; (void)level; (void)callback; (void)callbackData; (void)param; return false;
}
static StorageRead *
storageTestDummyNewRead(THIS_VOID, const String *file, bool ignoreMissing, StorageInterfaceNewReadParam param)
{
(void)thisVoid; (void)file; (void)ignoreMissing; (void)param; return NULL;
}
static StorageWrite *
storageTestDummyNewWrite(THIS_VOID, const String *file, StorageInterfaceNewWriteParam param)
{
(void)thisVoid; (void)file; (void)param; return NULL;
}
static bool
storageTestDummyPathRemove(THIS_VOID, const String *path, bool recurse, StorageInterfacePathRemoveParam param)
{
(void)thisVoid; (void)path; (void)recurse; (void)param; return false;
}
static void
storageTestDummyRemove(THIS_VOID, const String *file, StorageInterfaceRemoveParam param)
{
(void)thisVoid; (void)file; (void)param;
}
static const StorageInterface storageInterfaceTestDummy =
{
.info = storageTestDummyInfo,
.infoList = storageTestDummyInfoList,
.newRead = storageTestDummyNewRead,
.newWrite = storageTestDummyNewWrite,
.pathRemove = storageTestDummyPathRemove,
.remove = storageTestDummyRemove,
};
/***********************************************************************************************************************************
Dummy callback functions