2010-03-02 15:47:14 +03:00
|
|
|
project(unittests C)
|
|
|
|
|
2015-05-05 20:04:49 +03:00
|
|
|
include_directories(${OPENSSL_INCLUDE_DIR})
|
|
|
|
|
2018-09-21 14:10:54 +03:00
|
|
|
set(LIBSSH_UNIT_TESTS
|
|
|
|
torture_buffer
|
2018-09-29 15:06:00 +03:00
|
|
|
torture_bytearray
|
2018-09-21 14:10:54 +03:00
|
|
|
torture_callbacks
|
|
|
|
torture_crypto
|
|
|
|
torture_init
|
|
|
|
torture_list
|
|
|
|
torture_misc
|
|
|
|
torture_config
|
|
|
|
torture_options
|
|
|
|
torture_isipaddr
|
|
|
|
torture_knownhosts_parsing
|
|
|
|
torture_hashes
|
2018-09-07 16:26:49 +03:00
|
|
|
torture_packet_filter
|
2018-10-24 21:01:04 +03:00
|
|
|
torture_temp_dir
|
2018-09-21 14:10:54 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
set(LIBSSH_THREAD_UNIT_TESTS
|
|
|
|
torture_rand
|
|
|
|
torture_threads_init
|
|
|
|
torture_threads_buffer
|
|
|
|
torture_threads_crypto
|
|
|
|
)
|
2018-07-04 19:35:58 +03:00
|
|
|
|
2010-12-29 22:33:32 +03:00
|
|
|
if (UNIX AND NOT WIN32)
|
2018-09-21 14:10:54 +03:00
|
|
|
set(LIBSSH_UNIT_TESTS
|
|
|
|
${LIBSSH_UNIT_TESTS}
|
|
|
|
# this uses a socketpair
|
|
|
|
torture_packet
|
|
|
|
# requires ssh-keygen
|
|
|
|
torture_keyfiles
|
|
|
|
torture_pki
|
|
|
|
torture_pki_rsa
|
|
|
|
torture_pki_ed25519
|
|
|
|
# requires /dev/null
|
|
|
|
torture_channel
|
|
|
|
)
|
2018-01-08 23:49:49 +03:00
|
|
|
|
|
|
|
if (HAVE_DSA)
|
2018-09-21 14:10:54 +03:00
|
|
|
set(LIBSSH_UNIT_TESTS
|
|
|
|
${LIBSSH_UNIT_TESTS}
|
|
|
|
torture_pki_dsa
|
|
|
|
)
|
2018-01-08 23:49:49 +03:00
|
|
|
endif()
|
2018-09-21 14:10:54 +03:00
|
|
|
|
2018-01-09 00:36:53 +03:00
|
|
|
if (HAVE_ECC)
|
2018-09-21 14:10:54 +03:00
|
|
|
set(LIBSSH_UNIT_TESTS
|
|
|
|
${LIBSSH_UNIT_TESTS}
|
|
|
|
torture_pki_ecdsa
|
|
|
|
)
|
2018-01-09 00:36:53 +03:00
|
|
|
endif()
|
|
|
|
|
2018-09-21 14:10:54 +03:00
|
|
|
set(LIBSSH_THREAD_UNIT_TESTS
|
|
|
|
${LIBSSH_THREAD_UNIT_TESTS}
|
|
|
|
# requires pthread
|
|
|
|
torture_threads_pki_rsa
|
|
|
|
)
|
|
|
|
# Not working correctly
|
|
|
|
#if (WITH_SERVER)
|
|
|
|
# add_cmocka_test(torture_server_x11 torture_server_x11.c ${TEST_TARGET_LIBRARIES})
|
|
|
|
#endif (WITH_SERVER)
|
2010-12-29 22:33:32 +03:00
|
|
|
endif (UNIX AND NOT WIN32)
|
2018-09-21 14:10:54 +03:00
|
|
|
|
|
|
|
foreach(_UNIT_TEST ${LIBSSH_UNIT_TESTS})
|
|
|
|
add_cmocka_test(${_UNIT_TEST}
|
|
|
|
SOURCES ${_UNIT_TEST}.c
|
|
|
|
COMPILE_OPTIONS ${DEFAULT_C_COMPILE_FLAGS}
|
|
|
|
LINK_LIBRARIES ${TEST_TARGET_LIBRARIES}
|
|
|
|
)
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
if (CMAKE_USE_PTHREADS_INIT)
|
|
|
|
foreach(_UNIT_TEST ${LIBSSH_THREAD_UNIT_TESTS})
|
|
|
|
add_cmocka_test(${_UNIT_TEST}
|
|
|
|
SOURCES ${_UNIT_TEST}.c
|
|
|
|
COMPILE_OPTIONS ${DEFAULT_C_COMPILE_FLAGS}
|
|
|
|
LINK_LIBRARIES ${TEST_TARGET_LIBRARIES} Threads::Threads
|
|
|
|
)
|
|
|
|
endforeach()
|
|
|
|
endif ()
|
|
|
|
|