2010-03-02 15:47:14 +03:00
|
|
|
project(tests C)
|
|
|
|
|
2014-02-02 23:56:21 +04:00
|
|
|
if (BSD OR SOLARIS OR OSX)
|
2011-08-09 21:52:26 +04:00
|
|
|
find_package(Argp)
|
2014-02-02 23:56:21 +04:00
|
|
|
endif (BSD OR SOLARIS OR OSX)
|
2011-01-13 20:34:04 +03:00
|
|
|
|
2010-03-02 15:47:14 +03:00
|
|
|
set(TORTURE_LIBRARY torture)
|
|
|
|
|
|
|
|
include_directories(
|
|
|
|
${LIBSSH_PUBLIC_INCLUDE_DIRS}
|
2012-10-07 13:10:27 +04:00
|
|
|
${CMOCKA_INCLUDE_DIR}
|
2010-12-29 22:17:36 +03:00
|
|
|
${OPENSSL_INCLUDE_DIRS}
|
|
|
|
${GCRYPT_INCLUDE_DIRS}
|
|
|
|
${ZLIB_INCLUDE_DIRS}
|
|
|
|
${CMAKE_BINARY_DIR}
|
2010-09-29 13:26:16 +04:00
|
|
|
${CMAKE_SOURCE_DIR}/src
|
2010-03-02 15:47:14 +03:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
)
|
|
|
|
|
|
|
|
# create test library
|
2011-01-13 20:34:04 +03:00
|
|
|
add_library(${TORTURE_LIBRARY} STATIC cmdline.c torture.c)
|
2010-09-06 16:54:16 +04:00
|
|
|
target_link_libraries(${TORTURE_LIBRARY}
|
2012-10-07 13:10:27 +04:00
|
|
|
${CMOCKA_LIBRARY}
|
2010-09-06 16:54:16 +04:00
|
|
|
${LIBSSH_STATIC_LIBRARY}
|
|
|
|
${LIBSSH_LINK_LIBRARIES}
|
2010-09-08 18:32:54 +04:00
|
|
|
${LIBSSH_THREADS_STATIC_LIBRARY}
|
|
|
|
${LIBSSH_THREADS_LINK_LIBRARIES}
|
2014-02-02 23:56:21 +04:00
|
|
|
${ARGP_LIBRARIES}
|
2010-09-06 16:54:16 +04:00
|
|
|
)
|
2010-03-02 15:47:14 +03:00
|
|
|
|
2010-12-29 22:17:36 +03:00
|
|
|
set(TEST_TARGET_LIBRARIES
|
|
|
|
${TORTURE_LIBRARY}
|
2012-10-07 13:10:27 +04:00
|
|
|
${CMOCKA_LIBRARY}
|
2010-12-29 22:17:36 +03:00
|
|
|
${LIBSSH_STATIC_LIBRARY}
|
|
|
|
${LIBSSH_LINK_LIBRARIES}
|
|
|
|
${LIBSSH_THREADS_STATIC_LIBRARY}
|
|
|
|
${LIBSSH_THREADS_LINK_LIBRARIES}
|
|
|
|
)
|
2010-03-02 15:47:14 +03:00
|
|
|
|
|
|
|
add_subdirectory(unittests)
|
tests: introduce pkd_hello
Introduce a sample public-key testing daemon to the 'pkd' test directory,
and add support code for cycling through various combinations of different
key exchange, cipher, and MAC algorithms.
The goal of the 'pkd_hello' test is to make it easy to test interactions
between non-libssh clients and a libssh-server, and to provide a starting
point for testing new implementations for key types, ciphers, MACs, and
so on. The thinking is that testing a new algorithm should be as simple
as adding a new line for it in the PKDTESTS_* lists.
Macros are used to generate the tests and helper functions for a couple of
clients -- here, OpenSSH and dropbear are included for the first cut. If
binaries are found for these clients, their test lists will be enabled;
when binaries are not found for a given client, those tests are skipped.
Tests are run in one large batch by default, but can also be run individually
to help with tracking down things like signature bugs that may take many
iterations to reproduce.
Each test logs its stdout and stderr to its own file, which is cleaned up
when a test succeeds. For failures, those logs can be combined with verbose
libssh output from pkd itself to start debugging things.
Some example usages:
pkd_hello
Run all tests with default number of iterations.
pkd_hello --list
List available individual test names.
pkd_hello -i 1000 -t torture_pkd_openssh_ecdsa_256_ecdh_sha2_nistp256
Run only the torture_pkd_openssh_ecdsa_256_ecdh_sha2_nistp256
testcase 1000 times.
pkd_hello -v -v -v -v -e -o
Run all tests with maximum libssh and pkd logging.
Included in the tests are passes for all existing kex, cipher, and MAC
algorithms.
BUG: https://red.libssh.org/issues/144
Signed-off-by: Jon Simons <jon@jonsimons.org>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2014-10-10 23:38:45 +04:00
|
|
|
|
2010-06-03 14:36:00 +04:00
|
|
|
if (WITH_CLIENT_TESTING)
|
|
|
|
add_subdirectory(client)
|
|
|
|
endif (WITH_CLIENT_TESTING)
|
2010-12-28 15:17:27 +03:00
|
|
|
|
|
|
|
if (WITH_BENCHMARKS)
|
|
|
|
add_subdirectory(benchmarks)
|
2010-12-29 22:11:00 +03:00
|
|
|
endif (WITH_BENCHMARKS)
|
2010-12-28 15:17:27 +03:00
|
|
|
|
2014-10-13 14:06:39 +04:00
|
|
|
if (WITH_SERVER)
|
|
|
|
add_subdirectory(pkd)
|
|
|
|
endif (WITH_SERVER)
|