aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2019-06-19 14:28:07 +0200
committerJakub Jelen <jjelen@redhat.com>2019-06-19 18:01:30 +0200
commitbd69ac63ca455b08ffc5093be34b2dd232f3187a (patch)
tree5c107df41e788b0bffc01881cd420ad63fa26b15 /tests
parent6c49c41c19157cbafb8f4b90276b83550da98da9 (diff)
downloadlibssh-bd69ac63ca455b08ffc5093be34b2dd232f3187a.tar.gz
libssh-bd69ac63ca455b08ffc5093be34b2dd232f3187a.tar.xz
libssh-bd69ac63ca455b08ffc5093be34b2dd232f3187a.zip
tests: Reproducer for proxy command with stderr output (T130)
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/client/torture_proxycommand.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/client/torture_proxycommand.c b/tests/client/torture_proxycommand.c
index 4ea988d7..f6149c27 100644
--- a/tests/client/torture_proxycommand.c
+++ b/tests/client/torture_proxycommand.c
@@ -115,6 +115,28 @@ static void torture_options_set_proxycommand_ssh(void **state)
assert_int_equal(rc & O_RDWR, O_RDWR);
}
+static void torture_options_set_proxycommand_ssh_stderr(void **state)
+{
+ struct torture_state *s = *state;
+ ssh_session session = s->ssh.session;
+ const char *address = torture_server_address(AF_INET);
+ char command[255] = {0};
+ int rc;
+ socket_t fd;
+
+ rc = snprintf(command, sizeof(command), "ssh -vvv -W [%%h]:%%p alice@%s", address);
+ assert_true((size_t)rc < sizeof(command));
+
+ rc = ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, command);
+ assert_int_equal(rc, 0);
+ rc = ssh_connect(session);
+ assert_ssh_return_code(session, rc);
+ fd = ssh_get_fd(session);
+ assert_true(fd != SSH_INVALID_SOCKET);
+ rc = fcntl(fd, F_GETFL);
+ assert_int_equal(rc & O_RDWR, O_RDWR);
+}
+
int torture_run_tests(void) {
int rc;
struct CMUnitTest tests[] = {
@@ -127,6 +149,9 @@ int torture_run_tests(void) {
cmocka_unit_test_setup_teardown(torture_options_set_proxycommand_ssh,
session_setup,
session_teardown),
+ cmocka_unit_test_setup_teardown(torture_options_set_proxycommand_ssh_stderr,
+ session_setup,
+ session_teardown),
};