1 # Copyright (c) 2007 The NetBSD Foundation, Inc.
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions
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.
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.
35 atf_set "descr" "Checks that the program can find its files if" \
36 "executed from the same directory"
42 for hp in $(get_helpers); do
45 atf_check -s eq:0 -o ignore -e ignore -x \
46 "cd tmp && ./${h} srcdir_exists"
47 atf_check -s eq:1 -o empty -e ignore "${hp}" -r res srcdir_exists
48 atf_check -s eq:0 -o ignore -e empty grep "Cannot find datafile" res
55 atf_set "descr" "Checks that the program can find its files if" \
56 "executed from the source directory and if it" \
57 "was built with libtool"
64 for hp in $(get_helpers c_helpers cpp_helpers); do
68 atf_check -s eq:0 -o ignore -e ignore -x \
69 "cd tmp && ./.libs/${h} srcdir_exists"
70 atf_check -s eq:1 -o empty -e ignore "${hp}" -r res srcdir_exists
71 atf_check -s eq:0 -o ignore -e empty grep "Cannot find datafile" res
74 for hp in $(get_helpers c_helpers cpp_helpers); do
77 cp ${hp} tmp/.libs/lt-${h}
78 atf_check -s eq:0 -o ignore -e ignore -x \
79 "cd tmp && ./.libs/lt-${h} srcdir_exists"
80 atf_check -s eq:1 -o empty -e ignore "${hp}" -r res srcdir_exists
81 atf_check -s eq:0 -o ignore -e empty grep "Cannot find datafile" res
88 atf_set "descr" "Checks that the program can find its files when" \
95 for hp in $(get_helpers); do
98 atf_check -s eq:0 -o ignore -e ignore -x \
99 "cd tmp && ./${h} -s $(pwd)/tmp \
101 atf_check -s eq:1 -o empty -e save:stderr "${hp}" -r res srcdir_exists
102 atf_check -s eq:0 -o ignore -e empty grep "Cannot find datafile" res
103 atf_check -s eq:0 -o ignore -e ignore \
104 "${hp}" -s "$(pwd)"/tmp srcdir_exists
108 atf_test_case relative
111 atf_set "descr" "Checks that passing a relative path through -s" \
118 for hp in $(get_helpers); do
122 for p in tmp tmp/. ./tmp; do
123 echo "Helper is: ${h}"
124 echo "Using source directory: ${p}"
126 atf_check -s eq:0 -o ignore -e ignore \
127 "./tmp/${h}" -s "${p}" srcdir_exists
128 atf_check -s eq:1 -o empty -e save:stderr "${hp}" -r res \
130 atf_check -s eq:0 -o ignore -e empty grep "Cannot find datafile" res
131 atf_check -s eq:0 -o ignore -e ignore \
132 "${hp}" -s "${p}" srcdir_exists
137 atf_init_test_cases()
139 atf_add_test_case default
140 atf_add_test_case libtool
141 atf_add_test_case sflag
142 atf_add_test_case relative
145 # vim: syntax=sh:expandtab:shiftwidth=4:softtabstop=4