xref: /freebsd-src/contrib/atf/atf-sh/tp_test.sh (revision 8f0ea33f2bbf3a6aa80235f0a02fa5f2780c2b17)
1*c243e490SMarcel Moolenaar# Copyright (c) 2007 The NetBSD Foundation, Inc.
2*c243e490SMarcel Moolenaar# All rights reserved.
3*c243e490SMarcel Moolenaar#
4*c243e490SMarcel Moolenaar# Redistribution and use in source and binary forms, with or without
5*c243e490SMarcel Moolenaar# modification, are permitted provided that the following conditions
6*c243e490SMarcel Moolenaar# are met:
7*c243e490SMarcel Moolenaar# 1. Redistributions of source code must retain the above copyright
8*c243e490SMarcel Moolenaar#    notice, this list of conditions and the following disclaimer.
9*c243e490SMarcel Moolenaar# 2. Redistributions in binary form must reproduce the above copyright
10*c243e490SMarcel Moolenaar#    notice, this list of conditions and the following disclaimer in the
11*c243e490SMarcel Moolenaar#    documentation and/or other materials provided with the distribution.
12*c243e490SMarcel Moolenaar#
13*c243e490SMarcel Moolenaar# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
14*c243e490SMarcel Moolenaar# CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
15*c243e490SMarcel Moolenaar# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16*c243e490SMarcel Moolenaar# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17*c243e490SMarcel Moolenaar# IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
18*c243e490SMarcel Moolenaar# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19*c243e490SMarcel Moolenaar# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
20*c243e490SMarcel Moolenaar# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21*c243e490SMarcel Moolenaar# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
22*c243e490SMarcel Moolenaar# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23*c243e490SMarcel Moolenaar# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
24*c243e490SMarcel Moolenaar# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*c243e490SMarcel Moolenaar
26*c243e490SMarcel Moolenaaratf_test_case srcdir
27*c243e490SMarcel Moolenaarsrcdir_head()
28*c243e490SMarcel Moolenaar{
29*c243e490SMarcel Moolenaar    atf_set "descr" "Verifies that the source directory can be queried" \
30*c243e490SMarcel Moolenaar                    "from the initialization function"
31*c243e490SMarcel Moolenaar}
32*c243e490SMarcel Moolenaarsrcdir_body()
33*c243e490SMarcel Moolenaar{
34*c243e490SMarcel Moolenaar    mkdir work
35*c243e490SMarcel Moolenaar    atf_check -s eq:0 -o empty -e empty cp "$(atf_get_srcdir)/misc_helpers" work
36*c243e490SMarcel Moolenaar    cat >work/subrs <<EOF
37*c243e490SMarcel Moolenaarhelper_subr() {
38*c243e490SMarcel Moolenaar    echo "This is a helper subroutine"
39*c243e490SMarcel Moolenaar}
40*c243e490SMarcel MoolenaarEOF
41*c243e490SMarcel Moolenaar
42*c243e490SMarcel Moolenaar    atf_check -s eq:0 -o match:'Calling helper' \
43*c243e490SMarcel Moolenaar        -o match:'This is a helper subroutine' -e ignore ./work/misc_helpers \
44*c243e490SMarcel Moolenaar        -s "$(pwd)"/work tp_srcdir
45*c243e490SMarcel Moolenaar}
46*c243e490SMarcel Moolenaar
47*c243e490SMarcel Moolenaaratf_init_test_cases()
48*c243e490SMarcel Moolenaar{
49*c243e490SMarcel Moolenaar    atf_add_test_case srcdir
50*c243e490SMarcel Moolenaar}
51*c243e490SMarcel Moolenaar
52*c243e490SMarcel Moolenaar# vim: syntax=sh:expandtab:shiftwidth=4:softtabstop=4
53