INN commit: branches/2.5/tests (libtest.c libtest.h)

INN Commit rra at isc.org
Fri Aug 19 15:09:49 UTC 2011


    Date: Friday, August 19, 2011 @ 08:09:48
  Author: iulius
Revision: 9351

fix the libtest support files to make the new libtest format work

In case the test suite is updated in the 2.5 branch, make sure the
new C TAP format work.

Modified:
  branches/2.5/tests/libtest.c
  branches/2.5/tests/libtest.h

-----------+
 libtest.c |   32 ++++++++------------------------
 libtest.h |    4 ++++
 2 files changed, 12 insertions(+), 24 deletions(-)

Modified: libtest.c
===================================================================
--- libtest.c	2011-08-18 14:19:02 UTC (rev 9350)
+++ libtest.c	2011-08-19 15:09:48 UTC (rev 9351)
@@ -198,18 +198,14 @@
  * Takes a boolean success value and assumes the test passes if that value
  * is true and fails if that value is false.
  */
-#if defined LIBTEST_NEW_FORMAT
+#ifndef LIBTEST_NEW_FORMAT
 void
-ok(int success, const char *format, ...)
-#else
-void
 ok(int n UNUSED, int success) {
     new_ok(success, NULL);
 }
-
+#endif
 void
 new_ok(int success, const char *format, ...)
-#endif
 {
     fflush(stderr);
     printf("%sok %lu", success ? "" : "not ", testnum++);
@@ -245,18 +241,14 @@
 /*
  * Skip a test.
  */
-#if defined LIBTEST_NEW_FORMAT
+#ifndef LIBTEST_NEW_FORMAT
 void
-skip(const char *reason, ...)
-#else
-void
 skip(int n UNUSED, const char *reason) {
     new_skip(reason);
 }
-
+#endif
 void
 new_skip(const char *reason, ...)
-#endif
 {
     fflush(stderr);
     printf("ok %lu # skip", testnum++);
@@ -275,18 +267,14 @@
 /*
  * Report the same status on the next count tests.
  */
-#if defined LIBTEST_NEW_FORMAT
+#ifndef LIBTEST_NEW_FORMAT
 void
-ok_block(unsigned long count, int status, const char *format, ...)
-#else
-void
 ok_block(int n UNUSED, int count, int success) {
     new_ok_block(count, success, NULL);
 }
-
+#endif
 void
 new_ok_block(unsigned long count, int status, const char *format, ...)
-#endif
 {
     unsigned long i;
 
@@ -310,18 +298,14 @@
 /*
  * Skip the next count tests.
  */
-#if defined LIBTEST_NEW_FORMAT
+#ifndef LIBTEST_NEW_FORMAT
 void
-skip_block(unsigned long count, const char *reason, ...)
-#else
-void
 skip_block(int n UNUSED, int count, const char *reason) {
     new_skip_block(count, reason);
 }
-
+#endif
 void
 new_skip_block(unsigned long count, const char *reason, ...)
-#endif
 {
     unsigned long i;
 

Modified: libtest.h
===================================================================
--- libtest.h	2011-08-18 14:19:02 UTC (rev 9350)
+++ libtest.h	2011-08-19 15:09:48 UTC (rev 9351)
@@ -123,6 +123,10 @@
 void errors_capture(void);
 void errors_uncapture(void);
 #else
+# define ok new_ok
+# define skip new_skip
+# define ok_block new_ok_block
+# define skip_block new_skip_block
 void ok(int success, const char *format, ...)
     __attribute__((__format__(printf, 2, 3)));
 void skip(const char *reason, ...)




More information about the inn-committers mailing list