nrelease - fix/improve livecd
[dragonfly.git] / share / man / man9 / tbridge.9
1 .\"
2 .\" Copyright (c) 2011
3 .\"     The DragonFly Project.  All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\"
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\"    notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\"    notice, this list of conditions and the following disclaimer in
13 .\"    the documentation and/or other materials provided with the
14 .\"    distribution.
15 .\" 3. Neither the name of The DragonFly Project nor the names of its
16 .\"    contributors may be used to endorse or promote products derived
17 .\"    from this software without specific, prior written permission.
18 .\"
19 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 .\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22 .\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
23 .\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24 .\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27 .\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
29 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .Dd November 18, 2011
33 .Dt TBRIDGE 9
34 .Os
35 .Sh NAME
36 .Nm tbridge_printf ,
37 .Nm tbridge_test_done ,
38 .Nm TBRIDGE_TESTCASE_MODULE
39 .Nd kernel test bridge for dfregress
40 .Sh SYNOPSIS
41 .In sys/systm.h
42 .In sys/kernel.h
43 .In sys/module.h
44 .In sys/tbridge.h
45 .Pp
46 Functions:
47 .Ft int
48 .Fn tbridge_printf "const char *fmt" "..."
49 .Ft void
50 .Fn tbridge_test_done "int result"
51 .Pp
52 Macros:
53 .Fn TBRIDGE_TESTCASE_MODULE "name" "struct tbridge_testcase *testcase"
54 .Pp
55 Defines:
56 .Dv RESULT_TIMEOUT ,
57 .Dv RESULT_SIGNALLED ,
58 .Dv RESULT_NOTRUN ,
59 .Dv RESULT_FAIL ,
60 .Dv RESULT_PASS ,
61 .Dv RESULT_UNKNOWN
62 .Pp
63 Callbacks:
64 .Ft typedef int
65 .Fn (*tbridge_abort_t) "void"
66 .Ft typedef void
67 .Fn (*tbridge_run_t) "void *"
68 .Sh DESCRIPTION
69 To create a new kernel testcase
70 .Sq testfoo
71 the following is required:
72 .Bd -literal
73 TBRIDGE_TESTCASE_MODULE(testfoo, &testfoo_case);
74
75 struct tbridge_testcase testfoo_case = {
76         .tb_run = testfoo_run,
77
78         /* The following are optional */
79         .tb_abort = testfoo_abort
80 };
81 .Ed
82 .Pp
83 The
84 .Fa tb_run
85 callback is called from a separate kernel thread to start testcase
86 execution.
87 .Pp
88 The
89 .Fa tb_abort
90 callback is optional, but highly recommended.
91 It is called whenever a testcase execution times out, so that the
92 testcase can clean up and abort all running tasks, if possible.
93 If this is not applicable to your test because it is impossible
94 to interrupt, set to
95 .Dv NULL .
96 .Sh FUNCTIONS
97 The
98 .Fn TBRIDGE_TESTCASE_MODULE
99 macro declares a
100 .Nm
101 testcase kernel module.
102 .Fa testcase
103 is a structure of type
104 .Ft struct tbridge_testcase ,
105 as described above.
106 .Pp
107 The
108 .Fn tbridge_printf
109 function acts as a kprintf replacement that will log all the output
110 into the testcase metadata that is passed back to userland upon completion.
111 Its syntax is equivalent to that of
112 .Xr kprintf 9 .
113 .Pp
114 The
115 .Fn tbridge_test_done
116 function should be called whenever a result for the testcase is available.
117 The parameter
118 .Fa result
119 should be set to one of the
120 .Dv RESULT_
121 defines.
122 .Sh SEE ALSO
123 .Xr dfregress 8
124 .Sh HISTORY
125 The
126 .Nm
127 module first appeared in
128 .Dx 2.13 .
129 .Sh AUTHORS
130 The
131 .Nm
132 module was written by
133 .An Alex Hornung .