Rev 11312: Add torture_warning() command. in
file:///home/jelmer/bzr.samba/4.0-perlselftest/
Jelmer Vernooij
jelmer at samba.org
Tue Feb 6 23:11:52 GMT 2007
At file:///home/jelmer/bzr.samba/4.0-perlselftest/
------------------------------------------------------------
revno: 11312
revision-id: jelmer at samba.org-20070206231134-gzk6h6exhv3q920e
parent: jelmer at samba.org-20070204125956-xbmdp49ddnnfk8ta
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 4.0-perlselftest
timestamp: Wed 2007-02-07 00:11:34 +0100
message:
Add torture_warning() command.
modified:
source/torture/smbtorture.c svn-v2:14520 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2ftorture%2fsmbtorture.c
source/torture/ui.c svn-v2:14718 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2ftorture%2fui.c
source/torture/ui.h svn-v2:14718 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2ftorture%2fui.h
=== modified file 'source/torture/smbtorture.c'
--- a/source/torture/smbtorture.c 2007-02-03 19:08:19 +0000
+++ b/source/torture/smbtorture.c 2007-02-06 23:11:34 +0000
@@ -316,8 +316,15 @@
printf("%s", comment);
}
+static void simple_warning(struct torture_context *test,
+ const char *comment)
+{
+ fprintf(stderr, "WARNING: %s\n", comment);
+}
+
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
=== modified file 'source/torture/ui.c'
--- a/source/torture/ui.c 2007-01-30 12:10:42 +0000
+++ b/source/torture/ui.c 2007-02-06 23:11:34 +0000
@@ -40,6 +40,22 @@
talloc_free(tmp);
}
+void torture_warning(struct torture_context *context, const char *comment, ...)
+{
+ va_list ap;
+ char *tmp;
+
+ if (!context->ui_ops->warning)
+ return;
+
+ va_start(ap, comment);
+ tmp = talloc_vasprintf(context, comment, ap);
+
+ context->ui_ops->warning(context, tmp);
+
+ talloc_free(tmp);
+}
+
void torture_result(struct torture_context *context,
enum torture_result result, const char *fmt, ...)
{
=== modified file 'source/torture/ui.h'
--- a/source/torture/ui.h 2007-02-03 19:08:19 +0000
+++ b/source/torture/ui.h 2007-02-06 23:11:34 +0000
@@ -42,6 +42,7 @@
{
void (*init) (struct torture_context *);
void (*comment) (struct torture_context *, const char *);
+ void (*warning) (struct torture_context *, const char *);
void (*suite_start) (struct torture_context *, struct torture_suite *);
void (*suite_finish) (struct torture_context *, struct torture_suite *);
void (*tcase_start) (struct torture_context *, struct torture_tcase *);
@@ -189,6 +190,7 @@
struct torture_test *test);
void torture_comment(struct torture_context *test, const char *comment, ...) PRINTF_ATTRIBUTE(2,3);
+void torture_warning(struct torture_context *test, const char *comment, ...) PRINTF_ATTRIBUTE(2,3);
void torture_result(struct torture_context *test,
enum torture_result, const char *reason, ...) PRINTF_ATTRIBUTE(3,4);
More information about the samba-cvs
mailing list