Added verbosity flag for unit tests
Этот коммит содержится в:
родитель
7c0ce909ed
Коммит
4fbe572c02
@ -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];
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
@ -31,6 +32,12 @@ void torture_create_case_fixture(Suite *s, const char *name, TFun function,
|
||||
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.
|
||||
*/
|
||||
|
@ -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) {
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user