xref: /freebsd/contrib/atf/atf-sh/atf-sh.1 (revision b93c1b1a3b046e4d36d85cb7265c25e19b793388)
1c243e490SMarcel Moolenaar.\" Copyright (c) 2010 The NetBSD Foundation, Inc.
2c243e490SMarcel Moolenaar.\" All rights reserved.
3c243e490SMarcel Moolenaar.\"
4c243e490SMarcel Moolenaar.\" Redistribution and use in source and binary forms, with or without
5c243e490SMarcel Moolenaar.\" modification, are permitted provided that the following conditions
6c243e490SMarcel Moolenaar.\" are met:
7c243e490SMarcel Moolenaar.\" 1. Redistributions of source code must retain the above copyright
8c243e490SMarcel Moolenaar.\"    notice, this list of conditions and the following disclaimer.
9c243e490SMarcel Moolenaar.\" 2. Redistributions in binary form must reproduce the above copyright
10c243e490SMarcel Moolenaar.\"    notice, this list of conditions and the following disclaimer in the
11c243e490SMarcel Moolenaar.\"    documentation and/or other materials provided with the distribution.
12c243e490SMarcel Moolenaar.\"
13c243e490SMarcel Moolenaar.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
14c243e490SMarcel Moolenaar.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
15c243e490SMarcel Moolenaar.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16c243e490SMarcel Moolenaar.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17c243e490SMarcel Moolenaar.\" IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
18c243e490SMarcel Moolenaar.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19c243e490SMarcel Moolenaar.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
20c243e490SMarcel Moolenaar.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21c243e490SMarcel Moolenaar.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
22c243e490SMarcel Moolenaar.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23c243e490SMarcel Moolenaar.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
24c243e490SMarcel Moolenaar.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*b93c1b1aSEnji Cooper.Dd March 6, 2017
26c243e490SMarcel Moolenaar.Dt ATF-SH 1
27c243e490SMarcel Moolenaar.Os
28c243e490SMarcel Moolenaar.Sh NAME
29c243e490SMarcel Moolenaar.Nm atf-sh
30c243e490SMarcel Moolenaar.Nd interpreter for shell-based test programs
31c243e490SMarcel Moolenaar.Sh SYNOPSIS
32c243e490SMarcel Moolenaar.Nm
33*b93c1b1aSEnji Cooper.Op Fl s Ar shell
34c243e490SMarcel Moolenaar.Ar script
35c243e490SMarcel Moolenaar.Sh DESCRIPTION
36c243e490SMarcel Moolenaar.Nm
37c243e490SMarcel Moolenaaris an interpreter that runs the test program given in
38c243e490SMarcel Moolenaar.Ar script
39c243e490SMarcel Moolenaarafter loading the
400677dfd1SJulio Merino.Xr atf-sh 3
41c243e490SMarcel Moolenaarlibrary.
42c243e490SMarcel Moolenaar.Pp
43c243e490SMarcel Moolenaar.Nm
44c243e490SMarcel Moolenaaris not a real interpreter though: it is just a wrapper around
45b9306c04SCraig Rodriguesthe system-wide shell defined by
46b9306c04SCraig Rodrigues.Va ATF_SHELL .
47c243e490SMarcel Moolenaar.Nm
48c243e490SMarcel Moolenaarexecutes the interpreter, loads the
490677dfd1SJulio Merino.Xr atf-sh 3
50c243e490SMarcel Moolenaarlibrary and then runs the script.
510677dfd1SJulio MerinoYou must consider
520677dfd1SJulio Merino.Nm atf-sh
530677dfd1SJulio Merinoto be a POSIX shell by default and thus should not use any non-standard
540677dfd1SJulio Merinoextensions.
55c243e490SMarcel Moolenaar.Pp
560677dfd1SJulio MerinoThe following options are available:
570677dfd1SJulio Merino.Bl -tag -width XsXshellXXX
580677dfd1SJulio Merino.It Fl s Ar shell
590677dfd1SJulio MerinoSpecifies the shell to use instead of the value provided by
600677dfd1SJulio Merino.Va ATF_SHELL .
610677dfd1SJulio Merino.El
620677dfd1SJulio Merino.Sh ENVIRONMENT
630677dfd1SJulio Merino.Bl -tag -width ATFXLIBEXECDIRXX -compact
640677dfd1SJulio Merino.It Va ATF_LIBEXECDIR
650677dfd1SJulio MerinoOverrides the builtin directory where
660677dfd1SJulio Merino.Nm
670677dfd1SJulio Merinois located.
680677dfd1SJulio MerinoShould not be overridden other than for testing purposes.
690677dfd1SJulio Merino.It Va ATF_PKGDATADIR
700677dfd1SJulio MerinoOverrides the builtin directory where
710677dfd1SJulio Merino.Pa libatf-sh.subr
720677dfd1SJulio Merinois located.
730677dfd1SJulio MerinoShould not be overridden other than for testing purposes.
740677dfd1SJulio Merino.It Va ATF_SHELL
750677dfd1SJulio MerinoPath to the system shell to be used in the generated scripts.
760677dfd1SJulio MerinoScripts must not rely on this variable being set to select a specific
770677dfd1SJulio Merinointerpreter.
78*b93c1b1aSEnji Cooper.It Va ATF_SHELL
79*b93c1b1aSEnji CooperPath to the system shell to be used in the generated scripts.
800677dfd1SJulio Merino.El
810677dfd1SJulio Merino.Sh EXAMPLES
82c243e490SMarcel MoolenaarScripts using
830677dfd1SJulio Merino.Xr atf-sh 3
84c243e490SMarcel Moolenaarshould start with:
85c243e490SMarcel Moolenaar.Bd -literal -offset indent
86c243e490SMarcel Moolenaar#! /usr/bin/env atf-sh
87c243e490SMarcel Moolenaar.Ed
88c243e490SMarcel Moolenaar.Pp
890677dfd1SJulio MerinoAlternatively, if you want to explicitly choose a shell interpreter, you cannot
900677dfd1SJulio Merinorely on
910677dfd1SJulio Merino.Xr env 1
920677dfd1SJulio Merinoto find
930677dfd1SJulio Merino.Nm .
940677dfd1SJulio MerinoInstead, you have to hardcode the path to
950677dfd1SJulio Merino.Nm
960677dfd1SJulio Merinoin the script and then use the
970677dfd1SJulio Merino.Fl s
980677dfd1SJulio Merinooption afterwards as a
990677dfd1SJulio Merino.Em single parameter :
1000677dfd1SJulio Merino.Bd -literal -offset indent
1010677dfd1SJulio Merino#! /path/to/bin/atf-sh -s/bin/bash
1020677dfd1SJulio Merino.Ed
103c243e490SMarcel Moolenaar.Sh SEE ALSO
1040677dfd1SJulio Merino.Xr atf-sh 3
105