mirror of
https://github.com/nextcloud/desktop.git
synced 2024-12-11 18:26:31 +03:00
b5ed352aa3
Only confluct resolution, do not compile or works Conflicts: CMakeLists.txt CPackConfig.cmake ConfigureChecks.cmake client/csync_client.c cmake/Modules/DefineCompilerFlags.cmake cmake/Modules/DefineInstallationPaths.cmake cmake/Modules/FindIconv.cmake cmake/Modules/FindIniparser.cmake cmake/Modules/FindNeon.cmake config.h.cmake config/CMakeLists.txt config/ocsync.conf doc/CMakeLists.txt modules/csync_owncloud.c modules/csync_sftp2.c src/CMakeLists.txt src/csync.c src/csync.h src/csync_config.c src/csync_exclude.c src/csync_lock.c src/csync_macros.h src/csync_misc.c src/csync_misc.h src/csync_private.h src/csync_propagate.c src/csync_statedb.c src/csync_statedb.h src/csync_update.c src/csync_util.c src/csync_util.h src/std/c_dir.c src/std/c_file.c src/std/c_private.h src/std/c_string.c src/std/c_string.h src/std/c_time.c src/vio/csync_vio.c src/vio/csync_vio.h src/vio/csync_vio_file_stat.h src/vio/csync_vio_local.c src/vio/csync_vio_method.h tests/CMakeLists.txt tests/csync_tests/check_csync_statedb_load.c tests/csync_tests/check_csync_statedb_query.c tests/csync_tests/check_csync_treewalk.c tests/csync_tests/check_csync_update.c tests/ownCloud/HTTP/DAV.pm tests/ownCloud/ownCloud/Test.pm tests/std_tests/check_std_c_str.c tests/vio_tests/check_vio.c
82 lines
1.8 KiB
C
82 lines
1.8 KiB
C
#include <string.h>
|
|
|
|
#include "torture.h"
|
|
|
|
#define CSYNC_TEST 1
|
|
#include "csync.h"
|
|
#include "csync_config.c"
|
|
|
|
#define TESTCONF "/tmp/check_csync1/csync.conf"
|
|
|
|
static void setup(void **state) {
|
|
CSYNC *csync;
|
|
int rc;
|
|
|
|
rc = system("mkdir -p /tmp/check_csync1");
|
|
assert_int_equal(rc, 0);
|
|
|
|
rc = csync_create(&csync, "/tmp/check_csync1", "/tmp/check_csync2");
|
|
assert_int_equal(rc, 0);
|
|
|
|
free(csync->options.config_dir);
|
|
csync->options.config_dir = c_strdup("/tmp/check_csync1/");
|
|
|
|
*state = csync;
|
|
}
|
|
|
|
static void teardown(void **state) {
|
|
CSYNC *csync = *state;
|
|
int rc;
|
|
|
|
rc = csync_destroy(csync);
|
|
assert_int_equal(rc, 0);
|
|
|
|
rc = system("rm -rf /tmp/check_csync1");
|
|
assert_int_equal(rc, 0);
|
|
|
|
rc = system("rm -rf /tmp/check_csync2");
|
|
assert_int_equal(rc, 0);
|
|
|
|
*state = NULL;
|
|
}
|
|
|
|
static void check_csync_config_copy_default(void **state)
|
|
{
|
|
int rc;
|
|
|
|
(void) state; /* unused */
|
|
|
|
rc = _csync_config_copy_default(TESTCONF);
|
|
assert_int_equal(rc, 0);
|
|
}
|
|
|
|
static void check_csync_config_load(void **state)
|
|
{
|
|
CSYNC *csync = *state;
|
|
int rc;
|
|
|
|
rc = _csync_config_copy_default(TESTCONF);
|
|
assert_int_equal(rc, 0);
|
|
|
|
/* Enable it, loading the default config should disable it */
|
|
rc = csync_enable_conflictcopys(csync);
|
|
assert_int_equal(rc, 0);
|
|
|
|
rc = csync_config_parse_file(csync, TESTCONF);
|
|
assert_int_equal(rc, 0);
|
|
|
|
assert_false(csync->options.with_conflict_copys);
|
|
assert_int_equal(csync->options.max_time_difference, 10);
|
|
assert_int_equal(csync->options.max_depth, 50);
|
|
}
|
|
|
|
int torture_run_tests(void)
|
|
{
|
|
const UnitTest tests[] = {
|
|
unit_test_setup_teardown(check_csync_config_copy_default, setup, teardown),
|
|
unit_test_setup_teardown(check_csync_config_load, setup, teardown),
|
|
};
|
|
|
|
return run_tests(tests);
|
|
}
|
|
|