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