mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 23:28:14 +03:00
Make ownCloud cmocka test build on the win32 platform.
This commit is contained in:
parent
b74fc47e3f
commit
5f93c490a5
4 changed files with 21 additions and 10 deletions
|
@ -65,8 +65,10 @@ add_subdirectory(config)
|
|||
add_subdirectory(doc)
|
||||
|
||||
find_package(Check)
|
||||
if (CHECK_FOUND AND UNIT_TESTING)
|
||||
if (CHECK_FOUND)
|
||||
include(MacroAddCheckTest)
|
||||
endif (CHECK_FOUND)
|
||||
if (UNIT_TESTING)
|
||||
add_subdirectory(tests)
|
||||
endif (CHECK_FOUND AND UNIT_TESTING)
|
||||
endif(UNIT_TESTING)
|
||||
|
||||
|
|
|
@ -5,10 +5,11 @@ set(SUPPORT_LIBRARY support)
|
|||
include_directories(
|
||||
${CSYNC_PUBLIC_INCLUDE_DIRS}
|
||||
${CSTDLIB_PUBLIC_INCLUDE_DIRS}
|
||||
${CHECK_INCLUDE_DIRS}
|
||||
${CMAKE_BINARY_DIR}
|
||||
)
|
||||
|
||||
if (CHECK_FOUND)
|
||||
include_directories(${CHECK_INCLUDE_DIRS})
|
||||
# create test library
|
||||
add_library(${SUPPORT_LIBRARY} STATIC support.c cmdline.c)
|
||||
target_link_libraries(${SUPPORT_LIBRARY} ${CHECK_LIBRARIES} ${CSYNC_LIBRARY} ${CSTDLIB_LIBRARY})
|
||||
|
@ -51,6 +52,7 @@ macro_add_check_test(check_vio vio_tests/check_vio.c ${TEST_TARGET_LIBRARIES})
|
|||
|
||||
# sync
|
||||
macro_add_check_test(check_csync_update csync_tests/check_csync_update.c ${TEST_TARGET_LIBRARIES})
|
||||
endif (CHECK_FOUND)
|
||||
|
||||
add_subdirectory(ownCloud)
|
||||
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
project( ocmod C )
|
||||
|
||||
add_definitions(-DUNIT_TESTING=1)
|
||||
|
||||
find_package(CMocka REQUIRED)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMOCKA_INCLUDE_DIRS}
|
||||
${NEON_INCLUDE_DIRS}
|
||||
)
|
||||
find_package(CMocka REQUIRED)
|
||||
|
||||
add_definitions(-DUNIT_TESTING=1)
|
||||
|
||||
add_executable(ocmod_test ocmod_test.c)
|
||||
target_link_libraries(ocmod_test ${CMOCKA_LIBRARIES} ${NEON_LIBRARIES} ${CSYNC_LIBRARY} )
|
||||
target_link_libraries(ocmod_test ${CMOCKA_LIBRARIES} ${NEON_LIBRARIES} ${CSYNC_LIBRARY} )
|
||||
|
||||
|
|
|
@ -42,6 +42,10 @@ static bool load_oc_config( const char *config ) {
|
|||
dictionary *dict;
|
||||
const char* val;
|
||||
bool re = true;
|
||||
char *deflt;
|
||||
char b;
|
||||
deflt = &b;
|
||||
|
||||
|
||||
dict = iniparser_load( config );
|
||||
|
||||
|
@ -50,21 +54,21 @@ static bool load_oc_config( const char *config ) {
|
|||
return false;
|
||||
}
|
||||
|
||||
val = iniparser_getstr(dict, "global:host");
|
||||
val = iniparser_getstring(dict, "global:host", deflt);
|
||||
if( val ) {
|
||||
_credentials.url = c_strdup( val );
|
||||
} else {
|
||||
re = false;
|
||||
}
|
||||
|
||||
val = iniparser_getstr(dict, "global:user");
|
||||
val = iniparser_getstring(dict, "global:user", deflt);
|
||||
if( re && val ) {
|
||||
_credentials.user = c_strdup( val );
|
||||
} else {
|
||||
re = false;
|
||||
}
|
||||
|
||||
val = iniparser_getstr(dict, "global:pwd");
|
||||
val = iniparser_getstring(dict, "global:pwd", deflt);
|
||||
if( re && val ) {
|
||||
_credentials.pwd = c_strdup( val );
|
||||
} else {
|
||||
|
@ -111,6 +115,7 @@ static void fetch_a_context(void **state) {
|
|||
struct listdir_context *fetchCtx = NULL;
|
||||
char *curi = _cleanPath(_credentials.oc_server);
|
||||
int rc = 0;
|
||||
unsigned int i;
|
||||
|
||||
(void) state;
|
||||
|
||||
|
@ -123,7 +128,7 @@ static void fetch_a_context(void **state) {
|
|||
printf("Results: %d\n", fetchCtx->result_count);
|
||||
|
||||
fetchCtx->currResource = fetchCtx->list;
|
||||
for( uint i = 0; i < fetchCtx->result_count; i++ ) {
|
||||
for( i = 0; i < fetchCtx->result_count; i++ ) {
|
||||
assert_true( fetchCtx->currResource != NULL );
|
||||
assert_true( fetchCtx->currResource->uri != NULL );
|
||||
assert_true( fetchCtx->currResource->name != NULL );
|
||||
|
|
Loading…
Reference in a new issue