]> xenbits.xensource.com Git - people/royger/xen-test-framework.git/commitdiff
Alter xtf_success() to take a string to print
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 22 Feb 2016 18:04:28 +0000 (18:04 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 22 Feb 2016 18:06:24 +0000 (18:06 +0000)
... to be consistent with the rest of the reporting interface.  Every
reporting function is modified to accept NULL if there is nothing interesting
to print.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
common/report.c
include/xtf/report.h
tests/example/main.c
tests/selftest/main.c
tests/swint-emulation/main.c

index 1aaf6e620508121de88d689de6b92d3f3db173cb..685542c6b1861add5fa54f70ecedcb442a1b37cc 100644 (file)
@@ -35,53 +35,74 @@ static void set_status(enum test_status s)
         status = s;
 }
 
-void xtf_success(void)
+void xtf_success(const char *fmt, ...)
 {
     set_status(STATUS_SUCCESS);
+
+    if ( fmt )
+    {
+        va_list args;
+
+        va_start(args, fmt);
+        vprintk(fmt, args);
+        va_end(args);
+    }
 }
 
 void xtf_warning(const char *fmt, ...)
 {
-    va_list args;
-
     warnings = true;
 
-    va_start(args, fmt);
-    vprintk(fmt, args);
-    va_end(args);
+    if ( fmt )
+    {
+        va_list args;
+
+        va_start(args, fmt);
+        vprintk(fmt, args);
+        va_end(args);
+    }
 }
 
 void xtf_skip(const char *fmt, ...)
 {
-    va_list args;
-
     set_status(STATUS_SKIP);
 
-    va_start(args, fmt);
-    vprintk(fmt, args);
-    va_end(args);
+    if ( fmt )
+    {
+        va_list args;
+
+        va_start(args, fmt);
+        vprintk(fmt, args);
+        va_end(args);
+    }
 }
 
 void xtf_error(const char *fmt, ...)
 {
-    va_list args;
-
     set_status(STATUS_ERROR);
 
-    va_start(args, fmt);
-    vprintk(fmt, args);
-    va_end(args);
+    if ( fmt )
+    {
+        va_list args;
+
+        va_start(args, fmt);
+        vprintk(fmt, args);
+        va_end(args);
+    }
 }
 
 void xtf_failure(const char *fmt, ...)
 {
-    va_list args;
-
     set_status(STATUS_FAILURE);
 
-    va_start(args, fmt);
-    vprintk(fmt, args);
-    va_end(args);
+    if ( fmt )
+    {
+        va_list args;
+
+        va_start(args, fmt);
+        vprintk(fmt, args);
+        va_end(args);
+    }
 }
 
 void xtf_report_status(void)
index 14e63963e972ab732e4d0881a383385fcc5214fb..6ec5047b7b24f897141c01d00dc114b302e9af00 100644 (file)
@@ -26,7 +26,7 @@
 /**
  * Report test success.
  */
-void xtf_success(void);
+void xtf_success(const char *fmt, ...) __printf(1, 2);
 
 /**
  * Report a test warning.
index 7cbe5c5d009d2074d9d6bea437854533ae8b9bf1..1a34726cbbe3eefce13e387285bb1c1e36817299 100644 (file)
@@ -12,9 +12,7 @@
 
 void test_main(void)
 {
-    printk("Hello World\n");
-
-    xtf_success();
+    xtf_success("Hello World\n");
 }
 
 /*
index d04935c567147e42342e45d0d7bda80301d4bd2e..6f982ec1740a3cb99cf48588f2767dd2f4061ae2 100644 (file)
@@ -237,7 +237,7 @@ void test_main(void)
 #endif
     test_unhandled_exception_hook();
 
-    xtf_success();
+    xtf_success(NULL);
 }
 
 /*
index e24b2a052f713e2bf6bd85aaf3dde289d9db9ea4..6efe54ccc5a106ea6f07511f9da4a9c59146e72e 100644 (file)
@@ -370,7 +370,7 @@ void test_main(void)
 
     xtf_exlog_stop();
 
-    xtf_success();
+    xtf_success(NULL);
 }
 
 /*