xapian-core  1.4.25
Classes | Macros | Functions
api_replicate.cc File Reference

tests of replication functionality More...

#include <config.h>
#include "api_replicate.h"
#include <xapian.h>
#include "api/replication.h"
#include "apitest.h"
#include "dbcheck.h"
#include "errno_to_string.h"
#include "fd.h"
#include "filetests.h"
#include "safedirent.h"
#include "safefcntl.h"
#include "safesysstat.h"
#include "safeunistd.h"
#include "setenv.h"
#include "testsuite.h"
#include "testutils.h"
#include "unixcmds.h"
#include <sys/types.h>
#include <cerrno>
#include <cstdlib>
#include <string>
+ Include dependency graph for api_replicate.cc:

Go to the source code of this file.

Classes

struct  unset_max_changesets_helper_
 

Macros

#define set_max_changesets(N)   setenv("XAPIAN_MAX_CHANGESETS", #N, 1)
 
#define UNSET_MAX_CHANGESETS_AFTERWARDS   unset_max_changesets_helper_ ezlxq
 

Functions

static void rmtmpdir (const string &path)
 
static void mktmpdir (const string &path)
 
static off_t get_file_size (const string &path)
 
static size_t do_read (int fd, char *p, size_t desired)
 
static void do_write (int fd, const char *p, size_t n)
 
static off_t truncated_copy (const string &srcpath, const string &destpath, off_t tocopy)
 
static void get_changeset (const string &changesetpath, Xapian::DatabaseMaster &master, Xapian::DatabaseReplica &replica, int expected_changesets, int expected_fullcopies, bool expected_changed, bool full_copy=false)
 
static int apply_changeset (const string &changesetpath, Xapian::DatabaseReplica &replica, int expected_changesets, int expected_fullcopies, bool expected_changed)
 
static int replicate (Xapian::DatabaseMaster &master, Xapian::DatabaseReplica &replica, const string &tempdir, int expected_changesets, int expected_fullcopies, bool expected_changed, bool full_copy=false)
 
static void check_equal_dbs (const string &masterpath, const string &replicapath)
 
 DEFINE_TESTCASE (replicate1, replicas)
 
 DEFINE_TESTCASE (replicate2, replicas)
 
static void replicate_with_brokenness (Xapian::DatabaseMaster &master, Xapian::DatabaseReplica &replica, const string &tempdir, int expected_changesets, int expected_fullcopies, bool expected_changed)
 
 DEFINE_TESTCASE (replicate3, replicas)
 
 DEFINE_TESTCASE (replicate4, replicas)
 
 DEFINE_TESTCASE (replicate5, replicas)
 
 DEFINE_TESTCASE (replicate6, replicas)
 Test –full-copy option. More...
 
 DEFINE_TESTCASE (replicate7, replicas)
 Test healing a corrupt replica (new in 1.3.5). More...
 

Detailed Description

tests of replication functionality

Definition in file api_replicate.cc.

Macro Definition Documentation

◆ set_max_changesets

#define set_max_changesets (   N)    setenv("XAPIAN_MAX_CHANGESETS", #N, 1)

◆ UNSET_MAX_CHANGESETS_AFTERWARDS

#define UNSET_MAX_CHANGESETS_AFTERWARDS   unset_max_changesets_helper_ ezlxq

Definition at line 248 of file api_replicate.cc.

Referenced by DEFINE_TESTCASE().

Function Documentation

◆ apply_changeset()

static int apply_changeset ( const string &  changesetpath,
Xapian::DatabaseReplica replica,
int  expected_changesets,
int  expected_fullcopies,
bool  expected_changed 
)
static

◆ check_equal_dbs()

static void check_equal_dbs ( const string &  masterpath,
const string &  replicapath 
)
static

◆ DEFINE_TESTCASE() [1/7]

DEFINE_TESTCASE ( replicate1  ,
replicas   
)

◆ DEFINE_TESTCASE() [2/7]

DEFINE_TESTCASE ( replicate2  ,
replicas   
)

◆ DEFINE_TESTCASE() [3/7]

DEFINE_TESTCASE ( replicate3  ,
replicas   
)

◆ DEFINE_TESTCASE() [4/7]

DEFINE_TESTCASE ( replicate4  ,
replicas   
)

◆ DEFINE_TESTCASE() [5/7]

DEFINE_TESTCASE ( replicate5  ,
replicas   
)

◆ DEFINE_TESTCASE() [6/7]

DEFINE_TESTCASE ( replicate6  ,
replicas   
)

◆ DEFINE_TESTCASE() [7/7]

DEFINE_TESTCASE ( replicate7  ,
replicas   
)

◆ do_read()

static size_t do_read ( int  fd,
char *  p,
size_t  desired 
)
static

Definition at line 75 of file api_replicate.cc.

References FAIL_TEST.

Referenced by truncated_copy().

◆ do_write()

static void do_write ( int  fd,
const char *  p,
size_t  n 
)
static

Definition at line 92 of file api_replicate.cc.

References FAIL_TEST.

Referenced by truncated_copy().

◆ get_changeset()

static void get_changeset ( const string &  changesetpath,
Xapian::DatabaseMaster master,
Xapian::DatabaseReplica replica,
int  expected_changesets,
int  expected_fullcopies,
bool  expected_changed,
bool  full_copy = false 
)
static

◆ get_file_size()

static off_t get_file_size ( const string &  path)
static

Definition at line 67 of file api_replicate.cc.

References FAIL_TEST, and file_size().

Referenced by replicate_with_brokenness().

◆ mktmpdir()

static void mktmpdir ( const string &  path)
static

Definition at line 60 of file api_replicate.cc.

References FAIL_TEST, and rmtmpdir().

Referenced by DEFINE_TESTCASE().

◆ replicate()

static int replicate ( Xapian::DatabaseMaster master,
Xapian::DatabaseReplica replica,
const string &  tempdir,
int  expected_changesets,
int  expected_fullcopies,
bool  expected_changed,
bool  full_copy = false 
)
static

Definition at line 202 of file api_replicate.cc.

References apply_changeset(), and get_changeset().

Referenced by DEFINE_TESTCASE().

◆ replicate_with_brokenness()

static void replicate_with_brokenness ( Xapian::DatabaseMaster master,
Xapian::DatabaseReplica replica,
const string &  tempdir,
int  expected_changesets,
int  expected_fullcopies,
bool  expected_changed 
)
static

◆ rmtmpdir()

static void rmtmpdir ( const string &  path)
static

Definition at line 56 of file api_replicate.cc.

References rm_rf().

Referenced by DEFINE_TESTCASE(), and mktmpdir().

◆ truncated_copy()

static off_t truncated_copy ( const string &  srcpath,
const string &  destpath,
off_t  tocopy 
)
static