Use always the same path for testing.

This commit is contained in:
Andreas Schneider 2008-05-05 10:55:05 +02:00
parent cfe0888771
commit ad67b21062
4 changed files with 29 additions and 29 deletions

View file

@ -8,13 +8,13 @@
CSYNC *csync;
const char *testconf = "/tmp/check_csync/csync.conf";
const char *testconf = "/tmp/check_csync1/csync.conf";
static void setup(void) {
system("mkdir -p /tmp/check_csync");
csync_create(&csync, "/tmp/csync1", "/tmp/csync2");
system("mkdir -p /tmp/check_csync1");
csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
SAFE_FREE(csync->options.config_dir);
csync->options.config_dir = c_strdup("/tmp/check_csync/");
csync->options.config_dir = c_strdup("/tmp/check_csync1/");
}
static void teardown(void) {

View file

@ -9,27 +9,27 @@
CSYNC *csync;
static void setup(void) {
csync_create(&csync, "/tmp/csync1", "/tmp/csync2");
csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
SAFE_FREE(csync->options.config_dir);
csync->options.config_dir = c_strdup("/tmp/check_csync/");
csync->options.config_dir = c_strdup("/tmp/check_csync1/");
}
static void setup_init(void) {
csync_create(&csync, "/tmp/csync1", "/tmp/csync2");
csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
SAFE_FREE(csync->options.config_dir);
csync->options.config_dir = c_strdup("/tmp/check_csync/");
csync->options.config_dir = c_strdup("/tmp/check_csync1");
csync_exclude_load(csync, SYSCONFDIR "/config/" CSYNC_EXCLUDE_FILE);
}
static void teardown(void) {
csync_destroy(csync);
system("rm -rf /tmp/check_csync");
system("rm -rf /tmp/check_csync1");
}
START_TEST (check_csync_exclude_add)
{
csync_exclude_add(csync, (const char *) "/tmp/check_csync/*");
fail_unless(strcmp(csync->excludes->vector[0], (const char *) "/tmp/check_csync/*") == 0, NULL);
csync_exclude_add(csync, (const char *) "/tmp/check_csync1/*");
fail_unless(strcmp(csync->excludes->vector[0], (const char *) "/tmp/check_csync1/*") == 0, NULL);
}
END_TEST

View file

@ -7,48 +7,48 @@
#include "csync_journal.c"
CSYNC *csync;
const char *testdb = (char *) "/tmp/check_csync/test.db";
const char *testtmpdb = (char *) "/tmp/check_csync/test.db.ctmp";
const char *testdb = (char *) "/tmp/check_csync1/test.db";
const char *testtmpdb = (char *) "/tmp/check_csync1/test.db.ctmp";
static void setup(void) {
system("rm -rf /tmp/check_csync");
system("mkdir -p /tmp/check_csync");
csync_create(&csync, "/tmp/csync1", "/tmp/csync2");
system("rm -rf /tmp/check_csync1");
system("mkdir -p /tmp/check_csync1");
csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
SAFE_FREE(csync->options.config_dir);
csync->options.config_dir = c_strdup("/tmp/check_csync/");
csync->options.config_dir = c_strdup("/tmp/check_csync1/");
}
static void setup_init(void) {
system("rm -rf /tmp/check_csync");
csync_create(&csync, "/tmp/csync1", "/tmp/csync2");
system("rm -rf /tmp/check_csync1");
csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
SAFE_FREE(csync->options.config_dir);
csync->options.config_dir = c_strdup("/tmp/check_csync/");
csync->options.config_dir = c_strdup("/tmp/check_csync1/");
csync_init(csync);
}
static void teardown(void) {
csync_destroy(csync);
system("rm -rf /tmp/check_csync");
system("rm -rf /tmp/check_csync1");
}
START_TEST (check_csync_journal_check)
{
system("mkdir -p /tmp/check_csync");
system("mkdir -p /tmp/check_csync1");
/* old db */
system("echo \"SQLite format 2\" > /tmp/check_csync/test.db");
system("echo \"SQLite format 2\" > /tmp/check_csync1/test.db");
fail_unless(csync_journal_check(testdb) == 0);
/* db already exists */
fail_unless(csync_journal_check(testdb) == 0);
/* no db exists */
system("rm -f /tmp/check_csync/test.db");
system("rm -f /tmp/check_csync1/test.db");
fail_unless(csync_journal_check(testdb) == 0);
fail_unless(csync_journal_check((char *) "/tmp/check_csync/") < 0);
fail_unless(csync_journal_check((char *) "/tmp/check_csync1/") < 0);
system("rm -rf /tmp/check_csync");
system("rm -rf /tmp/check_csync1");
}
END_TEST

View file

@ -12,14 +12,14 @@
#include "std/c_file.h"
#include "csync_lock.h"
#define TEST_LOCK "/tmp/csync_lock/test"
#define TEST_LOCK "/tmp/check_csync/test"
static void setup(void) {
system("mkdir -p /tmp/csync_lock");
system("mkdir -p /tmp/check_csync");
}
static void teardown(void) {
system("rm -rf /tmp/csync_lock");
system("rm -rf /tmp/check_csync");
}
START_TEST (check_csync_lock)