At file:///home/jelmer/bzr.samba/4.0-perlselftest/

------------------------------------------------------------
revno: 11312
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: Jelmer Vernooij <[EMAIL PROTECTED]>
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:[EMAIL PROTECTED]
  source/torture/ui.c            svn-v2:[EMAIL PROTECTED]
  source/torture/ui.h            svn-v2:[EMAIL PROTECTED]
=== 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);
 

Reply via email to