MySQL 5.6.14 Source Code Document
|
Macros | |
#define | SKIP_BLOCK_IF(SKIP_IF_TRUE, COUNT, REASON) if (SKIP_IF_TRUE) skip((COUNT),(REASON)); else |
#define | SKIP_BIG_TESTS(COUNT) if (skip_big_tests) skip((COUNT), "big test"); else |
Functions | |
void | plan (int const count) |
void | ok (int const pass, char const *fmt,...) __attribute__((format(printf |
void void | ok1 (int const pass) |
void | skip (int how_many, char const *reason,...) __attribute__((format(printf |
void | diag (char const *fmt,...) __attribute__((format(printf |
void void | BAIL_OUT (char const *fmt,...) __attribute__((noreturn |
void void | format (printf, 1, 2))) |
int | exit_status (void) |
void | skip_all (char const *reason,...) __attribute__((noreturn |
void | todo_start (char const *message,...) __attribute__((format(printf |
void void | todo_end () |
MySQL support for performing unit tests according to TAP.
Helper macro to skip a group of "big" tests. It is used in the following manner:
#define SKIP_BLOCK_IF | ( | SKIP_IF_TRUE, | |
COUNT, | |||
REASON | |||
) | if (SKIP_IF_TRUE) skip((COUNT),(REASON)); else |
Helper macro to skip a block of code. The macro can be used to simplify conditionally skipping a block of code. It is used in the following manner:
void void BAIL_OUT | ( | char const * | fmt, |
... | |||
) |
Print a bail out message.
A bail out message can be issued when no further testing can be done, e.g., when there are missing dependencies.
The test will exit with status 255. This function does not return.
fmt | Bail out message in printf() format. |
void diag | ( | char const * | fmt, |
... | |||
) |
Print a diagnostics message.
fmt | Diagnostics message in printf() format. |
int exit_status | ( | void | ) |
Print summary report and return exit status.
This function will print a summary report of how many tests passed, how many were skipped, and how many remains to do. The function should be called after all tests are executed in the following manner:
EXIT_SUCCESS
if all tests passed, EXIT_FAILURE
if one or more tests failed. Definition at line 311 of file tap.c.
void ok | ( | int const | pass, |
char const * | fmt, | ||
... | |||
) |
Report test result as a TAP line.
Function used to write status of an individual test. Call this function in the following manner:
pass | Zero if the test failed, non-zero if it passed. |
fmt | Format string in printf() format. NULL is not allowed, use ok1() in this case. |
void void ok1 | ( | int const | pass | ) |
void plan | ( | int const | count | ) |
Set number of tests that is planned to execute.
The function also accepts the predefined constant NO_PLAN
. If invoked with this constant – or not invoked at all – the test plan will be printed after all the test lines.
The plan() function will install signal handlers for all signals that generate a core, so if you want to override these signals, do it after you have called the plan() function.
It will also set skip_big_tests variable if MYTAP_CONFIG environment variable is defined.
count | The planned number of tests to run. |
Definition at line 195 of file tap.c.
void skip | ( | int | how_many, |
char const * | reason, | ||
... | |||
) |
Skip a determined number of tests.
Function to print that how_many tests have been skipped. The reason is printed for each skipped test. Observe that this function does not do the actual skipping for you, it just prints information that tests have been skipped. This function is not usually used, but rather the macro SKIP_BLOCK_IF
, which does the skipping for you.
It shall be used in the following manner:
void skip_all | ( | char const * | reason, |
... | |||
) |
Skip entire test suite.
To skip the entire test suite, use this function. It will automatically call exit(), so there is no need to have checks around it.
void void todo_end | ( | ) |
void todo_start | ( | char const * | message, |
... | |||
) |
Start section of tests that are not yet ready.
To start a section of tests that are not ready and are expected to fail, use this function and todo_end() in the following manner:
message | Message that will be printed before the todo tests. |