aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/cmdline.c11
-rw-r--r--tests/torture.c7
-rw-r--r--tests/torture.h7
-rw-r--r--tests/unittests/torture_auth.c2
4 files changed, 26 insertions, 1 deletions
diff --git a/tests/cmdline.c b/tests/cmdline.c
index 0f3b7fc3..ea1c90b4 100644
--- a/tests/cmdline.c
+++ b/tests/cmdline.c
@@ -20,6 +20,14 @@ static struct argp_option options[] = {
.doc = "Don't fork the testcases",
.group = 0
},
+ {
+ .name = "verbose",
+ .key = 'v',
+ .arg = NULL,
+ .flags = 0,
+ .doc = "Make libssh test more verbose",
+ .group = 0
+ },
{NULL, 0, NULL, 0, NULL, 0}
};
@@ -37,6 +45,9 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state) {
case 'n':
arguments->nofork = 1;
break;
+ case 'v':
+ arguments->verbose++;
+ break;
case ARGP_KEY_ARG:
/* End processing here. */
cmdline = &state->argv [state->next - 1];
diff --git a/tests/torture.c b/tests/torture.c
index 6b7484e9..ec39eca3 100644
--- a/tests/torture.c
+++ b/tests/torture.c
@@ -24,6 +24,11 @@ void torture_create_case_timeout(Suite *s, const char *name, TFun function, int
tcase_add_test(tc_new, function);
}
+static int verbosity=0;
+int torture_libssh_verbosity(void){
+ return verbosity;
+}
+
int main(int argc, char **argv) {
Suite *s = NULL;
SRunner *sr = NULL;
@@ -33,7 +38,7 @@ int main(int argc, char **argv) {
memset(&arguments,0,sizeof(struct argument_s));
torture_cmdline_parse(argc, argv, &arguments);
-
+ verbosity=arguments.verbose;
s = torture_make_suite();
sr = srunner_create(s);
diff --git a/tests/torture.h b/tests/torture.h
index 2be45644..42762b9e 100644
--- a/tests/torture.h
+++ b/tests/torture.h
@@ -13,6 +13,7 @@
struct argument_s {
char *args[2];
int nofork;
+ int verbose;
};
void torture_cmdline_parse(int argc, char **argv, struct argument_s *arguments);
@@ -32,6 +33,12 @@ void torture_create_case_timeout(Suite *s, const char *name, TFun function,
int timeout);
/*
+ * returns the verbosity level asked by user
+ */
+int torture_libssh_verbosity(void);
+
+
+/*
* This function must be defined in every unit test file.
*/
Suite *torture_make_suite(void);
diff --git a/tests/unittests/torture_auth.c b/tests/unittests/torture_auth.c
index 09d382ef..95f648ba 100644
--- a/tests/unittests/torture_auth.c
+++ b/tests/unittests/torture_auth.c
@@ -28,8 +28,10 @@
ssh_session session;
static void setup(void) {
+ int verbosity=torture_libssh_verbosity();
session = ssh_new();
ssh_options_set(session,SSH_OPTIONS_HOST,"localhost");
+ ssh_options_set(session,SSH_OPTIONS_LOG_VERBOSITY,&verbosity);
}
static void teardown(void) {