xref: /freebsd/contrib/atf/doc/atf-test-program.1 (revision d6b92ffa)
1.\" Copyright (c) 2007 The NetBSD Foundation, Inc.
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
14.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
15.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17.\" IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
18.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
20.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
22.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
24.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25.Dd March 2, 2014
26.Dt ATF-TEST-PROGRAM 1
27.Os
28.Sh NAME
29.Nm atf-test-program
30.Nd common interface to ATF test programs
31.Sh SYNOPSIS
32.Nm
33.Op Fl r Ar resfile
34.Op Fl s Ar srcdir
35.Op Fl v Ar var1=value1 Op .. Fl v Ar varN=valueN
36.Ar test_case
37.Nm
38.Fl l
39.Sh DESCRIPTION
40Test programs written using the ATF libraries all share a common user
41interface, which is what this manual page describes.
42.Em NOTE: There is no binary known as
43.Nm ;
44.Em what is described in this manual page is the command-line interface
45.Em exposed by the atf-c, atf-c++ and atf-sh bindings .
46.Pp
47In the first synopsis form, the test program will execute the provided
48test case and print its results to the standard output, unless otherwise
49stated by the
50.Fl r
51flag.
52Optionally, the test case name can be suffixed by
53.Sq :cleanup ,
54in which case the cleanup routine of the test case will be executed
55instead of the test case body; see
56.Xr atf-test-case 4 .
57Note that the test case is
58.Em executed without isolation ,
59so it can and probably will create and modify files in the current directory.
60To execute test cases in a controller manner, you need a runtime engine
61that understands the ATF interface.
62The recommended runtime engine is
63.Xr kyua 1 .
64You should only execute test cases by hand for debugging purposes.
65.Pp
66In the second synopsis form, the test program will list all available
67test cases alongside their meta-data properties in a format that is
68machine parseable.
69This list is processed by
70.Xr kyua 1
71to know how to execute the test cases of a given test program.
72.Pp
73The following options are available:
74.Bl -tag -width XvXvarXvalueXX
75.It Fl l
76Lists available test cases alongside a brief description for each of them.
77.It Fl r Ar resfile
78Specifies the file that will receive the test case result.
79If not specified, the test case prints its results to stdout.
80If the result of a test case needs to be parsed by another program, you must
81use this option to redirect the result to a file and then read the resulting
82file from the other program.
83Note:
84.Em do not try to process the stdout of the test case
85because your program may break in the future.
86.It Fl s Ar srcdir
87The path to the directory where the test program is located.
88This is needed in all cases, except when the test program is being executed
89from the current directory.
90The test program will use this path to locate any helper data files or
91utilities.
92.It Fl v Ar var=value
93Sets the configuration variable
94.Ar var
95to the value
96.Ar value .
97.El
98.Sh SEE ALSO
99.Xr kyua 1
100