From 2a9c396603e286500791da1dc7f385487a0381a7 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Sat, 8 Oct 2016 13:38:18 +0200 Subject: [PATCH] torture: Add support to specify verbosity level via env variable Signed-off-by: Andreas Schneider --- tests/torture.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/torture.c b/tests/torture.c index e1de509c..545fc2e3 100644 --- a/tests/torture.c +++ b/tests/torture.c @@ -886,7 +886,7 @@ static void torture_setup_create_sshd_config(void **state) "TrustedUserCAKeys %s\n" "\n" "LogLevel DEBUG3\n" - "Subsystem sftp %s\n" + "Subsystem sftp %s -l DEBUG2\n" "\n" "PasswordAuthentication yes\n" "KbdInteractiveAuthentication yes\n" @@ -1083,6 +1083,7 @@ void _torture_filter_tests(struct CMUnitTest *tests, size_t ntests) int main(int argc, char **argv) { struct argument_s arguments; + char *env = getenv("LIBSSH_VERBOSITY"); arguments.verbose=0; arguments.pattern=NULL; @@ -1090,6 +1091,12 @@ int main(int argc, char **argv) { verbosity=arguments.verbose; pattern=arguments.pattern; + if (verbosity == 0 && env != NULL && env[0] != '\0') { + if (env[0] > '0' && env[0] < '9') { + verbosity = atoi(env); + } + } + return torture_run_tests(); }