TBRIDGE(9)

NAME
tbridge_printf, tbridge_test_done, TBRIDGE_TESTCASE_MODULE - kernel test bridge for dfregress

SYNOPSIS
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/tbridge.h>

Functions:
int
tbridge_printf(const char *fmt, ...);
void
tbridge_test_done(int result);

Macros:
TBRIDGE_TESTCASE_MODULE(name, struct tbridge_testcase *testcase);

Defines: RESULT_TIMEOUT, RESULT_SIGNALLED, RESULT_NOTRUN, RESULT_FAIL, RESULT_PASS, RESULT_UNKNOWN

Callbacks:
typedef int
(*tbridge_abort_t)(void);
typedef void
(*tbridge_run_t)(void *);

DESCRIPTION
To create a new kernel testcase ‘testfoo’ the following is required:

    TBRIDGE_TESTCASE_MODULE(testfoo, &testfoo_case);
    struct tbridge_testcase testfoo_case = {
    	.tb_run = testfoo_run,
    	/* The following are optional */
    	.tb_abort = testfoo_abort
    };

The tb_run callback is called from a separate kernel thread to start testcase execution.

The tb_abort callback is optional, but highly recommended. It is called whenever a testcase execution times out, so that the testcase can clean up and abort all running tasks, if possible. If this is not applicable to your test because it is impossible to interrupt, set to NULL.

FUNCTIONS
The TBRIDGE_TESTCASE_MODULE() macro declares a tbridge_printf testcase kernel module. testcase is a structure of type struct tbridge_testcase, as described above.

The tbridge_printf() function acts as a kprintf replacement that will log all the output into the testcase metadata that is passed back to userland upon completion. Its syntax is equivalent to that of kprintf(9).

The tbridge_test_done() function should be called whenever a result for the testcase is available. The parameter result should be set to one of the RESULT_ defines.

SEE ALSO
dfregress(8)

HISTORY
The tbridge_printf module first appeared in DragonFly 2.13.

AUTHORS
The tbridge_printf module was written by Alex Hornung.