2 Unix SMB/CIFS implementation.
3 SMB torture UI functions
5 Copyright (C) Jelmer Vernooij 2006
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 2 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, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include "torture/ui.h"
25 struct torture_test *torture_test(struct torture_context *ctx, const char *name, const char *description)
27 struct torture_test *test = talloc(ctx, struct torture_test);
29 test->name = talloc_strdup(test, name);
30 test->description = talloc_strdup(test, description);
33 ctx->ui_ops->test_start(test);
38 struct torture_test *torture_subtest(struct torture_test *parent, const char *name, const char *description)
40 struct torture_test *test = talloc(parent, struct torture_test);
42 test->name = talloc_strdup(test, name);
43 test->description = talloc_strdup(test, description);
44 test->context = parent->context;
46 test->context->ui_ops->test_start(test);
51 void torture_comment(struct torture_test *test, const char *comment, ...) _PRINTF_ATTRIBUTE(2,3)
55 va_start(ap, comment);
56 tmp = talloc_vasprintf(test, comment, ap);
58 test->context->ui_ops->comment(test, tmp);
63 void torture_ok(struct torture_test *test)
65 test->context->ui_ops->test_result(test, TORTURE_OK);
68 void torture_fail(struct torture_test *test)
70 test->context->ui_ops->test_result(test, TORTURE_FAIL);
73 void torture_skip(struct torture_test *test)
75 test->context->ui_ops->test_result(test, TORTURE_SKIP);