1 | /*
|
---|
2 | Unix SMB/CIFS implementation.
|
---|
3 | SMB torture tester
|
---|
4 | Copyright (C) Andrew Tridgell 1997-2003
|
---|
5 | Copyright (C) Jelmer Vernooij 2006-2008
|
---|
6 |
|
---|
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.
|
---|
11 |
|
---|
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.
|
---|
16 |
|
---|
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/>.
|
---|
19 | */
|
---|
20 |
|
---|
21 | #include "includes.h"
|
---|
22 | #include "lib/torture/torture.h"
|
---|
23 |
|
---|
24 | static struct timeval last_suite_started;
|
---|
25 |
|
---|
26 | static void simple_suite_start(struct torture_context *ctx,
|
---|
27 | struct torture_suite *suite)
|
---|
28 | {
|
---|
29 | last_suite_started = timeval_current();
|
---|
30 | printf("Running %s\n", suite->name);
|
---|
31 | }
|
---|
32 |
|
---|
33 | static void simple_suite_finish(struct torture_context *ctx,
|
---|
34 | struct torture_suite *suite)
|
---|
35 | {
|
---|
36 |
|
---|
37 | printf("%s took %g secs\n\n", suite->name,
|
---|
38 | timeval_elapsed(&last_suite_started));
|
---|
39 | }
|
---|
40 |
|
---|
41 | static void simple_test_result(struct torture_context *context,
|
---|
42 | enum torture_result res, const char *reason)
|
---|
43 | {
|
---|
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;
|
---|
58 | }
|
---|
59 | }
|
---|
60 |
|
---|
61 | static void simple_comment(struct torture_context *test,
|
---|
62 | const char *comment)
|
---|
63 | {
|
---|
64 | printf("%s", comment);
|
---|
65 | }
|
---|
66 |
|
---|
67 | static void simple_warning(struct torture_context *test,
|
---|
68 | const char *comment)
|
---|
69 | {
|
---|
70 | fprintf(stderr, "WARNING: %s\n", comment);
|
---|
71 | }
|
---|
72 |
|
---|
73 | static void simple_progress(struct torture_context *test,
|
---|
74 | int offset, enum torture_progress_whence whence)
|
---|
75 | {
|
---|
76 | }
|
---|
77 |
|
---|
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,
|
---|
85 | };
|
---|