diff options
author | Gregor Beck <gbeck@sernet.de> | 2011-10-18 13:15:22 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2012-09-21 16:26:39 +0200 |
commit | 160ca49953570fe55fe089241d1ba6ed1c9c9783 (patch) | |
tree | b30da87268a32a98691f755e663a79f60f24bf8a /source4/torture | |
parent | c3f1aed86f7f414ecdf676d52011c396e65aa374 (diff) | |
download | samba-160ca49953570fe55fe089241d1ba6ed1c9c9783.tar.gz samba-160ca49953570fe55fe089241d1ba6ed1c9c9783.tar.bz2 samba-160ca49953570fe55fe089241d1ba6ed1c9c9783.zip |
libtorture: factor out simple ui backend
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/smbtorture.c | 65 |
1 files changed, 1 insertions, 64 deletions
diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c index 04ba94d3e0..95f0719605 100644 --- a/source4/torture/smbtorture.c +++ b/source4/torture/smbtorture.c @@ -350,69 +350,6 @@ _NORETURN_ static void max_runtime_handler(int sig) exit(1); } -struct timeval last_suite_started; - -static void simple_suite_start(struct torture_context *ctx, - struct torture_suite *suite) -{ - last_suite_started = timeval_current(); - printf("Running %s\n", suite->name); -} - -static void simple_suite_finish(struct torture_context *ctx, - struct torture_suite *suite) -{ - - printf("%s took %g secs\n\n", suite->name, - timeval_elapsed(&last_suite_started)); -} - -static void simple_test_result(struct torture_context *context, - enum torture_result res, const char *reason) -{ - switch (res) { - case TORTURE_OK: - if (reason) - printf("OK: %s\n", reason); - break; - case TORTURE_FAIL: - printf("TEST %s FAILED! - %s\n", context->active_test->name, reason); - break; - case TORTURE_ERROR: - printf("ERROR IN TEST %s! - %s\n", context->active_test->name, reason); - break; - case TORTURE_SKIP: - printf("SKIP: %s - %s\n", context->active_test->name, reason); - break; - } -} - -static void simple_comment(struct torture_context *test, - const char *comment) -{ - printf("%s", comment); -} - -static void simple_warning(struct torture_context *test, - const char *comment) -{ - fprintf(stderr, "WARNING: %s\n", comment); -} - -static void simple_progress(struct torture_context *test, - int offset, enum torture_progress_whence whence) -{ -} - -const static struct torture_ui_ops std_ui_ops = { - .comment = simple_comment, - .warning = simple_warning, - .suite_start = simple_suite_start, - .suite_finish = simple_suite_finish, - .test_result = simple_test_result, - .progress = simple_progress, -}; - /**************************************************************************** main program ****************************************************************************/ @@ -653,7 +590,7 @@ int main(int argc,char *argv[]) srandom(torture_seed); if (!strcmp(ui_ops_name, "simple")) { - ui_ops = &std_ui_ops; + ui_ops = &torture_simple_ui_ops; } else if (!strcmp(ui_ops_name, "subunit")) { ui_ops = &torture_subunit_ui_ops; } else { |