From 11a1ae59f4954b4109cbf0d54b058157d8402886 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 3 Jun 2010 16:55:45 +0200 Subject: tests: Moved proxycommand test to client tests. --- tests/client/CMakeLists.txt | 1 + tests/client/torture_proxycommand.c | 54 ++++++++++++++++++++++++++++++++++ tests/unittests/CMakeLists.txt | 1 - tests/unittests/torture_proxycommand.c | 54 ---------------------------------- 4 files changed, 55 insertions(+), 55 deletions(-) create mode 100644 tests/client/torture_proxycommand.c delete mode 100644 tests/unittests/torture_proxycommand.c diff --git a/tests/client/CMakeLists.txt b/tests/client/CMakeLists.txt index b92f08e6..11633863 100644 --- a/tests/client/CMakeLists.txt +++ b/tests/client/CMakeLists.txt @@ -2,3 +2,4 @@ project(clienttests C) add_check_test(torture_algorithms torture_algorithms.c ${TORTURE_LIBRARY}) add_check_test(torture_auth torture_auth.c ${TORTURE_LIBRARY}) +add_check_test(torture_proxycommand torture_proxycommand.c ${TORTURE_LIBRARY}) diff --git a/tests/client/torture_proxycommand.c b/tests/client/torture_proxycommand.c new file mode 100644 index 00000000..3ee30a74 --- /dev/null +++ b/tests/client/torture_proxycommand.c @@ -0,0 +1,54 @@ +#define LIBSSH_STATIC + +#include "torture.h" +#include +#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 + +START_TEST (torture_options_set_proxycommand_notexist) +{ + int rc; + + rc = ssh_options_set(session, SSH_OPTIONS_HOST, "localhost"); + ck_assert(rc == 0); + + rc = ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, "this_command_does_not_exist"); + ck_assert(rc == SSH_OK); + rc = ssh_connect(session); + ck_assert_msg(rc== SSH_ERROR); +} +END_TEST + +Suite *torture_make_suite(void) { + Suite *s = suite_create("libssh_proxycommand"); + + torture_create_case_fixture(s, "torture_options_set_proxycommand", + torture_options_set_proxycommand, setup, teardown); + torture_create_case_fixture(s, "torture_options_set_proxycommand_notexist", + torture_options_set_proxycommand_notexist, setup, teardown); + + + return s; +} diff --git a/tests/unittests/CMakeLists.txt b/tests/unittests/CMakeLists.txt index 8eb7d296..c7f2238f 100644 --- a/tests/unittests/CMakeLists.txt +++ b/tests/unittests/CMakeLists.txt @@ -6,4 +6,3 @@ 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 deleted file mode 100644 index 3ee30a74..00000000 --- a/tests/unittests/torture_proxycommand.c +++ /dev/null @@ -1,54 +0,0 @@ -#define LIBSSH_STATIC - -#include "torture.h" -#include -#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 - -START_TEST (torture_options_set_proxycommand_notexist) -{ - int rc; - - rc = ssh_options_set(session, SSH_OPTIONS_HOST, "localhost"); - ck_assert(rc == 0); - - rc = ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, "this_command_does_not_exist"); - ck_assert(rc == SSH_OK); - rc = ssh_connect(session); - ck_assert_msg(rc== SSH_ERROR); -} -END_TEST - -Suite *torture_make_suite(void) { - Suite *s = suite_create("libssh_proxycommand"); - - torture_create_case_fixture(s, "torture_options_set_proxycommand", - torture_options_set_proxycommand, setup, teardown); - torture_create_case_fixture(s, "torture_options_set_proxycommand_notexist", - torture_options_set_proxycommand_notexist, setup, teardown); - - - return s; -} -- cgit