1*11be35a1SLionel Sambuc.\" Copyright 2012 Google Inc. 2*11be35a1SLionel Sambuc.\" All rights reserved. 3*11be35a1SLionel Sambuc.\" 4*11be35a1SLionel Sambuc.\" Redistribution and use in source and binary forms, with or without 5*11be35a1SLionel Sambuc.\" modification, are permitted provided that the following conditions are 6*11be35a1SLionel Sambuc.\" met: 7*11be35a1SLionel Sambuc.\" 8*11be35a1SLionel Sambuc.\" * Redistributions of source code must retain the above copyright 9*11be35a1SLionel Sambuc.\" notice, this list of conditions and the following disclaimer. 10*11be35a1SLionel Sambuc.\" * Redistributions in binary form must reproduce the above copyright 11*11be35a1SLionel Sambuc.\" notice, this list of conditions and the following disclaimer in the 12*11be35a1SLionel Sambuc.\" documentation and/or other materials provided with the distribution. 13*11be35a1SLionel Sambuc.\" * Neither the name of Google Inc. nor the names of its contributors 14*11be35a1SLionel Sambuc.\" may be used to endorse or promote products derived from this software 15*11be35a1SLionel Sambuc.\" without specific prior written permission. 16*11be35a1SLionel Sambuc.\" 17*11be35a1SLionel Sambuc.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18*11be35a1SLionel Sambuc.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19*11be35a1SLionel Sambuc.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20*11be35a1SLionel Sambuc.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21*11be35a1SLionel Sambuc.\" OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22*11be35a1SLionel Sambuc.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23*11be35a1SLionel Sambuc.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24*11be35a1SLionel Sambuc.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25*11be35a1SLionel Sambuc.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26*11be35a1SLionel Sambuc.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27*11be35a1SLionel Sambuc.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28*11be35a1SLionel Sambuc.Dd September 9, 2012 29*11be35a1SLionel Sambuc.Dt KYUA-DEBUG 1 30*11be35a1SLionel Sambuc.Os 31*11be35a1SLionel Sambuc.Sh NAME 32*11be35a1SLionel Sambuc.Nm debug 33*11be35a1SLionel Sambuc.Nd Executes a single test case with facilities for debugging 34*11be35a1SLionel Sambuc.Sh SYNOPSIS 35*11be35a1SLionel Sambuc.Nm 36*11be35a1SLionel Sambuc.Op Fl -build-root Ar path 37*11be35a1SLionel Sambuc.Op Fl -kyuafile Ar file 38*11be35a1SLionel Sambuc.Op Fl -stdout Ar path 39*11be35a1SLionel Sambuc.Op Fl -stderr Ar path 40*11be35a1SLionel Sambuc.Ar test_case 41*11be35a1SLionel Sambuc.Sh DESCRIPTION 42*11be35a1SLionel SambucThe 43*11be35a1SLionel Sambuc.Nm 44*11be35a1SLionel Sambuccommand provides a mechanism to execute a single test case bypassing some 45*11be35a1SLionel Sambucof the Kyua infrastructure and allowing the user to poke into the execution 46*11be35a1SLionel Sambucbehavior of the test. 47*11be35a1SLionel Sambuc.Pp 48*11be35a1SLionel SambucThe test case to run is selected by providing a test filter that matches a 49*11be35a1SLionel Sambucsingle test case; see 50*11be35a1SLionel Sambuc.Xr kyua-test-filters 7 . 51*11be35a1SLionel SambucThe test case is executed and its result is printed as the last line of the 52*11be35a1SLionel Sambucoutput of the tool. 53*11be35a1SLionel Sambuc.Pp 54*11be35a1SLionel SambucAt the moment, the 55*11be35a1SLionel Sambuc.Nm 56*11be35a1SLionel Sambuccommand allows the following aspects of a test case execution to be 57*11be35a1SLionel Sambuctweaked: 58*11be35a1SLionel Sambuc.Bl -bullet 59*11be35a1SLionel Sambuc.It 60*11be35a1SLionel SambucRedirection of the test case's stdout and stderr to the console (the 61*11be35a1SLionel Sambucdefault) or to arbitraty files. See the 62*11be35a1SLionel Sambuc.Fl -stdout 63*11be35a1SLionel Sambucand 64*11be35a1SLionel Sambuc.Fl -stderr 65*11be35a1SLionel Sambucoptions below. 66*11be35a1SLionel Sambuc.El 67*11be35a1SLionel Sambuc.Pp 68*11be35a1SLionel SambucThe following subcommand options are recognized: 69*11be35a1SLionel Sambuc.Bl -tag -width XX 70*11be35a1SLionel Sambuc.It Fl -build-root Ar path 71*11be35a1SLionel SambucSpecifies the build root in which to find the test programs referenced 72*11be35a1SLionel Sambucby the Kyuafile, if different from the Kyuafile's directory. See 73*11be35a1SLionel Sambuc.Xr kyua-build-root 7 74*11be35a1SLionel Sambucfor more information. 75*11be35a1SLionel Sambuc.It Fl -kyuafile Ar file , Fl k Ar file 76*11be35a1SLionel SambucSpecifies the Kyuafile to process. Defaults to 77*11be35a1SLionel Sambuc.Pa Kyuafile 78*11be35a1SLionel Sambucfile in the current directory. 79*11be35a1SLionel Sambuc.It Fl -stderr Ar path 80*11be35a1SLionel SambucSpecifies the file to which to send the standard error of the test 81*11be35a1SLionel Sambucprogram's body. The default is 82*11be35a1SLionel Sambuc.Pa /dev/stderr , 83*11be35a1SLionel Sambucwhich is a special that redirects the output to the console. 84*11be35a1SLionel Sambuc.It Fl -stdout Ar path 85*11be35a1SLionel SambucSpecifies the file to which to send the standard output of the test 86*11be35a1SLionel Sambucprogram's body. The default is 87*11be35a1SLionel Sambuc.Pa /dev/stdout , 88*11be35a1SLionel Sambucwhich is a special that redirects the output to the console. 89*11be35a1SLionel Sambuc.El 90*11be35a1SLionel Sambuc.Pp 91*11be35a1SLionel SambucFor example, consider the following Kyua session: 92*11be35a1SLionel Sambuc.Bd -literal -offset indent 93*11be35a1SLionel Sambuc$ kyua test 94*11be35a1SLionel Sambuckernel/fs:mkdir -> passed 95*11be35a1SLionel Sambuckernel/fs:rmdir -> failed: Invalid argument 96*11be35a1SLionel Sambuc 97*11be35a1SLionel Sambuc1/2 passed (1 failed) 98*11be35a1SLionel Sambuc.Ed 99*11be35a1SLionel Sambuc.Pp 100*11be35a1SLionel SambucAt this point, we do not have a lot of information regarding the 101*11be35a1SLionel Sambucfailure of the 102*11be35a1SLionel Sambuc.Sq kernel/fs:rmdir 103*11be35a1SLionel Sambuctest. We can run this test through the 104*11be35a1SLionel Sambuc.Nm 105*11be35a1SLionel Sambuccommand to inspect its output a bit closer, hoping that the test case is 106*11be35a1SLionel Sambuckind enough to log its progress: 107*11be35a1SLionel Sambuc.Bd -literal -offset indent 108*11be35a1SLionel Sambuc$ kyua debug kernel/fs:rmdir 109*11be35a1SLionel SambucTrying rmdir('foo') 110*11be35a1SLionel SambucTrying rmdir(NULL) 111*11be35a1SLionel Sambuckernel/fs:rmdir -> failed: Invalid argument 112*11be35a1SLionel Sambuc.Ed 113*11be35a1SLionel Sambuc.Pp 114*11be35a1SLionel SambucLuckily, the offending test case was printing status lines as it 115*11be35a1SLionel Sambucprogressed, so we could see the last attempted call and we can know match 116*11be35a1SLionel Sambucthe failure message to the problem. 117*11be35a1SLionel Sambuc.Sh EXIT STATUS 118*11be35a1SLionel SambucThe 119*11be35a1SLionel Sambuc.Nm 120*11be35a1SLionel Sambuccommand returns 0 if the test case passes or 1 if the test case fails. 121*11be35a1SLionel Sambuc.Pp 122*11be35a1SLionel SambucAdditional exit codes may be returned as described in 123*11be35a1SLionel Sambuc.Xr kyua 1 . 124*11be35a1SLionel Sambuc.Sh SEE ALSO 125*11be35a1SLionel Sambuc.Xr kyua 1 , 126*11be35a1SLionel Sambuc.Xr kyua-build-root 7 , 127*11be35a1SLionel Sambuc.Xr kyua-test-filters 7 128