mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 13:35:58 +03:00
Merge pull request #5978 from owncloud/csync-cpp
Move csync to src/ and compile most of it at C++
This commit is contained in:
commit
40abe3f370
135 changed files with 1321 additions and 376 deletions
|
@ -180,8 +180,6 @@ if (NOT DEFINED APPLICATION_ICON_NAME)
|
|||
set(APPLICATION_ICON_NAME ${APPLICATION_SHORTNAME})
|
||||
endif()
|
||||
|
||||
configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||
|
||||
include(OwnCloudCPack.cmake)
|
||||
|
||||
add_definitions(-DUNICODE)
|
||||
|
@ -213,7 +211,14 @@ endif()
|
|||
file( GLOB TRANS_FILES ${CMAKE_SOURCE_DIR}/translations/client_*.ts)
|
||||
set(TRANSLATIONS ${TRANS_FILES})
|
||||
|
||||
add_subdirectory(csync)
|
||||
if(UNIT_TESTING)
|
||||
# Make sure we set this before recursing into child folders.
|
||||
set(WITH_TESTING ON)
|
||||
include(CTest)
|
||||
enable_testing()
|
||||
add_subdirectory(test)
|
||||
endif(UNIT_TESTING)
|
||||
|
||||
add_subdirectory(src)
|
||||
if(NOT BUILD_LIBRARIES_ONLY)
|
||||
add_subdirectory(shell_integration)
|
||||
|
@ -222,11 +227,7 @@ add_subdirectory(doc/dev)
|
|||
add_subdirectory(admin)
|
||||
endif(NOT BUILD_LIBRARIES_ONLY)
|
||||
|
||||
if(UNIT_TESTING)
|
||||
include(CTest)
|
||||
enable_testing()
|
||||
add_subdirectory(test)
|
||||
endif(UNIT_TESTING)
|
||||
configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||
|
||||
if(BUILD_OWNCLOUD_OSX_BUNDLE)
|
||||
install(FILES sync-exclude.lst DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/)
|
||||
|
|
|
@ -24,6 +24,6 @@
|
|||
#cmakedefine SYSCONFDIR "@SYSCONFDIR@"
|
||||
#cmakedefine SHAREDIR "@SHAREDIR@"
|
||||
|
||||
#cmakedefine WITH_UNIT_TESTING 1
|
||||
#cmakedefine WITH_TESTING 1
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
|
||||
|
||||
# global needed variables
|
||||
set(APPLICATION_NAME "ocsync")
|
||||
|
||||
set(LIBRARY_VERSION ${MIRALL_VERSION})
|
||||
set(LIBRARY_SOVERSION "0")
|
||||
|
||||
# add definitions
|
||||
include(DefineCMakeDefaults)
|
||||
include(DefinePlatformDefaults)
|
||||
include(DefineCompilerFlags)
|
||||
include(DefineOptions.cmake)
|
||||
|
||||
include(DefineInstallationPaths)
|
||||
|
||||
# add macros
|
||||
include(MacroAddPlugin)
|
||||
include(MacroCopyFile)
|
||||
|
||||
find_package(SQLite3 3.8.0 REQUIRED)
|
||||
|
||||
include(ConfigureChecks.cmake)
|
||||
|
||||
|
||||
set(SOURCE_DIR ${CMAKE_SOURCE_DIR})
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
macro_copy_file(${CMAKE_CURRENT_SOURCE_DIR}/CTestCustom.cmake ${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake)
|
||||
|
||||
if (MEM_NULL_TESTS)
|
||||
add_definitions(-DCSYNC_MEM_NULL_TESTS)
|
||||
endif (MEM_NULL_TESTS)
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
if (UNIT_TESTING)
|
||||
set(WITH_TESTING ON)
|
||||
|
||||
find_package(CMocka)
|
||||
if (CMOCKA_FOUND)
|
||||
include(AddCMockaTest)
|
||||
add_subdirectory(tests)
|
||||
endif (CMOCKA_FOUND)
|
||||
endif (UNIT_TESTING)
|
||||
|
||||
configure_file(config_csync.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config_csync.h)
|
||||
configure_file(config_test.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config_test.h)
|
||||
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
set(UPDATE_TYPE "true")
|
||||
|
||||
set(MEMORYCHECK_SUPPRESSIONS_FILE ${CMAKE_SOURCE_DIR}/tests/valgrind-csync.supp)
|
||||
|
||||
set(CTEST_PROJECT_NAME "csync")
|
||||
set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC")
|
||||
|
||||
set(CTEST_DROP_METHOD "http")
|
||||
set(CTEST_DROP_SITE "mock.cryptomilk.org")
|
||||
set(CTEST_DROP_LOCATION "/submit.php?project=${CTEST_PROJECT_NAME}")
|
||||
set(CTEST_DROP_SITE_CDASH TRUE)
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
set(CTEST_CUSTOM_MEMCHECK_IGNORE
|
||||
${CTEST_CUSTOM_MEMCHECK_IGNORE}
|
||||
check_std_c_jhash
|
||||
)
|
|
@ -1,7 +0,0 @@
|
|||
|
||||
/* mind to have trailing slashes! */
|
||||
|
||||
#define TESTFILES_DIR "@SOURCE_DIR@/csync/tests/ownCloud/testfiles/"
|
||||
|
||||
#define TEST_CONFIG_DIR "@SOURCE_DIR@/csync/tests/ownCloud/"
|
||||
|
460
csync/tests/csync_tests/check_csync_update.cpp
Normal file
460
csync/tests/csync_tests/check_csync_update.cpp
Normal file
|
@ -0,0 +1,460 @@
|
|||
/*
|
||||
* libcsync -- a library to sync a directory with another
|
||||
*
|
||||
* Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
#include "csync_update.cpp"
|
||||
|
||||
extern "C" {
|
||||
|
||||
#include "torture.h"
|
||||
|
||||
#define TESTDB "/tmp/check_csync/journal.db"
|
||||
|
||||
static int firstrun = 1;
|
||||
|
||||
static void statedb_create_metadata_table(sqlite3 *db)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
if( db ) {
|
||||
const char *sql = "CREATE TABLE IF NOT EXISTS metadata("
|
||||
"phash INTEGER(8),"
|
||||
"pathlen INTEGER,"
|
||||
"path VARCHAR(4096),"
|
||||
"inode INTEGER,"
|
||||
"uid INTEGER,"
|
||||
"gid INTEGER,"
|
||||
"mode INTEGER,"
|
||||
"modtime INTEGER(8),"
|
||||
"type INTEGER,"
|
||||
"md5 VARCHAR(32),"
|
||||
"fileid VARCHAR(128),"
|
||||
"remotePerm VARCHAR(128),"
|
||||
"filesize BIGINT,"
|
||||
"ignoredChildrenRemote INT,"
|
||||
"contentChecksum TEXT,"
|
||||
"contentChecksumTypeId INTEGER,"
|
||||
"PRIMARY KEY(phash));";
|
||||
|
||||
rc = sqlite3_exec(db, sql, NULL, NULL, NULL);
|
||||
//const char *msg = sqlite3_errmsg(db);
|
||||
assert_int_equal( rc, SQLITE_OK );
|
||||
|
||||
sql = "CREATE TABLE IF NOT EXISTS checksumtype("
|
||||
"id INTEGER PRIMARY KEY,"
|
||||
"name TEXT UNIQUE"
|
||||
");";
|
||||
rc = sqlite3_exec(db, sql, NULL, NULL, NULL);
|
||||
assert_int_equal( rc, SQLITE_OK );
|
||||
}
|
||||
}
|
||||
|
||||
static void statedb_insert_metadata(sqlite3 *db)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
if( db ) {
|
||||
char *stmt = sqlite3_mprintf("INSERT INTO metadata"
|
||||
"(phash, pathlen, path, inode, uid, gid, mode, modtime,type,md5) VALUES"
|
||||
"(%lld, %d, '%q', %d, %d, %d, %d, %lld, %d, '%q');",
|
||||
(long long signed int)42,
|
||||
42,
|
||||
"I_was_wurst_before_I_became_wurstsalat",
|
||||
619070,
|
||||
42,
|
||||
42,
|
||||
42,
|
||||
(long long signed int)42,
|
||||
0,
|
||||
"4711");
|
||||
|
||||
char *errmsg;
|
||||
rc = sqlite3_exec(db, stmt, NULL, NULL, &errmsg);
|
||||
sqlite3_free(stmt);
|
||||
assert_int_equal( rc, SQLITE_OK );
|
||||
}
|
||||
}
|
||||
|
||||
static int setup(void **state)
|
||||
{
|
||||
CSYNC *csync;
|
||||
int rc;
|
||||
|
||||
unlink(TESTDB);
|
||||
rc = system("mkdir -p /tmp/check_csync");
|
||||
assert_int_equal(rc, 0);
|
||||
rc = system("mkdir -p /tmp/check_csync1");
|
||||
assert_int_equal(rc, 0);
|
||||
csync_create(&csync, "/tmp/check_csync1");
|
||||
csync_init(csync, TESTDB);
|
||||
|
||||
/* Create a new db with metadata */
|
||||
sqlite3 *db;
|
||||
csync->statedb.file = c_strdup(TESTDB);
|
||||
rc = sqlite3_open(csync->statedb.file, &db);
|
||||
statedb_create_metadata_table(db);
|
||||
if( firstrun ) {
|
||||
statedb_insert_metadata(db);
|
||||
firstrun = 0;
|
||||
}
|
||||
sqlite3_close(db);
|
||||
|
||||
rc = csync_statedb_load(csync, TESTDB, &csync->statedb.db);
|
||||
assert_int_equal(rc, 0);
|
||||
|
||||
*state = csync;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int setup_ftw(void **state)
|
||||
{
|
||||
CSYNC *csync;
|
||||
int rc;
|
||||
|
||||
rc = system("mkdir -p /tmp/check_csync");
|
||||
assert_int_equal(rc, 0);
|
||||
rc = system("mkdir -p /tmp/check_csync1");
|
||||
assert_int_equal(rc, 0);
|
||||
csync_create(&csync, "/tmp");
|
||||
csync_init(csync, TESTDB);
|
||||
|
||||
sqlite3 *db = NULL;
|
||||
rc = sqlite3_open_v2(TESTDB, &db, SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE, NULL);
|
||||
assert_int_equal(rc, SQLITE_OK);
|
||||
statedb_create_metadata_table(db);
|
||||
rc = sqlite3_close(db);
|
||||
assert_int_equal(rc, SQLITE_OK);
|
||||
|
||||
rc = csync_statedb_load(csync, TESTDB, &csync->statedb.db);
|
||||
assert_int_equal(rc, 0);
|
||||
|
||||
csync->statedb.file = c_strdup( TESTDB );
|
||||
*state = csync;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int teardown(void **state)
|
||||
{
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
int rc;
|
||||
|
||||
unlink( csync->statedb.file);
|
||||
rc = csync_destroy(csync);
|
||||
assert_int_equal(rc, 0);
|
||||
|
||||
*state = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int teardown_rm(void **state) {
|
||||
int rc;
|
||||
|
||||
teardown(state);
|
||||
|
||||
rc = system("rm -rf /tmp/check_csync");
|
||||
assert_int_equal(rc, 0);
|
||||
rc = system("rm -rf /tmp/check_csync1");
|
||||
assert_int_equal(rc, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* create a file stat, caller must free memory */
|
||||
static csync_vio_file_stat_t* create_fstat(const char *name,
|
||||
ino_t inode,
|
||||
time_t mtime)
|
||||
{
|
||||
csync_vio_file_stat_t *fs = NULL;
|
||||
time_t t;
|
||||
|
||||
fs = csync_vio_file_stat_new();
|
||||
if (fs == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (name && *name) {
|
||||
fs->name = c_strdup(name);
|
||||
} else {
|
||||
fs->name = c_strdup("file.txt");
|
||||
}
|
||||
|
||||
if (fs->name == NULL) {
|
||||
csync_vio_file_stat_destroy(fs);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fs->fields = CSYNC_VIO_FILE_STAT_FIELDS_NONE;
|
||||
|
||||
fs->type = CSYNC_VIO_FILE_TYPE_REGULAR;
|
||||
fs->fields |= CSYNC_VIO_FILE_STAT_FIELDS_TYPE;
|
||||
|
||||
|
||||
if (inode == 0) {
|
||||
fs->inode = 619070;
|
||||
} else {
|
||||
fs->inode = inode;
|
||||
}
|
||||
fs->fields |= CSYNC_VIO_FILE_STAT_FIELDS_INODE;
|
||||
|
||||
|
||||
fs->size = 157459;
|
||||
fs->fields |= CSYNC_VIO_FILE_STAT_FIELDS_SIZE;
|
||||
|
||||
|
||||
|
||||
if (mtime == 0) {
|
||||
fs->atime = fs->ctime = fs->mtime = time(&t);
|
||||
} else {
|
||||
fs->atime = fs->ctime = fs->mtime = mtime;
|
||||
}
|
||||
fs->fields |= CSYNC_VIO_FILE_STAT_FIELDS_ATIME;
|
||||
fs->fields |= CSYNC_VIO_FILE_STAT_FIELDS_CTIME;
|
||||
fs->fields |= CSYNC_VIO_FILE_STAT_FIELDS_MTIME;
|
||||
|
||||
return fs;
|
||||
}
|
||||
|
||||
static int failing_fn(CSYNC *ctx,
|
||||
const char *file,
|
||||
const csync_vio_file_stat_t *fs,
|
||||
int flag)
|
||||
{
|
||||
(void) ctx;
|
||||
(void) file;
|
||||
(void) fs;
|
||||
(void) flag;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* detect a new file */
|
||||
static void check_csync_detect_update(void **state)
|
||||
{
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
csync_file_stat_t *st;
|
||||
csync_vio_file_stat_t *fs;
|
||||
int rc;
|
||||
|
||||
fs = create_fstat("file.txt", 0, 1217597845);
|
||||
assert_non_null(fs);
|
||||
|
||||
rc = _csync_detect_update(csync,
|
||||
"/tmp/check_csync1/file.txt",
|
||||
fs,
|
||||
CSYNC_FTW_TYPE_FILE);
|
||||
assert_int_equal(rc, 0);
|
||||
|
||||
/* the instruction should be set to new */
|
||||
st = (csync_file_stat_t*)c_rbtree_node_data(csync->local.tree->root);
|
||||
assert_int_equal(st->instruction, CSYNC_INSTRUCTION_NEW);
|
||||
|
||||
/* create a statedb */
|
||||
csync_set_status(csync, 0xFFFF);
|
||||
|
||||
csync_vio_file_stat_destroy(fs);
|
||||
}
|
||||
|
||||
/* Test behaviour in case no db is there. For that its important that the
|
||||
* test before this one uses teardown_rm.
|
||||
*/
|
||||
static void check_csync_detect_update_db_none(void **state)
|
||||
{
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
csync_file_stat_t *st;
|
||||
csync_vio_file_stat_t *fs;
|
||||
int rc;
|
||||
|
||||
fs = create_fstat("file.txt", 0, 1217597845);
|
||||
assert_non_null(fs);
|
||||
|
||||
rc = _csync_detect_update(csync,
|
||||
"/tmp/check_csync1/file.txt",
|
||||
fs,
|
||||
CSYNC_FTW_TYPE_FILE);
|
||||
assert_int_equal(rc, 0);
|
||||
|
||||
/* the instruction should be set to new */
|
||||
st = (csync_file_stat_t*)c_rbtree_node_data(csync->local.tree->root);
|
||||
assert_int_equal(st->instruction, CSYNC_INSTRUCTION_NEW);
|
||||
|
||||
|
||||
/* create a statedb */
|
||||
csync_set_status(csync, 0xFFFF);
|
||||
|
||||
csync_vio_file_stat_destroy(fs);
|
||||
}
|
||||
|
||||
static void check_csync_detect_update_db_eval(void **state)
|
||||
{
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
csync_file_stat_t *st;
|
||||
csync_vio_file_stat_t *fs;
|
||||
int rc;
|
||||
|
||||
fs = create_fstat("file.txt", 0, 42);
|
||||
assert_non_null(fs);
|
||||
|
||||
rc = _csync_detect_update(csync,
|
||||
"/tmp/check_csync1/file.txt",
|
||||
fs,
|
||||
CSYNC_FTW_TYPE_FILE);
|
||||
assert_int_equal(rc, 0);
|
||||
|
||||
/* the instruction should be set to new */
|
||||
st = (csync_file_stat_t*)c_rbtree_node_data(csync->local.tree->root);
|
||||
assert_int_equal(st->instruction, CSYNC_INSTRUCTION_NEW);
|
||||
|
||||
/* create a statedb */
|
||||
csync_set_status(csync, 0xFFFF);
|
||||
|
||||
csync_vio_file_stat_destroy(fs);
|
||||
}
|
||||
|
||||
|
||||
static void check_csync_detect_update_db_rename(void **state)
|
||||
{
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
// csync_file_stat_t *st;
|
||||
|
||||
csync_vio_file_stat_t *fs;
|
||||
int rc = 0;
|
||||
|
||||
fs = create_fstat("wurst.txt", 0, 42);
|
||||
assert_non_null(fs);
|
||||
csync_set_statedb_exists(csync, 1);
|
||||
|
||||
rc = _csync_detect_update(csync,
|
||||
"/tmp/check_csync1/wurst.txt",
|
||||
fs,
|
||||
CSYNC_FTW_TYPE_FILE);
|
||||
assert_int_equal(rc, 0);
|
||||
|
||||
/* the instruction should be set to rename */
|
||||
/*
|
||||
* temporarily broken.
|
||||
st = (csync_file_stat_t*)c_rbtree_node_data(csync->local.tree->root);
|
||||
assert_int_equal(st->instruction, CSYNC_INSTRUCTION_RENAME);
|
||||
|
||||
st->instruction = CSYNC_INSTRUCTION_UPDATED;
|
||||
*/
|
||||
/* create a statedb */
|
||||
csync_set_status(csync, 0xFFFF);
|
||||
|
||||
csync_vio_file_stat_destroy(fs);
|
||||
}
|
||||
|
||||
static void check_csync_detect_update_db_new(void **state)
|
||||
{
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
csync_file_stat_t *st;
|
||||
csync_vio_file_stat_t *fs;
|
||||
int rc;
|
||||
|
||||
fs = create_fstat("file.txt", 42000, 0);
|
||||
assert_non_null(fs);
|
||||
|
||||
rc = _csync_detect_update(csync,
|
||||
"/tmp/check_csync1/file.txt",
|
||||
fs,
|
||||
CSYNC_FTW_TYPE_FILE);
|
||||
assert_int_equal(rc, 0);
|
||||
|
||||
/* the instruction should be set to new */
|
||||
st = (csync_file_stat_t*)c_rbtree_node_data(csync->local.tree->root);
|
||||
assert_int_equal(st->instruction, CSYNC_INSTRUCTION_NEW);
|
||||
|
||||
|
||||
/* create a statedb */
|
||||
csync_set_status(csync, 0xFFFF);
|
||||
|
||||
csync_vio_file_stat_destroy(fs);
|
||||
}
|
||||
|
||||
static void check_csync_detect_update_null(void **state)
|
||||
{
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
csync_vio_file_stat_t *fs;
|
||||
int rc;
|
||||
|
||||
fs = create_fstat("file.txt", 0, 0);
|
||||
assert_non_null(fs);
|
||||
|
||||
rc = _csync_detect_update(csync,
|
||||
NULL,
|
||||
fs,
|
||||
CSYNC_FTW_TYPE_FILE);
|
||||
assert_int_equal(rc, -1);
|
||||
|
||||
rc = _csync_detect_update(csync,
|
||||
"/tmp/check_csync1/file.txt",
|
||||
NULL,
|
||||
CSYNC_FTW_TYPE_FILE);
|
||||
assert_int_equal(rc, -1);
|
||||
|
||||
csync_vio_file_stat_destroy(fs);
|
||||
}
|
||||
|
||||
static void check_csync_ftw(void **state)
|
||||
{
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
int rc;
|
||||
|
||||
rc = csync_ftw(csync, "/tmp", csync_walker, MAX_DEPTH);
|
||||
assert_int_equal(rc, 0);
|
||||
}
|
||||
|
||||
static void check_csync_ftw_empty_uri(void **state)
|
||||
{
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
int rc;
|
||||
|
||||
rc = csync_ftw(csync, "", csync_walker, MAX_DEPTH);
|
||||
assert_int_equal(rc, -1);
|
||||
}
|
||||
|
||||
static void check_csync_ftw_failing_fn(void **state)
|
||||
{
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
int rc;
|
||||
|
||||
rc = csync_ftw(csync, "/tmp", failing_fn, MAX_DEPTH);
|
||||
assert_int_equal(rc, -1);
|
||||
}
|
||||
|
||||
int torture_run_tests(void)
|
||||
{
|
||||
const struct CMUnitTest tests[] = {
|
||||
cmocka_unit_test_setup_teardown(check_csync_detect_update, setup, teardown_rm),
|
||||
cmocka_unit_test_setup_teardown(check_csync_detect_update_db_none, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(check_csync_detect_update_db_eval, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(check_csync_detect_update_db_rename, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(check_csync_detect_update_db_new, setup, teardown_rm),
|
||||
cmocka_unit_test_setup_teardown(check_csync_detect_update_null, setup, teardown_rm),
|
||||
|
||||
cmocka_unit_test_setup_teardown(check_csync_ftw, setup_ftw, teardown_rm),
|
||||
cmocka_unit_test_setup_teardown(check_csync_ftw_empty_uri, setup_ftw, teardown_rm),
|
||||
cmocka_unit_test_setup_teardown(check_csync_ftw_failing_fn, setup_ftw, teardown_rm),
|
||||
};
|
||||
|
||||
return cmocka_run_group_tests(tests, NULL, NULL);
|
||||
}
|
||||
|
||||
}
|
|
@ -8,6 +8,7 @@ if(NOT TOKEN_AUTH_ONLY)
|
|||
find_package(Qt5Keychain REQUIRED)
|
||||
endif()
|
||||
|
||||
add_subdirectory(csync)
|
||||
add_subdirectory(libsync)
|
||||
if (NOT BUILD_LIBRARIES_ONLY)
|
||||
add_subdirectory(gui)
|
||||
|
|
|
@ -12,9 +12,8 @@ include_directories(${CMAKE_SOURCE_DIR}/src/libsync
|
|||
)
|
||||
|
||||
# csync is required.
|
||||
include_directories(${CMAKE_SOURCE_DIR}/csync/src
|
||||
${CMAKE_BINARY_DIR}/csync
|
||||
${CMAKE_BINARY_DIR}/csync/src
|
||||
include_directories(${CMAKE_SOURCE_DIR}/src/csync
|
||||
${CMAKE_BINARY_DIR}/src/csync
|
||||
)
|
||||
|
||||
# Need tokenizer for netrc parser
|
||||
|
|
|
@ -1,4 +1,31 @@
|
|||
project(libcsync)
|
||||
# global needed variables
|
||||
set(APPLICATION_NAME "ocsync")
|
||||
|
||||
set(LIBRARY_VERSION ${MIRALL_VERSION})
|
||||
set(LIBRARY_SOVERSION "0")
|
||||
|
||||
# add definitions
|
||||
include(DefineCMakeDefaults)
|
||||
include(DefinePlatformDefaults)
|
||||
include(DefineCompilerFlags)
|
||||
include(DefineOptions.cmake)
|
||||
|
||||
include(DefineInstallationPaths)
|
||||
|
||||
# add macros
|
||||
include(MacroAddPlugin)
|
||||
include(MacroCopyFile)
|
||||
|
||||
find_package(SQLite3 3.8.0 REQUIRED)
|
||||
|
||||
include(ConfigureChecks.cmake)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
if (MEM_NULL_TESTS)
|
||||
add_definitions(-DCSYNC_MEM_NULL_TESTS)
|
||||
endif (MEM_NULL_TESTS)
|
||||
|
||||
add_subdirectory(std)
|
||||
|
||||
|
@ -35,30 +62,30 @@ if(NO_RENAME_EXTENSION)
|
|||
endif()
|
||||
|
||||
set(csync_SRCS
|
||||
csync.c
|
||||
csync_exclude.c
|
||||
csync_log.c
|
||||
csync_statedb.c
|
||||
csync.cpp
|
||||
csync_exclude.cpp
|
||||
csync_log.cpp
|
||||
csync_statedb.cpp
|
||||
csync_time.c
|
||||
csync_util.c
|
||||
csync_misc.c
|
||||
csync_util.cpp
|
||||
csync_misc.cpp
|
||||
|
||||
csync_update.c
|
||||
csync_reconcile.c
|
||||
csync_update.cpp
|
||||
csync_reconcile.cpp
|
||||
|
||||
csync_rename.cc
|
||||
csync_rename.cpp
|
||||
|
||||
vio/csync_vio.c
|
||||
vio/csync_vio_file_stat.c
|
||||
vio/csync_vio.cpp
|
||||
vio/csync_vio_file_stat.cpp
|
||||
)
|
||||
|
||||
if (WIN32)
|
||||
list(APPEND csync_SRCS
|
||||
vio/csync_vio_local_win.c
|
||||
vio/csync_vio_local_win.cpp
|
||||
)
|
||||
else()
|
||||
list(APPEND csync_SRCS
|
||||
vio/csync_vio_local_unix.c
|
||||
vio/csync_vio_local_unix.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
|
@ -136,4 +163,4 @@ else()
|
|||
)
|
||||
endif()
|
||||
|
||||
|
||||
configure_file(config_csync.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config_csync.h)
|
|
@ -86,7 +86,7 @@ void csync_create(CSYNC **csync, const char *local) {
|
|||
CSYNC *ctx;
|
||||
size_t len = 0;
|
||||
|
||||
ctx = c_malloc(sizeof(CSYNC));
|
||||
ctx = (CSYNC*)c_malloc(sizeof(CSYNC));
|
||||
|
||||
ctx->status_code = CSYNC_STATUS_OK;
|
||||
|
||||
|
@ -604,7 +604,7 @@ int csync_set_status(CSYNC *ctx, int status) {
|
|||
|
||||
CSYNC_STATUS csync_get_status(CSYNC *ctx) {
|
||||
if (ctx == NULL) {
|
||||
return -1;
|
||||
return CSYNC_STATUS_ERROR;
|
||||
}
|
||||
|
||||
return ctx->status_code;
|
|
@ -40,10 +40,6 @@
|
|||
#include <sys/types.h>
|
||||
#include <config_csync.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum csync_status_codes_e {
|
||||
CSYNC_STATUS_OK = 0,
|
||||
|
||||
|
@ -221,7 +217,7 @@ struct csync_vio_file_stat_s {
|
|||
int fields; // actually enum csync_vio_file_stat_fields_e fields;
|
||||
enum csync_vio_file_type_e type;
|
||||
|
||||
enum csync_vio_file_flags_e flags;
|
||||
int flags;
|
||||
|
||||
char *original_name; // only set if locale conversion fails
|
||||
|
||||
|
@ -504,10 +500,6 @@ int OCSYNC_EXPORT csync_abort_requested(CSYNC *ctx);
|
|||
char OCSYNC_EXPORT *csync_normalize_etag(const char *);
|
||||
time_t OCSYNC_EXPORT oc_httpdate_parse( const char *date );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* }@
|
||||
*/
|
|
@ -71,7 +71,7 @@ int _csync_exclude_add(c_strlist_t **inList, const char *string) {
|
|||
static const char *csync_exclude_expand_escapes(const char * input)
|
||||
{
|
||||
size_t i_len = strlen(input) + 1;
|
||||
char *out = c_malloc(i_len); // out can only be shorter
|
||||
char *out = (char*)c_malloc(i_len); // out can only be shorter
|
||||
|
||||
size_t i = 0;
|
||||
size_t o = 0;
|
||||
|
@ -141,7 +141,7 @@ int csync_exclude_load(const char *fname, c_strlist_t **list) {
|
|||
rc = 0;
|
||||
goto out;
|
||||
}
|
||||
buf = c_malloc(size + 1);
|
||||
buf = (char*)c_malloc(size + 1);
|
||||
if (read(fd, buf, size) != size) {
|
||||
rc = -1;
|
||||
goto out;
|
||||
|
@ -220,6 +220,7 @@ static CSYNC_EXCLUDE_TYPE _csync_excluded_common(c_strlist_t *excludes, const ch
|
|||
int rc = -1;
|
||||
CSYNC_EXCLUDE_TYPE match = CSYNC_NOT_EXCLUDED;
|
||||
CSYNC_EXCLUDE_TYPE type = CSYNC_NOT_EXCLUDED;
|
||||
c_strlist_t *path_components = NULL;
|
||||
|
||||
/* split up the path */
|
||||
bname = strrchr(path, '/');
|
||||
|
@ -274,8 +275,7 @@ static CSYNC_EXCLUDE_TYPE _csync_excluded_common(c_strlist_t *excludes, const ch
|
|||
}
|
||||
|
||||
// Filter out characters not allowed in a filename on windows
|
||||
const char *p = NULL;
|
||||
for (p = path; *p; p++) {
|
||||
for (const char *p = path; *p; p++) {
|
||||
switch (*p) {
|
||||
case '\\':
|
||||
case ':':
|
||||
|
@ -331,7 +331,6 @@ static CSYNC_EXCLUDE_TYPE _csync_excluded_common(c_strlist_t *excludes, const ch
|
|||
goto out;
|
||||
}
|
||||
|
||||
c_strlist_t *path_components = NULL;
|
||||
if (check_leading_dirs) {
|
||||
/* Build a list of path components to check. */
|
||||
path_components = c_strlist_new(32);
|
|
@ -198,7 +198,7 @@ char *csync_normalize_etag(const char *etag)
|
|||
len -= 2;
|
||||
}
|
||||
|
||||
buf = c_malloc( len+1 );
|
||||
buf = (char*)c_malloc( len+1 );
|
||||
strncpy( buf, etag, len );
|
||||
buf[len] = '\0';
|
||||
return buf;
|
|
@ -163,7 +163,7 @@ struct csync_file_stat_s {
|
|||
size_t pathlen; /* u64 */
|
||||
uint64_t inode; /* u64 */
|
||||
mode_t mode; /* u32 */
|
||||
unsigned int type : 4;
|
||||
enum csync_ftw_type_e type : 4;
|
||||
unsigned int child_modified : 1;
|
||||
unsigned int has_ignored_files : 1; /* specify that a directory, or child directory contains ignored files */
|
||||
|
|
@ -31,6 +31,8 @@
|
|||
#define CSYNC_LOG_CATEGORY_NAME "csync.reconciler"
|
||||
#include "csync_log.h"
|
||||
|
||||
// Needed for PRIu64 on MinGW in C++ mode.
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include "inttypes.h"
|
||||
|
||||
/* Check if a file is ignored because one parent is ignored.
|
|
@ -18,10 +18,8 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
extern "C" {
|
||||
#include "csync_private.h"
|
||||
#include "csync_rename.h"
|
||||
}
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
@ -55,7 +53,6 @@ struct csync_rename_s {
|
|||
std::vector<renameop> todo;
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
void csync_rename_destroy(CSYNC* ctx)
|
||||
{
|
||||
delete reinterpret_cast<csync_rename_s *>(ctx->rename_info);
|
||||
|
@ -98,5 +95,3 @@ bool csync_rename_count(CSYNC *ctx) {
|
|||
csync_rename_s* d = csync_rename_s::get(ctx);
|
||||
return d->folder_renamed_from.size();
|
||||
}
|
||||
|
||||
}
|
|
@ -22,10 +22,6 @@
|
|||
|
||||
#include "csync.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Return the final destination path of a given patch in case of renames */
|
||||
char OCSYNC_EXPORT *csync_rename_adjust_path(CSYNC *ctx, const char *path);
|
||||
/* Return the source of a given path in case of renames */
|
||||
|
@ -34,7 +30,3 @@ void OCSYNC_EXPORT csync_rename_destroy(CSYNC *ctx);
|
|||
void OCSYNC_EXPORT csync_rename_record(CSYNC *ctx, const char *from, const char *to);
|
||||
/* Return the amount of renamed item recorded */
|
||||
bool OCSYNC_EXPORT csync_rename_count(CSYNC *ctx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -31,7 +31,6 @@
|
|||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "c_lib.h"
|
||||
#include "csync_private.h"
|
||||
|
@ -48,6 +47,10 @@
|
|||
#include "csync_log.h"
|
||||
#include "csync_rename.h"
|
||||
|
||||
// Needed for PRIu64 on MinGW in C++ mode.
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
|
||||
#define BUF_SIZE 16
|
||||
|
||||
#define sqlite_open(A, B) sqlite3_open_v2(A,B, SQLITE_OPEN_READONLY+SQLITE_OPEN_NOMUTEX, NULL)
|
||||
|
@ -257,7 +260,7 @@ static int _csync_file_stat_from_metadata_table( csync_file_stat_t **st, sqlite3
|
|||
|
||||
/* phash, pathlen, path, inode, uid, gid, mode, modtime */
|
||||
len = sqlite3_column_int(stmt, 1);
|
||||
*st = c_malloc(sizeof(csync_file_stat_t) + len + 1);
|
||||
*st = (csync_file_stat_t*)c_malloc(sizeof(csync_file_stat_t) + len + 1);
|
||||
/* clear the whole structure */
|
||||
ZERO_STRUCTP(*st);
|
||||
|
||||
|
@ -272,7 +275,7 @@ static int _csync_file_stat_from_metadata_table( csync_file_stat_t **st, sqlite3
|
|||
(*st)->modtime = strtoul((char*)sqlite3_column_text(stmt, 7), NULL, 10);
|
||||
|
||||
if(*st && column_count > 8 ) {
|
||||
(*st)->type = sqlite3_column_int(stmt, 8);
|
||||
(*st)->type = static_cast<enum csync_ftw_type_e>(sqlite3_column_int(stmt, 8));
|
||||
}
|
||||
|
||||
if(column_count > 9 && sqlite3_column_text(stmt, 9)) {
|
|
@ -33,10 +33,6 @@
|
|||
#ifndef _CSYNC_STATEDB_H
|
||||
#define _CSYNC_STATEDB_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "c_lib.h"
|
||||
#include "csync_private.h"
|
||||
|
||||
|
@ -96,10 +92,6 @@ int csync_statedb_get_below_path(CSYNC *ctx, const char *path);
|
|||
*/
|
||||
c_strlist_t *csync_statedb_query(sqlite3 *db, const char *statement);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* }@
|
||||
*/
|
|
@ -34,6 +34,8 @@
|
|||
#ifndef _WIN32
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#define CSYNC_LOG_CATEGORY_NAME "csync.time"
|
|
@ -21,6 +21,10 @@
|
|||
#ifndef _CSYNC_TIME_H
|
||||
#define _CSYNC_TIME_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include "csync_private.h"
|
||||
|
@ -28,4 +32,8 @@
|
|||
int csync_gettime(struct timespec *tp);
|
||||
void csync_sleep(unsigned int msecs);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _CSYNC_TIME_H */
|
|
@ -28,7 +28,6 @@
|
|||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
#include <time.h>
|
||||
#include <math.h>
|
||||
|
||||
|
@ -48,6 +47,10 @@
|
|||
#include "csync_log.h"
|
||||
#include "csync_rename.h"
|
||||
|
||||
// Needed for PRIu64 on MinGW in C++ mode.
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
|
||||
/* calculate the hash of a given uri */
|
||||
static uint64_t _hash_of_file(CSYNC *ctx, const char *file) {
|
||||
const char *path;
|
||||
|
@ -159,7 +162,7 @@ static bool _csync_mtime_equal(time_t a, time_t b)
|
|||
* See doc/dev/sync-algorithm.md for an overview.
|
||||
*/
|
||||
static int _csync_detect_update(CSYNC *ctx, const char *file,
|
||||
const csync_vio_file_stat_t *fs, const int type) {
|
||||
const csync_vio_file_stat_t *fs, enum csync_ftw_type_e type) {
|
||||
uint64_t h = 0;
|
||||
size_t len = 0;
|
||||
size_t size = 0;
|
||||
|
@ -224,7 +227,7 @@ static int _csync_detect_update(CSYNC *ctx, const char *file,
|
|||
}
|
||||
size = sizeof(csync_file_stat_t) + len + 1;
|
||||
|
||||
st = c_malloc(size);
|
||||
st = static_cast<csync_file_stat_t *>(c_malloc(size));
|
||||
|
||||
/* Set instruction by default to none */
|
||||
st->instruction = CSYNC_INSTRUCTION_NONE;
|
||||
|
@ -540,9 +543,9 @@ out:
|
|||
}
|
||||
|
||||
int csync_walker(CSYNC *ctx, const char *file, const csync_vio_file_stat_t *fs,
|
||||
enum csync_ftw_flags_e flag) {
|
||||
int flag) {
|
||||
int rc = -1;
|
||||
int type = CSYNC_FTW_TYPE_SKIP;
|
||||
enum csync_ftw_type_e type = CSYNC_FTW_TYPE_SKIP;
|
||||
csync_file_stat_t *st = NULL;
|
||||
uint64_t h;
|
||||
|
||||
|
@ -648,13 +651,13 @@ int csync_ftw(CSYNC *ctx, const char *uri, csync_walker_fn fn,
|
|||
int rc = 0;
|
||||
int res = 0;
|
||||
|
||||
bool do_read_from_db = (ctx->current == REMOTE_REPLICA && ctx->remote.read_from_db);
|
||||
|
||||
if (!depth) {
|
||||
mark_current_item_ignored(ctx, previous_fs, CSYNC_STATUS_INDIVIDUAL_TOO_DEEP);
|
||||
goto done;
|
||||
}
|
||||
|
||||
bool do_read_from_db = (ctx->current == REMOTE_REPLICA && ctx->remote.read_from_db);
|
||||
|
||||
read_from_db = ctx->remote.read_from_db;
|
||||
|
||||
// if the etag of this dir is still the same, its content is restored from the
|
|
@ -53,7 +53,7 @@ enum csync_ftw_flags_e {
|
|||
};
|
||||
|
||||
typedef int (*csync_walker_fn) (CSYNC *ctx, const char *file,
|
||||
const csync_vio_file_stat_t *fs, enum csync_ftw_flags_e flag);
|
||||
const csync_vio_file_stat_t *fs, int flag);
|
||||
|
||||
/**
|
||||
* @brief The walker function to use in the file tree walker.
|
||||
|
@ -68,8 +68,7 @@ typedef int (*csync_walker_fn) (CSYNC *ctx, const char *file,
|
|||
*
|
||||
* @return 0 on success, < 0 on error.
|
||||
*/
|
||||
int csync_walker(CSYNC *ctx, const char *file, const csync_vio_file_stat_t *fs,
|
||||
enum csync_ftw_flags_e flag);
|
||||
int csync_walker(CSYNC *ctx, const char *file, const csync_vio_file_stat_t *fs, int flag);
|
||||
|
||||
/**
|
||||
* @brief The file tree walker.
|
|
@ -28,6 +28,7 @@
|
|||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "c_jhash.h"
|
||||
#include "csync_util.h"
|
|
@ -21,17 +21,9 @@
|
|||
#ifndef _CSYNC_VERSION_H
|
||||
#define _CSYNC_VERSION_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define CSYNC_STRINGIFY(s) CSYNC_TOSTRING(s)
|
||||
#define CSYNC_TOSTRING(s) #s
|
||||
|
||||
#define MIRALL_VERSION @MIRALL_VERSION@
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _CSYNC_VERSION_H
|
|
@ -20,7 +20,7 @@ set(cstdlib_SRCS
|
|||
c_rbtree.c
|
||||
c_string.c
|
||||
c_time.c
|
||||
c_utf8.cc
|
||||
c_utf8.cpp
|
||||
)
|
||||
|
||||
if(NOT HAVE_ASPRINTF AND NOT HAVE___MINGW_ASPRINTF)
|
|
@ -34,6 +34,10 @@
|
|||
#ifndef ASPRINTF_H
|
||||
#define ASPRINTF_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
/**
|
||||
|
@ -56,5 +60,9 @@ vasprintf (char **, const char *, va_list);
|
|||
int
|
||||
asprintf (char **, const char *, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -34,6 +34,10 @@
|
|||
#ifndef _C_ALLOC_H
|
||||
#define _C_ALLOC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "c_macro.h"
|
||||
|
@ -113,4 +117,9 @@ char *c_strndup(const char *str, size_t size);
|
|||
/**
|
||||
* }@
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _C_ALLOC_H */
|
|
@ -32,6 +32,10 @@
|
|||
#ifndef _C_PATH_H
|
||||
#define _C_PATH_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "c_macro.h"
|
||||
#include "c_private.h"
|
||||
|
||||
|
@ -139,4 +143,9 @@ mbchar_t* c_utf8_path_to_locale(const char *str);
|
|||
/**
|
||||
* }@
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _C_PATH_H */
|
|
@ -66,6 +66,10 @@
|
|||
#ifndef _C_RBTREE_H
|
||||
#define _C_RBTREE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Forward declarations */
|
||||
struct c_rbtree_s; typedef struct c_rbtree_s c_rbtree_t;
|
||||
struct c_rbnode_s; typedef struct c_rbnode_s c_rbnode_t;
|
||||
|
@ -306,4 +310,9 @@ int c_rbtree_check_sanity(c_rbtree_t *tree);
|
|||
/**
|
||||
* }@
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _C_RBTREE_H */
|
|
@ -32,6 +32,10 @@
|
|||
#ifndef _C_STR_H
|
||||
#define _C_STR_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "c_private.h"
|
||||
#include "c_macro.h"
|
||||
|
||||
|
@ -217,5 +221,10 @@ mbchar_t* c_utf8_string_to_locale(const char *wstr);
|
|||
/**
|
||||
* }@
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _C_STR_H */
|
||||
|
|
@ -25,10 +25,6 @@
|
|||
#include "c_path.h"
|
||||
#include "c_time.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
struct timespec c_tspecdiff(struct timespec time1, struct timespec time0) {
|
||||
struct timespec ret;
|
||||
int xsec = 0;
|
|
@ -21,7 +21,15 @@
|
|||
#ifndef _C_TIME_H
|
||||
#define _C_TIME_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <time.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Calculate time difference
|
||||
|
@ -52,4 +60,8 @@ double c_secdiff(struct timespec clock1, struct timespec clock0);
|
|||
|
||||
int c_utimes(const char *uri, const struct timeval *times);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _C_TIME_H */
|
|
@ -48,7 +48,7 @@ csync_vio_handle_t *csync_vio_local_opendir(const char *name) {
|
|||
dhandle_t *handle = NULL;
|
||||
mbchar_t *dirname = NULL;
|
||||
|
||||
handle = c_malloc(sizeof(dhandle_t));
|
||||
handle = (dhandle_t*)c_malloc(sizeof(dhandle_t));
|
||||
|
||||
dirname = c_utf8_path_to_locale(name);
|
||||
|
||||
|
@ -89,6 +89,7 @@ csync_vio_file_stat_t *csync_vio_local_readdir(csync_vio_handle_t *dhandle) {
|
|||
csync_vio_file_stat_t *file_stat = NULL;
|
||||
|
||||
handle = (dhandle_t *) dhandle;
|
||||
struct _tdirent *dirent = NULL;
|
||||
|
||||
errno = 0;
|
||||
file_stat = csync_vio_file_stat_new();
|
||||
|
@ -97,8 +98,6 @@ csync_vio_file_stat_t *csync_vio_local_readdir(csync_vio_handle_t *dhandle) {
|
|||
}
|
||||
file_stat->fields = CSYNC_VIO_FILE_STAT_FIELDS_NONE;
|
||||
|
||||
struct _tdirent *dirent = NULL;
|
||||
|
||||
dirent = _treaddir(handle->dh);
|
||||
if (dirent == NULL) {
|
||||
goto err;
|
|
@ -52,7 +52,7 @@ csync_vio_handle_t *csync_vio_local_opendir(const char *name) {
|
|||
dhandle_t *handle = NULL;
|
||||
mbchar_t *dirname = NULL;
|
||||
|
||||
handle = c_malloc(sizeof(dhandle_t));
|
||||
handle = (dhandle_t*)c_malloc(sizeof(dhandle_t));
|
||||
|
||||
// the file wildcard has to be attached
|
||||
int len_name = strlen(name);
|
||||
|
@ -60,7 +60,7 @@ csync_vio_handle_t *csync_vio_local_opendir(const char *name) {
|
|||
char *h = NULL;
|
||||
|
||||
// alloc an enough large buffer to take the name + '/*' + the closing zero.
|
||||
h = c_malloc(len_name+3);
|
||||
h = (char*)c_malloc(len_name+3);
|
||||
strncpy( h, name, 1+len_name);
|
||||
strncat(h, "/*", 2);
|
||||
|
|
@ -181,11 +181,9 @@ set(3rdparty_INC
|
|||
include_directories(${3rdparty_INC})
|
||||
|
||||
# csync is required.
|
||||
include_directories(${CMAKE_SOURCE_DIR}/csync/src
|
||||
${CMAKE_BINARY_DIR}/csync
|
||||
${CMAKE_BINARY_DIR}/csync/src
|
||||
include_directories(${CMAKE_SOURCE_DIR}/src/csync
|
||||
${CMAKE_BINARY_DIR}/src/csync
|
||||
)
|
||||
|
||||
include_directories(../libsync ${CMAKE_CURRENT_BINARY_DIR}/../libsync)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
|
|
|
@ -5,9 +5,8 @@ configure_file( version.h.in "${CMAKE_CURRENT_BINARY_DIR}/version.h" )
|
|||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
||||
# csync is required.
|
||||
include_directories(${CMAKE_SOURCE_DIR}/csync/src
|
||||
${CMAKE_BINARY_DIR}/csync
|
||||
${CMAKE_BINARY_DIR}/csync/src
|
||||
include_directories(${CMAKE_SOURCE_DIR}/src/csync
|
||||
${CMAKE_BINARY_DIR}/src/csync
|
||||
)
|
||||
|
||||
if ( APPLE )
|
||||
|
|
|
@ -12,16 +12,15 @@
|
|||
* for more details.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "excludedfiles.h"
|
||||
#include "utility.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
extern "C" {
|
||||
#include "std/c_string.h"
|
||||
#include "csync.h"
|
||||
#include "csync_exclude.h"
|
||||
}
|
||||
|
||||
using namespace OCC;
|
||||
|
||||
|
|
|
@ -20,11 +20,9 @@
|
|||
#include <QSet>
|
||||
#include <QString>
|
||||
|
||||
extern "C" {
|
||||
#include "std/c_string.h"
|
||||
#include "csync.h"
|
||||
#include "csync_exclude.h" // for CSYNC_EXCLUDE_TYPE
|
||||
}
|
||||
|
||||
namespace OCC {
|
||||
|
||||
|
|
|
@ -39,14 +39,11 @@
|
|||
|
||||
// We use some internals of csync:
|
||||
extern "C" int c_utimes(const char *, const struct timeval *);
|
||||
extern "C" void csync_win32_set_file_hidden(const char *file, bool h);
|
||||
|
||||
extern "C" {
|
||||
#include "csync.h"
|
||||
#include "vio/csync_vio_local.h"
|
||||
#include "std/c_path.h"
|
||||
#include "std/c_string.h"
|
||||
}
|
||||
|
||||
namespace OCC {
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <QIODevice>
|
||||
#include <QMutex>
|
||||
|
||||
#include "csync_util.h"
|
||||
#include "syncfileitem.h"
|
||||
#include "syncjournaldb.h"
|
||||
#include "bandwidthmanager.h"
|
||||
|
@ -35,8 +36,6 @@ namespace OCC {
|
|||
|
||||
Q_DECLARE_LOGGING_CATEGORY(lcPropagator)
|
||||
|
||||
extern "C" const char *csync_instruction_str(enum csync_instructions_e instr);
|
||||
|
||||
/** Free disk space threshold below which syncs will abort and not even start.
|
||||
*/
|
||||
qint64 criticalFreeSpaceLimit();
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
|
||||
#include "ownsql.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "syncjournaldb.h"
|
||||
#include "syncjournalfilerecord.h"
|
||||
#include "utility.h"
|
||||
|
@ -31,7 +29,7 @@
|
|||
#include "asserts.h"
|
||||
#include "checksums.h"
|
||||
|
||||
#include "../../csync/src/std/c_jhash.h"
|
||||
#include "std/c_jhash.h"
|
||||
|
||||
namespace OCC {
|
||||
|
||||
|
|
|
@ -275,7 +275,7 @@ void Utility::usleep(int usec)
|
|||
|
||||
bool Utility::fsCasePreserving()
|
||||
{
|
||||
#ifndef WITH_TESTING
|
||||
#ifdef WITH_TESTING
|
||||
QByteArray env = qgetenv("OWNCLOUD_TEST_CASE_PRESERVING");
|
||||
if (!env.isEmpty())
|
||||
return env.toInt();
|
||||
|
|
|
@ -1,7 +1,17 @@
|
|||
include_directories(${CMAKE_BINARY_DIR}/csync ${CMAKE_BINARY_DIR}/csync/src ${CMAKE_BINARY_DIR}/src)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/csync/src/)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/csync/src/std ${CMAKE_SOURCE_DIR}/src)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/src/3rdparty/qtokenizer)
|
||||
include_directories(${QT_INCLUDES}
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
${CMAKE_SOURCE_DIR}/src/3rdparty/qtokenizer
|
||||
${CMAKE_SOURCE_DIR}/src/csync
|
||||
${CMAKE_SOURCE_DIR}/src/csync/std
|
||||
${CMAKE_SOURCE_DIR}/src/gui
|
||||
${CMAKE_SOURCE_DIR}/src/libsync
|
||||
${CMAKE_BINARY_DIR}/src/csync
|
||||
${CMAKE_BINARY_DIR}/src/libsync
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
include_directories()
|
||||
|
||||
include(QtVersionAbstraction)
|
||||
setup_qt()
|
||||
|
@ -61,3 +71,9 @@ list(APPEND FolderMan_SRC stub.cpp )
|
|||
owncloud_add_test(FolderMan "${FolderMan_SRC}")
|
||||
|
||||
configure_file(test_journal.db "${PROJECT_BINARY_DIR}/bin/test_journal.db" COPYONLY)
|
||||
|
||||
find_package(CMocka)
|
||||
if (CMOCKA_FOUND)
|
||||
include(AddCMockaTest)
|
||||
add_subdirectory(csync)
|
||||
endif (CMOCKA_FOUND)
|
||||
|
|
3
test/csync/AUTHORS
Normal file
3
test/csync/AUTHORS
Normal file
|
@ -0,0 +1,3 @@
|
|||
Andreas Schneider <asn@cryptomilk.org>
|
||||
Klaas Freitag <freitag@owncloud.com>
|
||||
Olivier Goffart <olivier>
|
|
@ -3,6 +3,7 @@ project(tests C)
|
|||
set(TORTURE_LIBRARY torture)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CSYNC_PUBLIC_INCLUDE_DIRS}
|
||||
${CSTDLIB_PUBLIC_INCLUDE_DIRS}
|
||||
${CMAKE_BINARY_DIR}
|
||||
|
@ -28,28 +29,28 @@ add_cmocka_test(check_std_c_time std_tests/check_std_c_time.c ${TEST_TARGET_LIBR
|
|||
|
||||
# csync tests
|
||||
# This will be rewritten soon anyway.
|
||||
#add_cmocka_test(check_logger log_tests/check_log.c ${TEST_TARGET_LIBRARIES})
|
||||
#add_cmocka_test(check_logger log_tests/check_log.cpp ${TEST_TARGET_LIBRARIES})
|
||||
|
||||
add_cmocka_test(check_csync_create csync_tests/check_csync_create.c ${TEST_TARGET_LIBRARIES})
|
||||
add_cmocka_test(check_csync_log csync_tests/check_csync_log.c ${TEST_TARGET_LIBRARIES})
|
||||
add_cmocka_test(check_csync_exclude csync_tests/check_csync_exclude.c ${TEST_TARGET_LIBRARIES})
|
||||
add_cmocka_test(check_csync_statedb_load csync_tests/check_csync_statedb_load.c ${TEST_TARGET_LIBRARIES})
|
||||
add_cmocka_test(check_csync_util csync_tests/check_csync_util.c ${TEST_TARGET_LIBRARIES})
|
||||
add_cmocka_test(check_csync_misc csync_tests/check_csync_misc.c ${TEST_TARGET_LIBRARIES})
|
||||
add_cmocka_test(check_csync_create csync_tests/check_csync_create.cpp ${TEST_TARGET_LIBRARIES})
|
||||
add_cmocka_test(check_csync_log csync_tests/check_csync_log.cpp ${TEST_TARGET_LIBRARIES})
|
||||
add_cmocka_test(check_csync_exclude csync_tests/check_csync_exclude.cpp ${TEST_TARGET_LIBRARIES})
|
||||
add_cmocka_test(check_csync_statedb_load csync_tests/check_csync_statedb_load.cpp ${TEST_TARGET_LIBRARIES})
|
||||
add_cmocka_test(check_csync_util csync_tests/check_csync_util.cpp ${TEST_TARGET_LIBRARIES})
|
||||
add_cmocka_test(check_csync_misc csync_tests/check_csync_misc.cpp ${TEST_TARGET_LIBRARIES})
|
||||
|
||||
# csync tests which require init
|
||||
add_cmocka_test(check_csync_init csync_tests/check_csync_init.c ${TEST_TARGET_LIBRARIES})
|
||||
add_cmocka_test(check_csync_statedb_query csync_tests/check_csync_statedb_query.c ${TEST_TARGET_LIBRARIES})
|
||||
add_cmocka_test(check_csync_commit csync_tests/check_csync_commit.c ${TEST_TARGET_LIBRARIES})
|
||||
add_cmocka_test(check_csync_init csync_tests/check_csync_init.cpp ${TEST_TARGET_LIBRARIES})
|
||||
add_cmocka_test(check_csync_statedb_query csync_tests/check_csync_statedb_query.cpp ${TEST_TARGET_LIBRARIES})
|
||||
add_cmocka_test(check_csync_commit csync_tests/check_csync_commit.cpp ${TEST_TARGET_LIBRARIES})
|
||||
|
||||
# vio
|
||||
add_cmocka_test(check_vio_file_stat vio_tests/check_vio_file_stat.c ${TEST_TARGET_LIBRARIES})
|
||||
add_cmocka_test(check_vio vio_tests/check_vio.c ${TEST_TARGET_LIBRARIES})
|
||||
add_cmocka_test(check_vio_ext vio_tests/check_vio_ext.c ${TEST_TARGET_LIBRARIES})
|
||||
add_cmocka_test(check_vio_file_stat vio_tests/check_vio_file_stat.cpp ${TEST_TARGET_LIBRARIES})
|
||||
add_cmocka_test(check_vio vio_tests/check_vio.cpp ${TEST_TARGET_LIBRARIES})
|
||||
add_cmocka_test(check_vio_ext vio_tests/check_vio_ext.cpp ${TEST_TARGET_LIBRARIES})
|
||||
|
||||
# sync
|
||||
add_cmocka_test(check_csync_update csync_tests/check_csync_update.c ${TEST_TARGET_LIBRARIES})
|
||||
add_cmocka_test(check_csync_update csync_tests/check_csync_update.cpp ${TEST_TARGET_LIBRARIES})
|
||||
|
||||
# encoding
|
||||
add_cmocka_test(check_encoding_functions encoding_tests/check_encoding.c ${TEST_TARGET_LIBRARIES})
|
||||
add_cmocka_test(check_encoding_functions encoding_tests/check_encoding.cpp ${TEST_TARGET_LIBRARIES})
|
||||
|
502
test/csync/COPYING
Normal file
502
test/csync/COPYING
Normal file
|
@ -0,0 +1,502 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
|
@ -53,7 +53,7 @@ static int setup_module(void **state) {
|
|||
}
|
||||
|
||||
static int teardown(void **state) {
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
int rc;
|
||||
|
||||
rc = csync_destroy(csync);
|
||||
|
@ -71,7 +71,7 @@ static int teardown(void **state) {
|
|||
|
||||
static void check_csync_commit(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
int rc;
|
||||
|
||||
rc = csync_commit(csync);
|
||||
|
@ -82,7 +82,7 @@ static void check_csync_commit(void **state)
|
|||
|
||||
static void check_csync_commit_dummy(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
int rc;
|
||||
|
||||
rc = csync_commit(csync);
|
|
@ -25,9 +25,9 @@
|
|||
#include "torture.h"
|
||||
|
||||
#define CSYNC_TEST 1
|
||||
#include "csync_exclude.c"
|
||||
#include "csync_exclude.cpp"
|
||||
|
||||
#define EXCLUDE_LIST_FILE SOURCEDIR"/../sync-exclude.lst"
|
||||
#define EXCLUDE_LIST_FILE SOURCEDIR"/../../sync-exclude.lst"
|
||||
|
||||
static int setup(void **state) {
|
||||
CSYNC *csync;
|
||||
|
@ -64,7 +64,7 @@ static int setup_init(void **state) {
|
|||
}
|
||||
|
||||
static int teardown(void **state) {
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
int rc;
|
||||
|
||||
rc = csync_destroy(csync);
|
||||
|
@ -82,14 +82,14 @@ static int teardown(void **state) {
|
|||
|
||||
static void check_csync_exclude_add(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
_csync_exclude_add(&(csync->excludes), "/tmp/check_csync1/*");
|
||||
assert_string_equal(csync->excludes->vector[0], "/tmp/check_csync1/*");
|
||||
}
|
||||
|
||||
static void check_csync_exclude_load(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
int rc;
|
||||
|
||||
rc = csync_exclude_load(EXCLUDE_LIST_FILE, &(csync->excludes) );
|
||||
|
@ -101,7 +101,7 @@ static void check_csync_exclude_load(void **state)
|
|||
|
||||
static void check_csync_excluded(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
int rc;
|
||||
|
||||
rc = csync_excluded_no_ctx(csync->excludes, "", CSYNC_FTW_TYPE_FILE);
|
||||
|
@ -221,7 +221,7 @@ static void check_csync_excluded(void **state)
|
|||
|
||||
static void check_csync_excluded_traversal(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
int rc;
|
||||
|
||||
_csync_exclude_add( &(csync->excludes), "/exclude" );
|
||||
|
@ -271,7 +271,7 @@ static void check_csync_excluded_traversal(void **state)
|
|||
|
||||
static void check_csync_pathes(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
int rc;
|
||||
|
||||
_csync_exclude_add( &(csync->excludes), "/exclude" );
|
||||
|
@ -319,7 +319,7 @@ static void check_csync_pathes(void **state)
|
|||
assert_int_equal(rc, CSYNC_FILE_EXCLUDE_LIST);
|
||||
}
|
||||
|
||||
static void check_csync_is_windows_reserved_word() {
|
||||
static void check_csync_is_windows_reserved_word(void **) {
|
||||
assert_true(csync_is_windows_reserved_word("CON"));
|
||||
assert_true(csync_is_windows_reserved_word("con"));
|
||||
assert_true(csync_is_windows_reserved_word("CON."));
|
||||
|
@ -339,7 +339,7 @@ static void check_csync_is_windows_reserved_word() {
|
|||
|
||||
static void check_csync_excluded_performance(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
|
||||
const int N = 10000;
|
||||
int totalRc = 0;
|
|
@ -50,7 +50,7 @@ static int setup_module(void **state) {
|
|||
}
|
||||
|
||||
static int teardown(void **state) {
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
int rc;
|
||||
|
||||
rc = csync_destroy(csync);
|
||||
|
@ -68,7 +68,7 @@ static int teardown(void **state) {
|
|||
|
||||
static void check_csync_init(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
|
||||
csync_init(csync, "");
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
#include "torture.h"
|
||||
|
||||
#include "csync.h"
|
||||
#include "csync_log.c"
|
||||
#include "csync_log.cpp"
|
||||
#include "c_private.h"
|
||||
|
||||
static int setup(void **state) {
|
||||
|
@ -41,7 +41,7 @@ static int setup(void **state) {
|
|||
}
|
||||
|
||||
static int teardown(void **state) {
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
int rc;
|
||||
|
||||
rc = csync_destroy(csync);
|
|
@ -22,7 +22,7 @@
|
|||
#include "torture.h"
|
||||
|
||||
#define CSYNC_TEST 1
|
||||
#include "csync_statedb.c"
|
||||
#include "csync_statedb.cpp"
|
||||
|
||||
#define TESTDB "/tmp/check_csync1/test.db"
|
||||
|
||||
|
@ -52,7 +52,7 @@ static int setup(void **state) {
|
|||
}
|
||||
|
||||
static int teardown(void **state) {
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
int rc;
|
||||
|
||||
rc = csync_destroy(csync);
|
||||
|
@ -68,7 +68,7 @@ static int teardown(void **state) {
|
|||
|
||||
static void check_csync_statedb_load(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
int rc;
|
||||
|
||||
rc = csync_statedb_load(csync, TESTDB, &csync->statedb.db);
|
||||
|
@ -79,7 +79,7 @@ static void check_csync_statedb_load(void **state)
|
|||
|
||||
static void check_csync_statedb_close(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
csync_stat_t sb;
|
||||
time_t modtime;
|
||||
mbchar_t *testdb = c_utf8_path_to_locale(TESTDB);
|
|
@ -20,7 +20,7 @@
|
|||
#include "torture.h"
|
||||
|
||||
#define CSYNC_TEST 1
|
||||
#include "csync_statedb.c"
|
||||
#include "csync_statedb.cpp"
|
||||
|
||||
#define TESTDB "/tmp/check_csync1/test.db"
|
||||
#define TESTDBTMP "/tmp/check_csync1/test.db.ctmp"
|
||||
|
@ -97,7 +97,7 @@ static int setup_db(void **state)
|
|||
}
|
||||
|
||||
static int teardown(void **state) {
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
int rc = 0;
|
||||
|
||||
rc = csync_destroy(csync);
|
||||
|
@ -115,7 +115,7 @@ static int teardown(void **state) {
|
|||
|
||||
static void check_csync_statedb_query_statement(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
c_strlist_t *result;
|
||||
|
||||
result = csync_statedb_query(csync->statedb.db, "");
|
||||
|
@ -133,7 +133,7 @@ static void check_csync_statedb_query_statement(void **state)
|
|||
|
||||
static void check_csync_statedb_drop_tables(void **state)
|
||||
{
|
||||
// CSYNC *csync = *state;
|
||||
// CSYNC *csync = (CSYNC*)*state;
|
||||
int rc = 0;
|
||||
(void) state;
|
||||
|
||||
|
@ -147,7 +147,7 @@ static void check_csync_statedb_drop_tables(void **state)
|
|||
|
||||
static void check_csync_statedb_insert_metadata(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
csync_file_stat_t *st;
|
||||
int i, rc = 0;
|
||||
|
||||
|
@ -155,7 +155,7 @@ static void check_csync_statedb_insert_metadata(void **state)
|
|||
assert_int_equal(rc, 0);
|
||||
|
||||
for (i = 0; i < 100; i++) {
|
||||
st = c_malloc(sizeof(csync_file_stat_t) + 30 );
|
||||
st = (csync_file_stat_t*)c_malloc(sizeof(csync_file_stat_t) + 30 );
|
||||
snprintf(st->path, 29, "file_%d" , i );
|
||||
st->phash = i;
|
||||
|
||||
|
@ -169,12 +169,12 @@ static void check_csync_statedb_insert_metadata(void **state)
|
|||
|
||||
static void check_csync_statedb_write(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
csync_file_stat_t *st;
|
||||
int i, rc;
|
||||
|
||||
for (i = 0; i < 100; i++) {
|
||||
st = c_malloc(sizeof(csync_file_stat_t) + 30);
|
||||
st = (csync_file_stat_t*)c_malloc(sizeof(csync_file_stat_t) + 30);
|
||||
snprintf(st->path, 29, "file_%d" , i );
|
||||
st->phash = i;
|
||||
|
||||
|
@ -189,7 +189,7 @@ static void check_csync_statedb_write(void **state)
|
|||
|
||||
static void check_csync_statedb_get_stat_by_hash_not_found(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
csync_file_stat_t *tmp;
|
||||
|
||||
tmp = csync_statedb_get_stat_by_hash(csync, (uint64_t) 666);
|
||||
|
@ -201,7 +201,7 @@ static void check_csync_statedb_get_stat_by_hash_not_found(void **state)
|
|||
|
||||
static void check_csync_statedb_get_stat_by_inode_not_found(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
csync_file_stat_t *tmp;
|
||||
|
||||
tmp = csync_statedb_get_stat_by_inode(csync, (ino_t) 666);
|
|
@ -19,7 +19,7 @@
|
|||
*/
|
||||
#include "torture.h"
|
||||
|
||||
#include "csync_update.c"
|
||||
#include "csync_update.cpp"
|
||||
|
||||
#define TESTDB "/tmp/check_csync/journal.db"
|
||||
|
||||
|
@ -150,7 +150,7 @@ static int setup_ftw(void **state)
|
|||
|
||||
static int teardown(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
int rc;
|
||||
|
||||
unlink( csync->statedb.file);
|
||||
|
@ -233,7 +233,7 @@ static csync_vio_file_stat_t* create_fstat(const char *name,
|
|||
static int failing_fn(CSYNC *ctx,
|
||||
const char *file,
|
||||
const csync_vio_file_stat_t *fs,
|
||||
enum csync_ftw_flags_e flag)
|
||||
int flag)
|
||||
{
|
||||
(void) ctx;
|
||||
(void) file;
|
||||
|
@ -246,7 +246,7 @@ static int failing_fn(CSYNC *ctx,
|
|||
/* detect a new file */
|
||||
static void check_csync_detect_update(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
csync_file_stat_t *st;
|
||||
csync_vio_file_stat_t *fs;
|
||||
int rc;
|
||||
|
@ -261,7 +261,7 @@ static void check_csync_detect_update(void **state)
|
|||
assert_int_equal(rc, 0);
|
||||
|
||||
/* the instruction should be set to new */
|
||||
st = c_rbtree_node_data(csync->local.tree->root);
|
||||
st = (csync_file_stat_t*)c_rbtree_node_data(csync->local.tree->root);
|
||||
assert_int_equal(st->instruction, CSYNC_INSTRUCTION_NEW);
|
||||
|
||||
/* create a statedb */
|
||||
|
@ -275,7 +275,7 @@ static void check_csync_detect_update(void **state)
|
|||
*/
|
||||
static void check_csync_detect_update_db_none(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
csync_file_stat_t *st;
|
||||
csync_vio_file_stat_t *fs;
|
||||
int rc;
|
||||
|
@ -290,7 +290,7 @@ static void check_csync_detect_update_db_none(void **state)
|
|||
assert_int_equal(rc, 0);
|
||||
|
||||
/* the instruction should be set to new */
|
||||
st = c_rbtree_node_data(csync->local.tree->root);
|
||||
st = (csync_file_stat_t*)c_rbtree_node_data(csync->local.tree->root);
|
||||
assert_int_equal(st->instruction, CSYNC_INSTRUCTION_NEW);
|
||||
|
||||
|
||||
|
@ -302,7 +302,7 @@ static void check_csync_detect_update_db_none(void **state)
|
|||
|
||||
static void check_csync_detect_update_db_eval(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
csync_file_stat_t *st;
|
||||
csync_vio_file_stat_t *fs;
|
||||
int rc;
|
||||
|
@ -317,7 +317,7 @@ static void check_csync_detect_update_db_eval(void **state)
|
|||
assert_int_equal(rc, 0);
|
||||
|
||||
/* the instruction should be set to new */
|
||||
st = c_rbtree_node_data(csync->local.tree->root);
|
||||
st = (csync_file_stat_t*)c_rbtree_node_data(csync->local.tree->root);
|
||||
assert_int_equal(st->instruction, CSYNC_INSTRUCTION_NEW);
|
||||
|
||||
/* create a statedb */
|
||||
|
@ -329,7 +329,7 @@ static void check_csync_detect_update_db_eval(void **state)
|
|||
|
||||
static void check_csync_detect_update_db_rename(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
// csync_file_stat_t *st;
|
||||
|
||||
csync_vio_file_stat_t *fs;
|
||||
|
@ -348,7 +348,7 @@ static void check_csync_detect_update_db_rename(void **state)
|
|||
/* the instruction should be set to rename */
|
||||
/*
|
||||
* temporarily broken.
|
||||
st = c_rbtree_node_data(csync->local.tree->root);
|
||||
st = (csync_file_stat_t*)c_rbtree_node_data(csync->local.tree->root);
|
||||
assert_int_equal(st->instruction, CSYNC_INSTRUCTION_RENAME);
|
||||
|
||||
st->instruction = CSYNC_INSTRUCTION_UPDATED;
|
||||
|
@ -361,7 +361,7 @@ static void check_csync_detect_update_db_rename(void **state)
|
|||
|
||||
static void check_csync_detect_update_db_new(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
csync_file_stat_t *st;
|
||||
csync_vio_file_stat_t *fs;
|
||||
int rc;
|
||||
|
@ -376,7 +376,7 @@ static void check_csync_detect_update_db_new(void **state)
|
|||
assert_int_equal(rc, 0);
|
||||
|
||||
/* the instruction should be set to new */
|
||||
st = c_rbtree_node_data(csync->local.tree->root);
|
||||
st = (csync_file_stat_t*)c_rbtree_node_data(csync->local.tree->root);
|
||||
assert_int_equal(st->instruction, CSYNC_INSTRUCTION_NEW);
|
||||
|
||||
|
||||
|
@ -388,7 +388,7 @@ static void check_csync_detect_update_db_new(void **state)
|
|||
|
||||
static void check_csync_detect_update_null(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
csync_vio_file_stat_t *fs;
|
||||
int rc;
|
||||
|
||||
|
@ -412,7 +412,7 @@ static void check_csync_detect_update_null(void **state)
|
|||
|
||||
static void check_csync_ftw(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
int rc;
|
||||
|
||||
rc = csync_ftw(csync, "/tmp", csync_walker, MAX_DEPTH);
|
||||
|
@ -421,7 +421,7 @@ static void check_csync_ftw(void **state)
|
|||
|
||||
static void check_csync_ftw_empty_uri(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
int rc;
|
||||
|
||||
rc = csync_ftw(csync, "", csync_walker, MAX_DEPTH);
|
||||
|
@ -430,7 +430,7 @@ static void check_csync_ftw_empty_uri(void **state)
|
|||
|
||||
static void check_csync_ftw_failing_fn(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
int rc;
|
||||
|
||||
rc = csync_ftw(csync, "/tmp", failing_fn, MAX_DEPTH);
|
||||
|
@ -454,4 +454,3 @@ int torture_run_tests(void)
|
|||
|
||||
return cmocka_run_group_tests(tests, NULL, NULL);
|
||||
}
|
||||
|
|
@ -30,7 +30,7 @@ static void check_csync_instruction_str(void **state)
|
|||
str = csync_instruction_str(CSYNC_INSTRUCTION_ERROR);
|
||||
assert_string_equal(str, "INSTRUCTION_ERROR");
|
||||
|
||||
str = csync_instruction_str(0xFFFF);
|
||||
str = csync_instruction_str((enum csync_instructions_e)0xFFFF);
|
||||
assert_string_equal(str, "ERROR!");
|
||||
}
|
||||
|
|
@ -27,16 +27,6 @@
|
|||
#endif
|
||||
|
||||
|
||||
static void setup(void **state)
|
||||
{
|
||||
(void) state; /* unused */
|
||||
}
|
||||
|
||||
static void teardown(void **state)
|
||||
{
|
||||
(void) state; /* unused */
|
||||
}
|
||||
|
||||
static void check_iconv_to_native_normalization(void **state)
|
||||
{
|
||||
mbchar_t *out = NULL;
|
||||
|
@ -191,15 +181,15 @@ static void check_long_win_path(void **state)
|
|||
|
||||
int torture_run_tests(void)
|
||||
{
|
||||
const UnitTest tests[] = {
|
||||
unit_test_setup_teardown(check_long_win_path, setup, teardown),
|
||||
unit_test_setup_teardown(check_to_multibyte, setup, teardown),
|
||||
unit_test_setup_teardown(check_iconv_ascii, setup, teardown),
|
||||
unit_test_setup_teardown(check_iconv_to_native_normalization, setup, teardown),
|
||||
unit_test_setup_teardown(check_iconv_from_native_normalization, setup, teardown),
|
||||
const struct CMUnitTest tests[] = {
|
||||
cmocka_unit_test(check_long_win_path),
|
||||
cmocka_unit_test(check_to_multibyte),
|
||||
cmocka_unit_test(check_iconv_ascii),
|
||||
cmocka_unit_test(check_iconv_to_native_normalization),
|
||||
cmocka_unit_test(check_iconv_from_native_normalization),
|
||||
|
||||
};
|
||||
|
||||
return run_tests(tests);
|
||||
return cmocka_run_group_tests(tests, NULL, NULL);
|
||||
}
|
||||
|
|
@ -77,13 +77,13 @@ static void check_c_strndup(void **state)
|
|||
|
||||
int torture_run_tests(void)
|
||||
{
|
||||
const UnitTest tests[] = {
|
||||
unit_test(check_c_malloc),
|
||||
unit_test(check_c_malloc_zero),
|
||||
unit_test(check_c_strdup),
|
||||
unit_test(check_c_strndup),
|
||||
const struct CMUnitTest tests[] = {
|
||||
cmocka_unit_test(check_c_malloc),
|
||||
cmocka_unit_test(check_c_malloc_zero),
|
||||
cmocka_unit_test(check_c_strdup),
|
||||
cmocka_unit_test(check_c_strndup),
|
||||
};
|
||||
|
||||
return run_tests(tests);
|
||||
return cmocka_run_group_tests(tests, NULL, NULL);
|
||||
}
|
||||
|
|
@ -278,15 +278,15 @@ static void check_c_jhash64_null_strings(void **state)
|
|||
|
||||
int torture_run_tests(void)
|
||||
{
|
||||
const UnitTest tests[] = {
|
||||
unit_test(check_c_jhash_trials),
|
||||
unit_test(check_c_jhash_alignment_problems),
|
||||
unit_test(check_c_jhash_null_strings),
|
||||
unit_test(check_c_jhash64_trials),
|
||||
unit_test(check_c_jhash64_alignment_problems),
|
||||
unit_test(check_c_jhash64_null_strings),
|
||||
const struct CMUnitTest tests[] = {
|
||||
cmocka_unit_test(check_c_jhash_trials),
|
||||
cmocka_unit_test(check_c_jhash_alignment_problems),
|
||||
cmocka_unit_test(check_c_jhash_null_strings),
|
||||
cmocka_unit_test(check_c_jhash64_trials),
|
||||
cmocka_unit_test(check_c_jhash64_alignment_problems),
|
||||
cmocka_unit_test(check_c_jhash64_null_strings),
|
||||
};
|
||||
|
||||
return run_tests(tests);
|
||||
return cmocka_run_group_tests(tests, NULL, NULL);
|
||||
}
|
||||
|
|
@ -172,14 +172,14 @@ static void check_c_parse_uri(void **state)
|
|||
|
||||
int torture_run_tests(void)
|
||||
{
|
||||
const UnitTest tests[] = {
|
||||
unit_test(check_c_basename),
|
||||
unit_test(check_c_basename_uri),
|
||||
unit_test(check_c_dirname),
|
||||
unit_test(check_c_dirname_uri),
|
||||
unit_test(check_c_parse_uri),
|
||||
const struct CMUnitTest tests[] = {
|
||||
cmocka_unit_test(check_c_basename),
|
||||
cmocka_unit_test(check_c_basename_uri),
|
||||
cmocka_unit_test(check_c_dirname),
|
||||
cmocka_unit_test(check_c_dirname_uri),
|
||||
cmocka_unit_test(check_c_parse_uri),
|
||||
};
|
||||
|
||||
return run_tests(tests);
|
||||
return cmocka_run_group_tests(tests, NULL, NULL);
|
||||
}
|
||||
|
|
@ -82,15 +82,16 @@ static void destructor(void *data) {
|
|||
SAFE_FREE(freedata);
|
||||
}
|
||||
|
||||
static void setup(void **state) {
|
||||
static int setup(void **state) {
|
||||
c_rbtree_t *tree = NULL;
|
||||
|
||||
c_rbtree_create(&tree, key_cmp, data_cmp);
|
||||
|
||||
*state = tree;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void setup_complete_tree(void **state) {
|
||||
static int setup_complete_tree(void **state) {
|
||||
c_rbtree_t *tree = NULL;
|
||||
int i = 0;
|
||||
int rc;
|
||||
|
@ -110,15 +111,17 @@ static void setup_complete_tree(void **state) {
|
|||
}
|
||||
|
||||
*state = tree;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void teardown(void **state) {
|
||||
static int teardown(void **state) {
|
||||
c_rbtree_t *tree = *state;
|
||||
|
||||
c_rbtree_destroy(tree, destructor);
|
||||
c_rbtree_free(tree);
|
||||
|
||||
*state = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void check_c_rbtree_create_free(void **state)
|
||||
|
@ -345,19 +348,19 @@ static void check_c_rbtree_x)
|
|||
|
||||
int torture_run_tests(void)
|
||||
{
|
||||
const UnitTest tests[] = {
|
||||
unit_test(check_c_rbtree_create_free),
|
||||
unit_test(check_c_rbtree_free_null),
|
||||
unit_test(check_c_rbtree_insert_delete),
|
||||
unit_test_setup_teardown(check_c_rbtree_insert_random, setup, teardown),
|
||||
unit_test_setup_teardown(check_c_rbtree_insert_duplicate, setup, teardown),
|
||||
unit_test_setup_teardown(check_c_rbtree_find, setup_complete_tree, teardown),
|
||||
unit_test_setup_teardown(check_c_rbtree_delete, setup_complete_tree, teardown),
|
||||
unit_test_setup_teardown(check_c_rbtree_walk, setup_complete_tree, teardown),
|
||||
unit_test_setup_teardown(check_c_rbtree_walk_null, setup_complete_tree, teardown),
|
||||
unit_test_setup_teardown(check_c_rbtree_dup, setup_complete_tree, teardown),
|
||||
const struct CMUnitTest tests[] = {
|
||||
cmocka_unit_test(check_c_rbtree_create_free),
|
||||
cmocka_unit_test(check_c_rbtree_free_null),
|
||||
cmocka_unit_test(check_c_rbtree_insert_delete),
|
||||
cmocka_unit_test_setup_teardown(check_c_rbtree_insert_random, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(check_c_rbtree_insert_duplicate, setup, teardown),
|
||||
cmocka_unit_test_setup_teardown(check_c_rbtree_find, setup_complete_tree, teardown),
|
||||
cmocka_unit_test_setup_teardown(check_c_rbtree_delete, setup_complete_tree, teardown),
|
||||
cmocka_unit_test_setup_teardown(check_c_rbtree_walk, setup_complete_tree, teardown),
|
||||
cmocka_unit_test_setup_teardown(check_c_rbtree_walk_null, setup_complete_tree, teardown),
|
||||
cmocka_unit_test_setup_teardown(check_c_rbtree_dup, setup_complete_tree, teardown),
|
||||
};
|
||||
|
||||
return run_tests(tests);
|
||||
return cmocka_run_group_tests(tests, NULL, NULL);
|
||||
}
|
||||
|
|
@ -117,15 +117,15 @@ static void check_c_strlist_expand(void **state)
|
|||
|
||||
int torture_run_tests(void)
|
||||
{
|
||||
const UnitTest tests[] = {
|
||||
unit_test(check_c_streq_equal),
|
||||
unit_test(check_c_streq_not_equal),
|
||||
unit_test(check_c_streq_null),
|
||||
unit_test(check_c_strlist_new),
|
||||
unit_test(check_c_strlist_add),
|
||||
unit_test(check_c_strlist_expand),
|
||||
const struct CMUnitTest tests[] = {
|
||||
cmocka_unit_test(check_c_streq_equal),
|
||||
cmocka_unit_test(check_c_streq_not_equal),
|
||||
cmocka_unit_test(check_c_streq_null),
|
||||
cmocka_unit_test(check_c_strlist_new),
|
||||
cmocka_unit_test(check_c_strlist_add),
|
||||
cmocka_unit_test(check_c_strlist_expand),
|
||||
};
|
||||
|
||||
return run_tests(tests);
|
||||
return cmocka_run_group_tests(tests, NULL, NULL);
|
||||
}
|
||||
|
|
@ -88,13 +88,13 @@ static void check_c_secdiff_three(void **state)
|
|||
|
||||
int torture_run_tests(void)
|
||||
{
|
||||
const UnitTest tests[] = {
|
||||
unit_test(check_c_tspecdiff),
|
||||
unit_test(check_c_tspecdiff_five),
|
||||
unit_test(check_c_secdiff),
|
||||
unit_test(check_c_secdiff_three),
|
||||
const struct CMUnitTest tests[] = {
|
||||
cmocka_unit_test(check_c_tspecdiff),
|
||||
cmocka_unit_test(check_c_tspecdiff_five),
|
||||
cmocka_unit_test(check_c_secdiff),
|
||||
cmocka_unit_test(check_c_secdiff_three),
|
||||
};
|
||||
|
||||
return run_tests(tests);
|
||||
return cmocka_run_group_tests(tests, NULL, NULL);
|
||||
}
|
||||
|
|
@ -20,6 +20,10 @@
|
|||
#ifndef _TORTURE_H
|
||||
#define _TORTURE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <setjmp.h>
|
||||
|
@ -41,4 +45,8 @@ int torture_csync_verbosity(void);
|
|||
*/
|
||||
int torture_run_tests(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _TORTURE_H */
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
static char wd_buffer[WD_BUFFER_SIZE];
|
||||
|
||||
static void setup(void **state)
|
||||
static int setup(void **state)
|
||||
{
|
||||
CSYNC *csync;
|
||||
int rc;
|
||||
|
@ -53,9 +53,10 @@ static void setup(void **state)
|
|||
csync->replica = LOCAL_REPLICA;
|
||||
|
||||
*state = csync;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void setup_dir(void **state) {
|
||||
static int setup_dir(void **state) {
|
||||
int rc;
|
||||
mbchar_t *dir = c_utf8_path_to_locale(CSYNC_TEST_DIR);
|
||||
|
||||
|
@ -69,10 +70,11 @@ static void setup_dir(void **state) {
|
|||
|
||||
rc = chdir(CSYNC_TEST_DIR);
|
||||
assert_int_equal(rc, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void teardown(void **state) {
|
||||
CSYNC *csync = *state;
|
||||
static int teardown(void **state) {
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
int rc;
|
||||
|
||||
rc = csync_destroy(csync);
|
||||
|
@ -85,6 +87,7 @@ static void teardown(void **state) {
|
|||
assert_int_equal(rc, 0);
|
||||
|
||||
*state = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -94,7 +97,7 @@ static void teardown(void **state) {
|
|||
|
||||
static void check_csync_vio_opendir(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
csync_vio_handle_t *dh;
|
||||
int rc;
|
||||
|
||||
|
@ -107,7 +110,7 @@ static void check_csync_vio_opendir(void **state)
|
|||
|
||||
static void check_csync_vio_opendir_perm(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
csync_vio_handle_t *dh;
|
||||
int rc;
|
||||
mbchar_t *dir = c_utf8_path_to_locale(CSYNC_TEST_DIR);
|
||||
|
@ -127,7 +130,7 @@ static void check_csync_vio_opendir_perm(void **state)
|
|||
|
||||
static void check_csync_vio_closedir_null(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
int rc;
|
||||
|
||||
rc = csync_vio_closedir(csync, NULL);
|
||||
|
@ -136,7 +139,7 @@ static void check_csync_vio_closedir_null(void **state)
|
|||
|
||||
static void check_csync_vio_readdir(void **state)
|
||||
{
|
||||
CSYNC *csync = *state;
|
||||
CSYNC *csync = (CSYNC*)*state;
|
||||
csync_vio_handle_t *dh;
|
||||
csync_vio_file_stat_t *dirent;
|
||||
int rc;
|
||||
|
@ -155,13 +158,12 @@ static void check_csync_vio_readdir(void **state)
|
|||
|
||||
int torture_run_tests(void)
|
||||
{
|
||||
const UnitTest tests[] = {
|
||||
unit_test_setup_teardown(check_csync_vio_opendir, setup_dir, teardown),
|
||||
unit_test_setup_teardown(check_csync_vio_opendir_perm, setup, teardown),
|
||||
unit_test(check_csync_vio_closedir_null),
|
||||
unit_test_setup_teardown(check_csync_vio_readdir, setup_dir, teardown),
|
||||
const struct CMUnitTest tests[] = {
|
||||
cmocka_unit_test_setup_teardown(check_csync_vio_opendir, setup_dir, teardown),
|
||||
cmocka_unit_test_setup_teardown(check_csync_vio_opendir_perm, setup, teardown),
|
||||
cmocka_unit_test(check_csync_vio_closedir_null),
|
||||
cmocka_unit_test_setup_teardown(check_csync_vio_readdir, setup_dir, teardown),
|
||||
};
|
||||
|
||||
return run_tests(tests);
|
||||
return cmocka_run_group_tests(tests, NULL, NULL);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue