2 # Automated Testing Framework (atf)
4 # Copyright (c) 2007 The NetBSD Foundation, Inc.
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
10 # 1. Redistributions of source code must retain the above copyright
11 # notice, this list of conditions and the following disclaimer.
12 # 2. Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in the
14 # documentation and/or other materials provided with the distribution.
16 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
17 # CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
18 # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 # IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
21 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
23 # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25 # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26 # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27 # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 atf_set
"descr" "Checks that the program can find its files if" \
40 "executed from the same directory"
46 for hp
in $
(get_helpers
); do
49 atf_check
-s eq
:0 -o ignore
-e ignore
-x \
50 "cd tmp && ./${h} srcdir_exists"
51 atf_check
-s eq
:1 -o empty
-e ignore
"${hp}" -r res srcdir_exists
52 atf_check
-s eq
:0 -o ignore
-e empty
grep "Cannot find datafile" res
59 atf_set
"descr" "Checks that the program can find its files if" \
60 "executed from the source directory and if it" \
61 "was built with libtool"
68 for hp
in $
(get_helpers c_helpers cpp_helpers
); do
72 atf_check
-s eq
:0 -o ignore
-e ignore
-x \
73 "cd tmp && ./.libs/${h} srcdir_exists"
74 atf_check
-s eq
:1 -o empty
-e ignore
"${hp}" -r res srcdir_exists
75 atf_check
-s eq
:0 -o ignore
-e empty
grep "Cannot find datafile" res
78 for hp
in $
(get_helpers c_helpers cpp_helpers
); do
81 cp ${hp} tmp
/.libs
/lt-
${h}
82 atf_check
-s eq
:0 -o ignore
-e ignore
-x \
83 "cd tmp && ./.libs/lt-${h} srcdir_exists"
84 atf_check
-s eq
:1 -o empty
-e ignore
"${hp}" -r res srcdir_exists
85 atf_check
-s eq
:0 -o ignore
-e empty
grep "Cannot find datafile" res
92 atf_set
"descr" "Checks that the program can find its files when" \
99 for hp
in $
(get_helpers
); do
102 atf_check
-s eq
:0 -o ignore
-e ignore
-x \
103 "cd tmp && ./${h} -s $(pwd)/tmp \
105 atf_check
-s eq
:1 -o empty
-e save
:stderr
"${hp}" -r res srcdir_exists
106 atf_check
-s eq
:0 -o ignore
-e empty
grep "Cannot find datafile" res
107 atf_check
-s eq
:0 -o ignore
-e ignore \
108 "${hp}" -s "$(pwd)"/tmp srcdir_exists
112 atf_test_case relative
115 atf_set
"descr" "Checks that passing a relative path through -s" \
122 for hp
in $
(get_helpers
); do
126 for p
in tmp tmp
/. .
/tmp
; do
127 echo "Helper is: ${h}"
128 echo "Using source directory: ${p}"
130 atf_check
-s eq
:0 -o ignore
-e ignore \
131 "./tmp/${h}" -s "${p}" srcdir_exists
132 atf_check
-s eq
:1 -o empty
-e save
:stderr
"${hp}" -r res \
134 atf_check
-s eq
:0 -o ignore
-e empty
grep "Cannot find datafile" res
135 atf_check
-s eq
:0 -o ignore
-e ignore \
136 "${hp}" -s "${p}" srcdir_exists
141 atf_init_test_cases
()
143 atf_add_test_case default
144 atf_add_test_case libtool
145 atf_add_test_case sflag
146 atf_add_test_case relative
149 # vim: syntax=sh:expandtab:shiftwidth=4:softtabstop=4