Fixed csync testcases.

This commit is contained in:
Klaas Freitag 2012-10-26 21:33:13 +02:00
parent 0db9427377
commit 9e4c873b16
3 changed files with 8 additions and 11 deletions

View file

@ -16,7 +16,7 @@ static void setup(void) {
fail_if(system("mkdir -p /tmp/check_csync1") < 0, "Setup failed");
fail_if(csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2") < 0, "Setup failed");
SAFE_FREE(csync->options.config_dir);
csync->options.config_dir = c_strdup("/tmp/check_csync1/");
csync_set_config_dir(csync, "/tmp/check_csync1/");
}
static void teardown(void) {

View file

@ -12,6 +12,8 @@ const char *testdb = (char *) "/tmp/check_csync1/test.db";
const char *testtmpdb = (char *) "/tmp/check_csync1/test.db.ctmp";
static void setup(void) {
fail_if(system("rm -rf /tmp/check_csync"));
fail_if(system("rm -rf /tmp/check_csync1") < 0, "Setup failed");
fail_if(system("rm -rf /tmp/check_csync2") < 0, "Setup failed");
fail_if(system("mkdir -p /tmp/check_csync1") < 0, "Setup failed");

View file

@ -12,10 +12,12 @@ int file_count;
static void setup_local(void) {
fail_if(system("mkdir -p /tmp/check_csync1") < 0, "Setup failed");
fail_if(system("mkdir -p /tmp/check_csync2") < 0, "Setup failed");
fail_if(system("mkdir -p /tmp/check_csync") < 0, "Setup failed");
fail_if(system("echo \"This is test data\" > /tmp/check_csync1/testfile1.txt") < 0, NULL);
fail_if(system("echo \"This is also test data\" > /tmp/check_csync1/testfile2.txt") < 0, NULL);
fail_if(csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2") < 0, "Setup failed");
fail_if(csync_set_config_dir(csync, "/tmp/check_csync/") < 0, "Setup failed");
fail_if(csync_init(csync) < 0, "Init failed");
file_count = 0;
@ -26,7 +28,7 @@ static void teardown_local(void) {
fail_if(csync_destroy(csync) < 0, "Teardown failed");
fail_if(system("rm -rf /tmp/check_csync1") < 0, "Teardown failed");
fail_if(system("rm -rf /tmp/check_csync2") < 0, "Teardown failed");
fail_if(system("rm -rf /tmp/check_csync") < 0, "Teardown failed");
printf("********** tearing down local\n");
}
@ -37,21 +39,19 @@ static void setup_remote(void) {
fail_if(system("echo \"This is also test data\" > /tmp/check_csync1/testfile2.txt") < 0, NULL);
fail_if(csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2") < 0, "Setup failed");
fail_if(csync_set_config_dir(csync, "/tmp/check_csync/") < 0, "Setup failed");
fail_if(csync_init(csync) < 0, "Init failed");
fail_if(csync_update(csync) < 0, "Update failed");
fail_if(csync_reconcile(csync) < 0, "Reconcile failed");
fail_if(csync_propagate(csync) < 0, "Propagate failed");
file_count = 0;
printf("********** setting up remote!\n");
}
static void teardown_remote(void) {
fail_if(csync_destroy(csync) < 0, "Teardown failed");
fail_if(system("rm -rf /tmp/check_csync1") < 0, "Teardown failed");
fail_if(system("rm -rf /tmp/check_csync2") < 0, "Teardown failed");
printf("********** tearing down remote\n");
}
@ -95,12 +95,7 @@ START_TEST (check_csync_treewalk_local_with_filter)
fail_if(csync_walk_local_tree(csync, &visitor, 0) < 0, "Local walk needs update first");
fail_if(file_count != 0, "Local File count not correct (without update)");
fail_if(csync_update(csync) < 0, "Update failed");
fail_if(csync_walk_local_tree(csync, &visitor, CSYNC_INSTRUCTION_EVAL) < 0, "Local walk");
fail_if(file_count != 2, "Local File count filtered (EVAL) not correct: %d", file_count);
file_count = 0;
fail_if(csync_walk_local_tree(csync, &visitor, CSYNC_INSTRUCTION_EVAL | CSYNC_INSTRUCTION_REMOVE) < 0, "Local walk");
fail_if(file_count != 2, "Local File count filtered (EVAL|REMOVE) not correct: %d", file_count);
file_count = 0;
fail_if(csync_walk_local_tree(csync, &visitor, CSYNC_INSTRUCTION_RENAME) < 0, "Local walk");
fail_if(file_count != 0, "Local File count filtered (RENAME) not correct");