diff options
author | Aris Adamantiadis <aris@0xbadc0de.be> | 2010-05-09 00:54:37 +0200 |
---|---|---|
committer | Aris Adamantiadis <aris@0xbadc0de.be> | 2010-05-09 00:54:37 +0200 |
commit | 3a326793fd0c3c1fd3cecd46d57d367ee50db941 (patch) | |
tree | b801d4d58ab023b9411a42477265175a33ced983 /tests | |
parent | f31a14b7932ef4cc165ddd8f1f1a5b23eb21beb3 (diff) | |
download | libssh-3a326793fd0c3c1fd3cecd46d57d367ee50db941.tar.gz libssh-3a326793fd0c3c1fd3cecd46d57d367ee50db941.tar.xz libssh-3a326793fd0c3c1fd3cecd46d57d367ee50db941.zip |
Test case for proxycommand
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unittests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/unittests/torture_proxycommand.c | 61 |
2 files changed, 62 insertions, 0 deletions
diff --git a/tests/unittests/CMakeLists.txt b/tests/unittests/CMakeLists.txt index 6b6f22f7..cd25abe8 100644 --- a/tests/unittests/CMakeLists.txt +++ b/tests/unittests/CMakeLists.txt @@ -7,3 +7,4 @@ add_check_test(torture_misc torture_misc.c ${TORTURE_LIBRARY}) add_check_test(torture_keyfiles torture_keyfiles.c ${TORTURE_LIBRARY}) add_check_test(torture_options torture_options.c ${TORTURE_LIBRARY}) add_check_test(torture_knownhosts torture_knownhosts.c ${TORTURE_LIBRARY}) +add_check_test(torture_proxycommand torture_proxycommand.c ${TORTURE_LIBRARY}) diff --git a/tests/unittests/torture_proxycommand.c b/tests/unittests/torture_proxycommand.c new file mode 100644 index 00000000..d289019b --- /dev/null +++ b/tests/unittests/torture_proxycommand.c @@ -0,0 +1,61 @@ +#define LIBSSH_STATIC + +#include "torture.h" +#include <libssh/libssh.h> +#include "libssh/priv.h" +ssh_session session; + +static void setup(void) { + session = ssh_new(); +} + +static void teardown(void) { + ssh_free(session); +} + +START_TEST (torture_options_set_proxycommand) +{ + int rc; + + rc = ssh_options_set(session, SSH_OPTIONS_HOST, "localhost"); + ck_assert(rc == 0); + + rc = ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, "nc localhost 22"); + ck_assert(rc == 0); + rc = ssh_connect(session); + ck_assert_msg(rc== SSH_OK,ssh_get_error(session)); +} +END_TEST + +static Suite *torture_make_suite(void) { + Suite *s = suite_create("libssh_keyfiles"); + + torture_create_case_fixture(s, "torture_options_set_proxycommand", + torture_options_set_proxycommand, setup, teardown); + + return s; +} + +int main(int argc, char **argv) { + Suite *s = NULL; + SRunner *sr = NULL; + struct argument_s arguments; + int nf; + + ZERO_STRUCT(arguments); + + torture_cmdline_parse(argc, argv, &arguments); + + s = torture_make_suite(); + + sr = srunner_create(s); + if (arguments.nofork) { + srunner_set_fork_status(sr, CK_NOFORK); + } + srunner_run_all(sr, CK_VERBOSE); + nf = srunner_ntests_failed(sr); + srunner_free(sr); + + return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE; +} + |