1 # $NetBSD: t_make.sh,v 1.1 2012/03/17 16:33:14 jruoho Exp $
3 # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
9 # 1. Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in the
13 # documentation and/or other materials provided with the distribution.
15 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 # POSSIBILITY OF SUCH DAMAGE.
28 # Executes make and compares the output to a golden file.
31 local name
="${1}"; shift
33 local srcdir
="$(atf_get_srcdir)"
34 atf_check
-o file:"${srcdir}/d_${name}.out" -x \
35 "make -k -f ${srcdir}/d_${name}.mk 2>&1 | sed -e 's,${srcdir}/d_,,'"
38 # Defines a test case for make(1), parsing a given file and comparing the
39 # output to prerecorded results.
42 local name
="${1}"; shift
43 local descr
="${1}"; shift
45 atf_test_case
"${name}"
46 eval "${name}_head() { \
47 atf_set descr '${descr}'; \
49 eval "${name}_body() { \
50 run_and_check '${name}'; \
54 test_case comment
"Checks comments (PR/17732, PR/30536)"
55 test_case cond1
"Checks conditionals (PR/24420)"
56 test_case dotwait
"Checks .WAIT"
57 test_case
export "Checks .export of provided variables"
58 test_case export_all
"Checks .export of all global variables"
59 test_case moderrs
"Checks correct handling of errors in modifiers usage"
60 test_case modmatch
"Checks modifier :M"
61 test_case modmisc
"Checks modifiers specified in variables"
62 test_case modorder
"Checks modifier :Ox"
63 test_case modts
"Checks modifier :ts"
64 test_case modword
"Checks modifier :[]"
65 test_case posix
"Checks conformance to POSIX"
66 test_case qequals
"Checks operator ?="
67 test_case ternary
"Checks ternary modifier"
68 test_case varcmd
"Checks behavior of command line variable assignments"
69 test_case unmatchedvarparen
"Checks $ ( ) matches"
73 atf_add_test_case comment
74 atf_add_test_case cond1
75 atf_add_test_case dotwait
76 atf_add_test_case
export
77 atf_add_test_case export_all
78 atf_add_test_case moderrs
79 atf_add_test_case modmatch
80 atf_add_test_case modmisc
81 atf_add_test_case modorder
82 atf_add_test_case modts
83 atf_add_test_case modword
84 atf_add_test_case posix
85 atf_add_test_case qequals
86 atf_add_test_case ternary
87 atf_add_test_case varcmd
88 atf_add_test_case unmatchedvarparen