From 3191c1f6bec7f94c787d11e53e52dbfa8b0bdbe1 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Tue, 4 Sep 2018 15:29:01 +0200 Subject: [PATCH] tests: Use global verbosity in tests This allows adjusting the log level of config and options tests using environment variable LIBSSH_VERBOSITY as it works in most of the other tests. Signed-off-by: Jakub Jelen Reviewed-by: Andreas Schneider (cherry picked from commit 6dbcc21921fe9bf50833a1e38c01332c7f246372) --- tests/unittests/torture_config.c | 5 +++++ tests/unittests/torture_options.c | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/unittests/torture_config.c b/tests/unittests/torture_config.c index 7eb510b0..b1fdb51e 100644 --- a/tests/unittests/torture_config.c +++ b/tests/unittests/torture_config.c @@ -33,6 +33,7 @@ extern LIBSSH_THREAD int ssh_log_level; static int setup_config_files(void **state) { ssh_session session; + int verbosity; unlink(LIBSSH_TESTCONFIG1); unlink(LIBSSH_TESTCONFIG2); @@ -106,6 +107,10 @@ static int setup_config_files(void **state) ""); session = ssh_new(); + + verbosity = torture_libssh_verbosity(); + ssh_options_set(session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity); + *state = session; return 0; diff --git a/tests/unittests/torture_options.c b/tests/unittests/torture_options.c index be844810..06a12e81 100644 --- a/tests/unittests/torture_options.c +++ b/tests/unittests/torture_options.c @@ -15,7 +15,14 @@ static int setup(void **state) { - ssh_session session = ssh_new(); + ssh_session session; + int verbosity; + + session = ssh_new(); + + verbosity = torture_libssh_verbosity(); + ssh_options_set(session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity); + *state = session; return 0;