diff options
author | unknown <mkindahl@dl145h.mysql.com> | 2006-08-29 22:23:56 +0200 |
---|---|---|
committer | unknown <mkindahl@dl145h.mysql.com> | 2006-08-29 22:23:56 +0200 |
commit | 1b8dad2b58ba132a65d559f5756d06fe65fa929f (patch) | |
tree | 9f53514f88d028736962295c163eae9205eb284a /unittest/mytap | |
parent | 92bbbaa4b07385cb689ac5e3d49207f810964846 (diff) | |
download | mariadb-git-1b8dad2b58ba132a65d559f5756d06fe65fa929f.tar.gz |
Various fixes to make MyTAP build on all platforms.
unittest/Makefile.am:
Not installing unit.pl any more.
Adding test-verbose target to see the TAP output (for debugging).
unittest/mytap/tap.h:
Including portability file.
Whitespace changes.
Code sample for BAIL_OUT() function.
Diffstat (limited to 'unittest/mytap')
-rw-r--r-- | unittest/mytap/tap.h | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/unittest/mytap/tap.h b/unittest/mytap/tap.h index 5e24c1c8c99..51b8c7df04d 100644 --- a/unittest/mytap/tap.h +++ b/unittest/mytap/tap.h @@ -21,9 +21,11 @@ #ifndef TAP_H #define TAP_H -/* - @defgroup MyTAP MySQL support for performing unit tests according to TAP. +#include "my_global.h" +/* + @defgroup MyTAP MySQL support for performing unit tests according to + the Test Anything Protocol (TAP). */ #define NO_PLAN (0) @@ -34,6 +36,7 @@ @internal We are using the "typedef struct X { ... } X" idiom to create class/struct X both in C and C++. */ + typedef struct TEST_DATA { /** Number of tests that is planned to execute. @@ -71,6 +74,7 @@ extern "C" { @param count The planned number of tests to run. */ + void plan(int count); @@ -89,9 +93,11 @@ void plan(int count); @param fmt Format string in printf() format. NULL is allowed, in which case nothing is printed. */ + void ok(int pass, char const *fmt, ...) __attribute__((format(printf,2,3))); + /** Skip a determined number of tests. @@ -116,6 +122,7 @@ void ok(int pass, char const *fmt, ...) @param how_many Number of tests that are to be skipped. @param reason A reason for skipping the tests */ + void skip(int how_many, char const *reason, ...) __attribute__((format(printf,2,3))); @@ -136,17 +143,21 @@ void skip(int how_many, char const *reason, ...) @see skip */ + #define SKIP_BLOCK_IF(SKIP_IF_TRUE, COUNT, REASON) \ if (SKIP_IF_TRUE) skip((COUNT),(REASON)); else + /** Print a diagnostics message. @param fmt Diagnostics message in printf() format. */ + void diag(char const *fmt, ...) __attribute__((format(printf,1,2))); + /** Print a bail out message. @@ -155,6 +166,10 @@ void diag(char const *fmt, ...) The test will exit with status 255. This function does not return. + @code + BAIL_OUT("Lost connection to server %s", server_name); + @endcode + @note A bail out message is printed if a signal that generates a core is raised. @@ -180,6 +195,7 @@ void BAIL_OUT(char const *fmt, ...) @returns EXIT_SUCCESS if all tests passed, EXIT_FAILURE if one or more tests failed. */ + int exit_status(void); @@ -190,9 +206,11 @@ int exit_status(void); automatically call exit(), so there is no need to have checks around it. */ + void skip_all(char const *reason, ...) __attribute__((noreturn, format(printf, 1, 2))); + /** Start section of tests that are not yet ready. @@ -213,14 +231,18 @@ void skip_all(char const *reason, ...) @param message Message that will be printed before the todo tests. */ + void todo_start(char const *message, ...) - __attribute__((format (printf, 1, 2))); + __attribute__((format(printf, 1, 2))); + /** End a section of tests that are not yet ready. */ + void todo_end(); + #ifdef __cplusplus } #endif |