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