tools/llvm: Do not build with symbols
[minix3.git] / external / bsd / atf / dist / test-programs / srcdir_test.sh
blob11d6831f88686aa7ff479d8e3de1a05f1b1044b6
2 # Automated Testing Framework (atf)
4 # Copyright (c) 2007 The NetBSD Foundation, Inc.
5 # All rights reserved.
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
9 # are met:
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.
30 create_files()
32 mkdir tmp
33 touch tmp/datafile
36 atf_test_case default
37 default_head()
39 atf_set "descr" "Checks that the program can find its files if" \
40 "executed from the same directory"
42 default_body()
44 create_files
46 for hp in $(get_helpers); do
47 h=${hp##*/}
48 cp ${hp} tmp
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
53 done
56 atf_test_case libtool
57 libtool_head()
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"
63 libtool_body()
65 create_files
66 mkdir tmp/.libs
68 for hp in $(get_helpers c_helpers cpp_helpers); do
69 h=${hp##*/}
70 cp ${hp} tmp
71 cp ${hp} tmp/.libs
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
76 done
78 for hp in $(get_helpers c_helpers cpp_helpers); do
79 h=${hp##*/}
80 cp ${hp} tmp
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
86 done
89 atf_test_case sflag
90 sflag_head()
92 atf_set "descr" "Checks that the program can find its files when" \
93 "using the -s flag"
95 sflag_body()
97 create_files
99 for hp in $(get_helpers); do
100 h=${hp##*/}
101 cp ${hp} tmp
102 atf_check -s eq:0 -o ignore -e ignore -x \
103 "cd tmp && ./${h} -s $(pwd)/tmp \
104 srcdir_exists"
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
109 done
112 atf_test_case relative
113 relative_head()
115 atf_set "descr" "Checks that passing a relative path through -s" \
116 "works"
118 relative_body()
120 create_files
122 for hp in $(get_helpers); do
123 h=${hp##*/}
124 cp ${hp} tmp
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 \
133 srcdir_exists
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
137 done
138 done
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