Module Name: src
Committed By: jmmv
Date: Sat Jul 10 16:16:12 UTC 2010
Modified Files:
src/tests/util/make: Makefile
Added Files:
src/tests/util/make: t_make.sh
Removed Files:
src/tests/util/make: t_make.awk t_make.in
Log Message:
Do not use awk to generate the test program. Instead, replace it with some
eval magic (which is less magic than the previous awk stuff).
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/util/make/Makefile
cvs rdiff -u -r1.2 -r0 src/tests/util/make/t_make.awk
cvs rdiff -u -r1.1 -r0 src/tests/util/make/t_make.in
cvs rdiff -u -r0 -r1.1 src/tests/util/make/t_make.sh
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/util/make/Makefile
diff -u src/tests/util/make/Makefile:1.1 src/tests/util/make/Makefile:1.2
--- src/tests/util/make/Makefile:1.1 Fri Feb 13 05:19:52 2009
+++ src/tests/util/make/Makefile Sat Jul 10 16:16:12 2010
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1 2009/02/13 05:19:52 jmmv Exp $
+# $NetBSD: Makefile,v 1.2 2010/07/10 16:16:12 jmmv Exp $
NOMAN= # defined
@@ -8,10 +8,6 @@
TESTS_SH= t_make
-CLEANFILES+= t_make.sh
-t_make.sh: t_make.awk t_make.in
- ${TOOL_AWK} -f ${.CURDIR}/t_make.awk ${.CURDIR}/t_make.in > t_make.sh
-
FILESDIR= ${TESTSDIR}
FILES= d_comment.mk
FILES+= d_comment.out
Added files:
Index: src/tests/util/make/t_make.sh
diff -u /dev/null src/tests/util/make/t_make.sh:1.1
--- /dev/null Sat Jul 10 16:16:12 2010
+++ src/tests/util/make/t_make.sh Sat Jul 10 16:16:12 2010
@@ -0,0 +1,88 @@
+# $NetBSD: t_make.sh,v 1.1 2010/07/10 16:16:12 jmmv Exp $
+#
+# Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+# Executes make and compares the output to a golden file.
+run_and_check()
+{
+ local name="${1}"; shift
+
+ local srcdir="$(atf_get_srcdir)"
+ atf_check -o file:"${srcdir}/d_${name}.out" -x \
+ "make -k -f ${srcdir}/d_${name}.mk 2>&1 | sed -e 's,${srcdir}/d_,,'"
+}
+
+# Defines a test case for make(1), parsing a given file and comparing the
+# output to prerecorded results.
+test_case()
+{
+ local name="${1}"; shift
+ local descr="${1}"; shift
+
+ atf_test_case "${name}"
+ eval "${name}_head() { \
+ atf_set descr '${descr}'; \
+ atf_set use.fs true; \
+ }"
+ eval "${name}_body() { \
+ run_and_check '${name}'; \
+ }"
+}
+
+test_case comment "Checks comments (PR/17732, PR/30536)"
+test_case cond1 "Checks conditionals (PR/24420)"
+test_case dotwait "Checks .WAIT"
+test_case export "Checks .export of provided variables"
+test_case export_all "Checks .export of all global variables"
+test_case moderrs "Checks correct handling of errors in modifiers usage"
+test_case modmatch "Checks modifier :M"
+test_case modmisc "Checks modifiers specified in variables"
+test_case modorder "Checks modifier :Ox"
+test_case modts "Checks modifier :ts"
+test_case modword "Checks modifier :[]"
+test_case posix "Checks conformance to POSIX"
+test_case qequals "Checks operator ?="
+test_case ternary "Checks ternary modifier"
+test_case varcmd "Checks behavior of command line variable assignments"
+
+atf_init_test_cases()
+{
+ atf_add_test_case comment
+ atf_add_test_case cond1
+ atf_add_test_case dotwait
+ atf_add_test_case export
+ atf_add_test_case export_all
+ atf_add_test_case moderrs
+ atf_add_test_case modmatch
+ atf_add_test_case modmisc
+ atf_add_test_case modorder
+ atf_add_test_case modts
+ atf_add_test_case modword
+ atf_add_test_case posix
+ atf_add_test_case qequals
+ atf_add_test_case ternary
+ atf_add_test_case varcmd
+}