regedit: Print help on left side of screen instead of the right.
[Samba.git] / lib / torture / simple.c
blobd234776bda7383b75e363c53870c7a148ce1fdcb
1 /*
2 Unix SMB/CIFS implementation.
3 SMB torture tester
4 Copyright (C) Andrew Tridgell 1997-2003
5 Copyright (C) Jelmer Vernooij 2006-2008
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "includes.h"
22 #include "lib/torture/torture.h"
24 static struct timeval last_suite_started;
26 static void simple_suite_start(struct torture_context *ctx,
27 struct torture_suite *suite)
29 last_suite_started = timeval_current();
30 printf("Running %s\n", suite->name);
33 static void simple_suite_finish(struct torture_context *ctx,
34 struct torture_suite *suite)
37 printf("%s took %g secs\n\n", suite->name,
38 timeval_elapsed(&last_suite_started));
41 static void simple_test_result(struct torture_context *context,
42 enum torture_result res, const char *reason)
44 switch (res) {
45 case TORTURE_OK:
46 if (reason)
47 printf("OK: %s\n", reason);
48 break;
49 case TORTURE_FAIL:
50 printf("TEST %s FAILED! - %s\n", context->active_test->name, reason);
51 break;
52 case TORTURE_ERROR:
53 printf("ERROR IN TEST %s! - %s\n", context->active_test->name, reason);
54 break;
55 case TORTURE_SKIP:
56 printf("SKIP: %s - %s\n", context->active_test->name, reason);
57 break;
61 static void simple_comment(struct torture_context *test,
62 const char *comment)
64 printf("%s", comment);
67 static void simple_warning(struct torture_context *test,
68 const char *comment)
70 fprintf(stderr, "WARNING: %s\n", comment);
73 static void simple_progress(struct torture_context *test,
74 int offset, enum torture_progress_whence whence)
78 const struct torture_ui_ops torture_simple_ui_ops = {
79 .comment = simple_comment,
80 .warning = simple_warning,
81 .suite_start = simple_suite_start,
82 .suite_finish = simple_suite_finish,
83 .test_result = simple_test_result,
84 .progress = simple_progress,