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.
33 void (*comment) (struct torture_test *, const char *);
34 void (*test_start) (struct torture_test *);
35 void (*test_result) (struct torture_test *, enum torture_result,
46 struct torture_context *context;
49 struct torture_context
51 const struct torture_ui_ops *ui_ops;
60 #define torture_assert(ctx,expr,string) \
62 torture_fail(ctx, "%s:%d (%s): %s", __FILE__, __LINE__, string, \
67 #define torture_assert_werr_equal(ctx,got,expected,string) \
68 if (!W_ERROR_EQUAL(got, expected)) { \
69 torture_fail(ctx, "%s:%d (%s): got %s, expected %s", __FILE__, \
70 __LINE__, string, win_errstr(got), win_errstr(expected)); \
74 #define torture_assert_ntstatus_equal(ctx,got,expected,string) \
75 if (!NT_STATUS_EQUAL(got, expected)) { \
76 torture_fail(ctx, "%s:%d (%s): got %s, expected %s", __FILE__, \
77 __LINE__, string, nt_errstr(got), nt_errstr(expected)); \
81 /* Convenience macros */
83 #define torture_assert_ntstatus_ok(ctx,expr,string) \
84 torture_assert_ntstatus_equal(ctx,expr,NT_STATUS_OK,string)
86 #define torture_assert_werr_ok(ctx,expr,string) \
87 torture_assert_werr_equal(ctx,expr,WERR_OK,string)
89 struct torture_test *torture_test(struct torture_context *ctx, const char *name, const char *description);
90 struct torture_test *torture_subtest(struct torture_test *parent, const char *name, const char *description);
91 void torture_comment(struct torture_test *test, const char *comment, ...) _PRINTF_ATTRIBUTE(2,3);
92 void torture_ok(struct torture_test *test);
93 void torture_fail(struct torture_test *test, const char *reason, ...) _PRINTF_ATTRIBUTE(2,3);;
94 void torture_skip(struct torture_test *test, const char *reason, ...) _PRINTF_ATTRIBUTE(2,3);