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