forked from libssh2/libssh2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This introduces a test suite for libssh2. It runs OpenSSH in a Docker container because that works well on Windows (via docker-machine) as well as Linux. Presumably it works on Mac too with docker-machine, but I've not tested that. Because the test suite is docker-machine aware, you can also run it against a cloud provider, for more realistic network testing, by setting your cloud provider as your active docker machine. The Appveyor CI setup in this commit does that because Appveyor doesn't support docker locally.
- Loading branch information
Showing
30 changed files
with
1,337 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright (c) 2014, 2015 Alexander Lamaison <[email protected]> | ||
# Copyright (c) 2014-2016 Alexander Lamaison <[email protected]> | ||
# | ||
# Redistribution and use in source and binary forms, | ||
# with or without modification, are permitted provided | ||
|
@@ -47,29 +47,53 @@ check_include_files(sys/socket.h HAVE_SYS_SOCKET_H) | |
check_include_files(arpa/inet.h HAVE_ARPA_INET_H) | ||
check_include_files(windows.h HAVE_WINDOWS_H) | ||
check_include_files(winsock2.h HAVE_WINSOCK2_H) | ||
|
||
configure_file( | ||
${CMAKE_CURRENT_SOURCE_DIR}/libssh2_config_cmake.h.in | ||
${CMAKE_CURRENT_BINARY_DIR}/libssh2_config.h) | ||
"${CMAKE_CURRENT_SOURCE_DIR}/libssh2_config_cmake.h.in" | ||
"${CMAKE_CURRENT_BINARY_DIR}/libssh2_config.h") | ||
append_needed_socket_libraries(LIBRARIES) | ||
|
||
set(TESTS | ||
simple | ||
ssh2) | ||
hostkey | ||
hostkey_hash | ||
password_auth_succeeds_with_correct_credentials | ||
password_auth_fails_with_wrong_password | ||
password_auth_fails_with_wrong_username | ||
public_key_auth_fails_with_wrong_key | ||
public_key_auth_succeeds_with_correct_rsa_key | ||
public_key_auth_succeeds_with_correct_dsa_key | ||
keyboard_interactive_auth_fails_with_wrong_response | ||
keyboard_interactive_auth_succeeds_with_correct_response | ||
) | ||
|
||
append_needed_socket_libraries(LIBRARIES) | ||
add_library(openssh_fixture STATIC openssh_fixture.h openssh_fixture.c) | ||
target_link_libraries(openssh_fixture ${LIBRARIES}) | ||
target_include_directories(openssh_fixture PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") | ||
|
||
add_library(session_fixture STATIC session_fixture.h session_fixture.c) | ||
target_link_libraries(session_fixture ${LIBRARIES} openssh_fixture libssh2) | ||
target_include_directories(session_fixture PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") | ||
|
||
add_library(runner STATIC runner.c) | ||
target_link_libraries(runner session_fixture) | ||
target_include_directories(runner PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") | ||
|
||
foreach(test ${TESTS}) | ||
add_executable(test-${test} ${test}.c) | ||
target_link_libraries(test-${test} libssh2 ${LIBRARIES}) | ||
target_include_directories(test-${test} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) | ||
list(APPEND TEST_TARGETS test-${test}) | ||
add_executable(test_${test} test_${test}.c) | ||
target_link_libraries(test_${test} libssh2 runner ${LIBRARIES}) | ||
target_include_directories(test_${test} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") | ||
list(APPEND TEST_TARGETS test_${test}) | ||
|
||
add_test( | ||
NAME test_${test} COMMAND $<TARGET_FILE:test_${test}> | ||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") | ||
endforeach() | ||
|
||
add_target_to_copy_dependencies( | ||
TARGET copy_test_dependencies | ||
DEPENDENCIES ${RUNTIME_DEPENDENCIES} | ||
BEFORE_TARGETS ${TEST_TARGETS}) | ||
|
||
|
||
# TODO convert mansyntax.sh into CMake script. | ||
# XXX Just because we can find all three programs, doesn't mean sh can | ||
# find man and grep | ||
|
@@ -82,30 +106,3 @@ if(SH_EXECUTABLE AND MAN_EXECUTABLE AND GREP_EXECUTABLE) | |
set(cmd "${cmd} ${CMAKE_CURRENT_SOURCE_DIR}/mansyntax.sh") | ||
add_test(mansyntax ${SH_EXECUTABLE} -c "${cmd}") | ||
endif() | ||
|
||
add_test(simple test-simple) | ||
|
||
find_program(SSHD_EXECUTABLE sshd) | ||
find_program(CHMOD_EXECUTABLE chmod) | ||
find_program(KILL_EXECUTABLE kill) | ||
mark_as_advanced(SSHD_EXECUTABLE CHMOD_EXECUTABLE KILL_EXECUTABLE) | ||
if(SSHD_EXECUTABLE AND CHMOD_EXECUTABLE AND KILL_EXECUTABLE) | ||
set(SSHD_TEST_CONFIG_DIR ${CMAKE_CURRENT_BINARY_DIR}) | ||
set(TEST_NAME ssh2) | ||
|
||
add_custom_command( | ||
TARGET test-${TEST_NAME} | ||
COMMAND ${CMAKE_COMMAND} -E copy_directory | ||
${CMAKE_CURRENT_SOURCE_DIR}/etc | ||
${SSHD_TEST_CONFIG_DIR}/etc) | ||
|
||
configure_file( | ||
${CMAKE_CURRENT_SOURCE_DIR}/sshd_fixture.sh.in | ||
${CMAKE_CURRENT_BINARY_DIR}/test-${TEST_NAME}_fixture.sh | ||
@ONLY) | ||
|
||
add_test(NAME ssh2 COMMAND ${SH_EXECUTABLE} | ||
${CMAKE_CURRENT_BINARY_DIR}/test-${TEST_NAME}_fixture.sh | ||
$<TARGET_FILE:test-${TEST_NAME}>) | ||
|
||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
-----BEGIN DSA PRIVATE KEY----- | ||
MIIBvAIBAAKBgQCtiYdgpPvFtfi7Ba44DiB+1x8kojjT0nRvn2hU2aa4p4fXI8kd | ||
6Hc57VQO/lLhR9eFpxjP7m+jGwF468Q6NU8xiC71ucep0OoXS7u8RcoIoWfLDtZi | ||
DDlahnZTW04mB5fFxo2y7dYl31vE4TPdSxhqpkvnIBIstMFh2M7Dl0w8/QIVAP95 | ||
u6dg1OW6gGsRgiircsy1A9tzAoGBAIzwc5FCnJnzAJm9Hjv0AFV5l/i/DQulZ9pu | ||
EILkNiHCfDR+lTJ8VxAR7J3pgjmvYzeeRvi519ez1YriktDt66kIknQOcHB8ghyg | ||
U+dff79SkDcpg8LnX5xb3cVMgABujA0sSpaW1wwm64RXdvmoQvWu6ympUT0l0dEd | ||
oYVkb4ytAoGAJ+CGwV/1S4j1GVwa6pSP0nj4V86GWXosTTBg7GT+rKWu8lrxIcr6 | ||
FzLWgFi/gHoMrgnKWGxO1yF7vkoYM5Yfo84oBYiH+MgpiBuOrZrgzacHsA66JJbU | ||
frESRFWZl2blIPr6Gyjj6cVGgMabK3yCiTRi0v7hwffpm0rKyKv7GooCFQCyaA6T | ||
tkJunHP+F0Xg/WAUV6tcqA== | ||
-----END DSA PRIVATE KEY----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ssh-dss AAAAB3NzaC1kc3MAAACBAK2Jh2Ck+8W1+LsFrjgOIH7XHySiONPSdG+faFTZprinh9cjyR3odzntVA7+UuFH14WnGM/ub6MbAXjrxDo1TzGILvW5x6nQ6hdLu7xFygihZ8sO1mIMOVqGdlNbTiYHl8XGjbLt1iXfW8ThM91LGGqmS+cgEiy0wWHYzsOXTDz9AAAAFQD/ebunYNTluoBrEYIoq3LMtQPbcwAAAIEAjPBzkUKcmfMAmb0eO/QAVXmX+L8NC6Vn2m4QguQ2IcJ8NH6VMnxXEBHsnemCOa9jN55G+LnX17PViuKS0O3rqQiSdA5wcHyCHKBT519/v1KQNymDwudfnFvdxUyAAG6MDSxKlpbXDCbrhFd2+ahC9a7rKalRPSXR0R2hhWRvjK0AAACAJ+CGwV/1S4j1GVwa6pSP0nj4V86GWXosTTBg7GT+rKWu8lrxIcr6FzLWgFi/gHoMrgnKWGxO1yF7vkoYM5Yfo84oBYiH+MgpiBuOrZrgzacHsA66JJbUfrESRFWZl2blIPr6Gyjj6cVGgMabK3yCiTRi0v7hwffpm0rKyKv7Goo= awl03@bounty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
-----BEGIN DSA PRIVATE KEY----- | ||
MIIBuwIBAAKBgQCE1v/lL1VvjlJMyG7q0wAgl2tqVMzy5h1RVOtDS8bTlXLJg7ks | ||
T63wTmXlp2HedgKkfHCu7AKsjPyg1CTrvRBa8BFEvMoUDARonMwql34aiKVMy/t0 | ||
/ehnmCQV+ZMFpsVFnphJpZuXLTW1F3pnEbSNud5sACjbWb51uly5AUynuwIVAOhj | ||
rbNOaAtC1oYki8CVwpkQ8rHhAoGAYSepXRF3GJSjseYgJ2bCgcJS0L9agcvKAf+F | ||
dc+ZDJOchhnZC/hGHsjAfg62KowwKuOYsbcR3S4LJxiERcmRabww+kUIL1E8bLaQ | ||
RbOygNsHU8LyBdSx3WqC2WEOpVkTAjYDWTkbN+qkb53IBoI0GwFt5P9GHvQcAGkj | ||
GJQAWWYCgYAt7vxpDC5Xs6GxbaUupfIP95ZTMx2LqqFjqfT/81nypIHVyIlCnWMi | ||
a0mWGe4qXmHSyk6ZYnsk7Ll6WxdwUrFhd75qERyXlRK2x/v/Q3h9IOwChpHdSFx/ | ||
Tq1Zl9vMx3tmS1H0YF9tUdN7g8S5XTUSvYA+0Lzxs/9zOU5fa55+pAIVAKV45RLf | ||
hg2GNXvO68Q4tt3F6kSP | ||
-----END DSA PRIVATE KEY----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ssh-dss AAAAB3NzaC1kc3MAAACBAITW/+UvVW+OUkzIburTACCXa2pUzPLmHVFU60NLxtOVcsmDuSxPrfBOZeWnYd52AqR8cK7sAqyM/KDUJOu9EFrwEUS8yhQMBGiczCqXfhqIpUzL+3T96GeYJBX5kwWmxUWemEmlm5ctNbUXemcRtI253mwAKNtZvnW6XLkBTKe7AAAAFQDoY62zTmgLQtaGJIvAlcKZEPKx4QAAAIBhJ6ldEXcYlKOx5iAnZsKBwlLQv1qBy8oB/4V1z5kMk5yGGdkL+EYeyMB+DrYqjDAq45ixtxHdLgsnGIRFyZFpvDD6RQgvUTxstpBFs7KA2wdTwvIF1LHdaoLZYQ6lWRMCNgNZORs36qRvncgGgjQbAW3k/0Ye9BwAaSMYlABZZgAAAIAt7vxpDC5Xs6GxbaUupfIP95ZTMx2LqqFjqfT/81nypIHVyIlCnWMia0mWGe4qXmHSyk6ZYnsk7Ll6WxdwUrFhd75qERyXlRK2x/v/Q3h9IOwChpHdSFx/Tq1Zl9vMx3tmS1H0YF9tUdN7g8S5XTUSvYA+0Lzxs/9zOU5fa55+pA== awl03@bounty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
-----BEGIN RSA PRIVATE KE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yPqgz+tcweX+gK3nXnP5JZfYF1kArXk80/eYhNE9 | ||
PwnJNXDQMoxaM0/X6BVgQyt03/Q12lH9u0j5AoGAR9U7fp6Su/uoDO/rnhs/HJHy | ||
P9u5WULSsuyKe4uBF8JTjp+cbOXeuIJ0vkCI8WPQ2iZsg37gPI5Hd9rtGDJLPATm | ||
OsOuxslowG9MY0J6K/aMb6EFfbiXHckIL3/gS02hO6SkPgSwgZY0odVaGX+VThtk | ||
q18ppDNZr/vLXL+CmZsCgYEAlJxIlG80tZxaXw5dKIN1nPL2/JUUIZz1vFShQ7Nk | ||
P4EglP+9B52lqr5mc9kwHAe1vhpobns6kvP393IlawbKrsz6ZQg/8/PkLw5XQIli | ||
YPeH1pyKsTyKtvcn9DO5BcE1zaGLB9ApULEpOcUuTwPBLvcDfjRREuUhywT44Coi | ||
w0MCgYAX5yc7/Z3R6M30rGsrgb1Y2siHYsi2LCygUj7TDGQYpaZN4afPJOT5H/Nr | ||
7x7dgZkbOR6PQFm00VgML0XxKih59t0dcQ+2qk1LX5JDKRF/1kER3np6dpceteDu | ||
cC+MEHB/KvijnviAtBZGvD0O7oZgvbkKHESu2igXpAnfXPZFvw== | ||
-----END RSA PRIVATE KEY----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAnak1T7zHJ+hVRFBDQ9pf1KVzmd5gaNc7y7NPmL13aOG3sYeJevi1x1WM/R3tb8XnUnzZUX9GJN0MYovvZsw9bknG1mDP72LFbGp/gzPddGIKHBBpvceDaJ85sM/ME3XOtD7uuXQuNAuEHwEzSMMiSIEMcQS+lXIcMLr5xPLEkyNvqsO5RqSjMTLHKHgY8gLWx7oQ1avokhwuDxF7P3Pqtj+rW2Te6vR0i1H6EyFPsBkzkgNXb33cus8M1CnTmYTSgJgmHO2LLcGpjQ5sL8T/PWIWHaSqTnkrFXEMysgoteXnAYILjzyBaqq2WV4KA3TluGdAP2p8gC32QtKmIuis3Q== awl03@bounty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.