Skip to content

Commit

Permalink
cmake BUGFIX move compiling ssh/tls client tests
Browse files Browse the repository at this point in the history
  • Loading branch information
roman committed Oct 26, 2023
1 parent d6e008b commit 883d49d
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,25 @@ endif()

# list of all the tests that don't require SSH and TLS
set(tests test_unix_socket test_client_thread test_fd_comm test_init_destroy_client test_init_destroy_server
test_io test_thread_messages test_client_messages test_client_ssh test_client_tls)
test_io test_thread_messages test_client_messages)

# only enable PAM tests if the version of PAM is greater than 1.4
if(LIBPAM_HAVE_CONFDIR)
list(APPEND tests test_auth)
endif()

#append tests depending on SSH/TLS
if(ENABLE_SSH_TLS)
list(APPEND tests test_two_channels test_ks_ts test_ec
test_ed25519 test_replace test_endpt_share_clients test_tls test_crl test_ch
test_runtime_changes test_client_ssh test_client_tls)
endif()

foreach(src IN LISTS libsrc)
list(APPEND test_srcs "../${src}")
endforeach()
add_library(testobj OBJECT ${test_srcs} ${compatsrc})

# add -Wl,--wrap flags
set(test test_client_ssh)
set(${test}_mock_funcs connect ssh_connect ssh_userauth_none ssh_userauth_kbdint ssh_is_connected
Expand All @@ -34,18 +46,6 @@ foreach(mock_func IN LISTS ${test}_mock_funcs)
set(${test}_wrap_link_flags "${${test}_wrap_link_flags},--wrap=${mock_func}")
endforeach()

#append tests depending on SSH/TLS
if(ENABLE_SSH_TLS)
list(APPEND tests test_two_channels test_ks_ts test_ec
test_ed25519 test_replace test_endpt_share_clients test_tls test_crl test_ch
test_runtime_changes)
endif()

foreach(src IN LISTS libsrc)
list(APPEND test_srcs "../${src}")
endforeach()
add_library(testobj OBJECT ${test_srcs} ${compatsrc})

foreach(test_name IN LISTS tests)
add_executable(${test_name} $<TARGET_OBJECTS:testobj> ${test_name}.c)
target_link_libraries(${test_name} ${CMOCKA_LIBRARIES} ${LIBYANG_LIBRARIES} netconf2)
Expand Down

0 comments on commit 883d49d

Please sign in to comment.