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