2010-03-02 13:47:14 +01:00
|
|
|
project(unittests C)
|
|
|
|
|
2015-05-05 19:04:49 +02:00
|
|
|
include_directories(${OPENSSL_INCLUDE_DIR})
|
|
|
|
|
2018-09-21 13:10:54 +02:00
|
|
|
set(LIBSSH_UNIT_TESTS
|
|
|
|
torture_buffer
|
2018-09-29 14:06:00 +02:00
|
|
|
torture_bytearray
|
2018-09-21 13:10:54 +02: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 15:26:49 +02:00
|
|
|
torture_packet_filter
|
2018-10-24 20:01:04 +02:00
|
|
|
torture_temp_dir
|
2018-11-19 13:10:48 +01:00
|
|
|
torture_temp_file
|
2018-11-20 14:01:57 +01:00
|
|
|
torture_push_pop_dir
|
2018-10-02 11:21:39 -04:00
|
|
|
torture_session_keys
|
2019-05-15 17:48:41 +02:00
|
|
|
torture_tokens
|
2018-09-21 13:10:54 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
set(LIBSSH_THREAD_UNIT_TESTS
|
|
|
|
torture_rand
|
|
|
|
torture_threads_init
|
|
|
|
torture_threads_buffer
|
|
|
|
torture_threads_crypto
|
|
|
|
)
|
2018-07-04 18:35:58 +02:00
|
|
|
|
2010-12-29 20:33:32 +01:00
|
|
|
if (UNIX AND NOT WIN32)
|
2018-09-21 13:10:54 +02: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 21:49:49 +01:00
|
|
|
|
2019-03-01 13:15:35 +01:00
|
|
|
if (WITH_SERVER)
|
2016-06-02 11:52:19 +02:00
|
|
|
set(LIBSSH_UNIT_TESTS
|
|
|
|
${LIBSSH_UNIT_TESTS}
|
2019-03-01 13:15:35 +01:00
|
|
|
torture_bind_config)
|
|
|
|
|
|
|
|
if (WITH_GEX)
|
|
|
|
set(LIBSSH_UNIT_TESTS
|
|
|
|
${LIBSSH_UNIT_TESTS}
|
|
|
|
torture_moduli)
|
|
|
|
endif()
|
2016-06-02 11:52:19 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2018-01-08 21:49:49 +01:00
|
|
|
if (HAVE_DSA)
|
2018-09-21 13:10:54 +02:00
|
|
|
set(LIBSSH_UNIT_TESTS
|
|
|
|
${LIBSSH_UNIT_TESTS}
|
|
|
|
torture_pki_dsa
|
|
|
|
)
|
2018-01-08 21:49:49 +01:00
|
|
|
endif()
|
2018-09-21 13:10:54 +02:00
|
|
|
|
2018-01-08 22:36:53 +01:00
|
|
|
if (HAVE_ECC)
|
2018-09-21 13:10:54 +02:00
|
|
|
set(LIBSSH_UNIT_TESTS
|
|
|
|
${LIBSSH_UNIT_TESTS}
|
|
|
|
torture_pki_ecdsa
|
|
|
|
)
|
2018-01-08 22:36:53 +01:00
|
|
|
endif()
|
|
|
|
|
2018-09-21 13:10:54 +02: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 20:33:32 +01:00
|
|
|
endif (UNIX AND NOT WIN32)
|
2018-09-21 13:10:54 +02: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 ()
|
|
|
|
|