19824924 Various Userland component test: Makefile targets should be standardized
authorRich Burridge <rich.burridge@oracle.com>
Tue, 21 Oct 2014 12:20:30 -0700
changeset 2164 b580bc10e31a
parent 2163 a23eea6de4af
child 2165 d1946b7b1894
19824924 Various Userland component test: Makefile targets should be standardized
components/bash/Makefile
components/conflict/Makefile
components/emacs/Makefile
components/gcc45/Makefile
components/ghostscript/Makefile
components/indent/Makefile
components/isc-dhcp/Makefile
components/jsl/Makefile
components/mercurial/Makefile
components/mpc/Makefile
components/ncurses/Makefile
components/net-snmp/Makefile
components/p7zip/Makefile
components/rabbitmq/Makefile
components/smp_utils/Makefile
components/stdcxx/Makefile
components/sudo/Makefile
components/text-utilities/Makefile
components/tomcat/Makefile
make-rules/ant.mk
make-rules/attpackagemake.mk
make-rules/configure.mk
make-rules/justmake.mk
make-rules/makemaker.mk
make-rules/setup.py.mk
make-rules/shared-macros.mk
--- a/components/bash/Makefile	Tue Oct 21 02:05:30 2014 -0700
+++ b/components/bash/Makefile	Tue Oct 21 12:20:30 2014 -0700
@@ -123,9 +123,9 @@
 CONFIGURE_OPTIONS  += 		--with-installed-readline=no	
 CONFIGURE_OPTIONS  +=		--infodir=$(CONFIGURE_INFODIR)
 
-TEST_ENV +=	-i
-TEST_ENV +=	$(TEST_PATH)
-TEST_ENV +=	$(TARGET_ENV)
+COMPONENT_TEST_DIR =		$(BUILD_DIR_64)
+COMPONENT_TEST_ENV =		- $(TEST_PATH)
+COMPONENT_TEST_TARGETS =	check > $(TEST_OUTPUT) 2>&1
 
 ASLR_MODE=$(ASLR_ENABLE)
 
@@ -137,9 +137,7 @@
 	    cp -Rp "en@boldquot" en_CA ; \
 	    cp -Rp "en@boldquot" en_GB )
 
-test:
-	( cd $(BUILD_DIR_64) ; \
-	    env - $(TEST_PATH) && $(GMAKE) check > $(TEST_OUTPUT) 2>&1 )
+test:	$(TEST_64)
 
 BUILD_PKG_DEPENDENCIES = $(BUILD_TOOLS)
 
--- a/components/conflict/Makefile	Tue Oct 21 02:05:30 2014 -0700
+++ b/components/conflict/Makefile	Tue Oct 21 12:20:30 2014 -0700
@@ -57,6 +57,10 @@
 CONFIGURE_OPTIONS = --prefix=$(CONFIGURE_PREFIX)
 CONFIGURE_OPTIONS += --mandir=$(CONFIGURE_MANDIR)
 
+COMPONENT_TEST_DIR =	$(BUILD_DIR_64)
+COMPONENT_TEST_CMD =	./run_test.sh
+COMPONENT_TEST_TARGETS =
+
 ASLR_MODE = $(ASLR_ENABLE)
 
 # common targets
@@ -64,8 +68,7 @@
 
 install:	$(INSTALL_64)
 
-test:		build
-	@cd $(BUILD_DIR_64); ./run_test.sh
+test:		$(TEST_64)
 
 BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
 
--- a/components/emacs/Makefile	Tue Oct 21 02:05:30 2014 -0700
+++ b/components/emacs/Makefile	Tue Oct 21 12:20:30 2014 -0700
@@ -179,8 +179,7 @@
 
 install:	$(BUILD_64) $(BUILD_DIR)/$(MACH64)-x/.installed 
 
-test:
-	@echo "no tests available"
+test:		$(NO_TESTS)
 
 BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
 
--- a/components/gcc45/Makefile	Tue Oct 21 02:05:30 2014 -0700
+++ b/components/gcc45/Makefile	Tue Oct 21 12:20:30 2014 -0700
@@ -88,20 +88,21 @@
 
 COMPONENT_BUILD_TARGETS=bootstrap
 
+# To ensure that all tests that are expected to pass actually
+# pass, we have to increase the stacksize limit to at least
+# 16384 Kb. Otherwise we'll get spurious failures in the test
+# harness (gcc.c-torture/compile/limits-exprparen.c and others).
+# With the soft stacksize limit set to 16384 we get very good
+# test results.
+COMPONENT_TEST_DIR =	$(BUILD_DIR_32)/gcc
+COMPONENT_TEST_CMD =	ulimit -Ss 16384 ; $(GMAKE)
+COMPONENT_TEST_ARGS =	-k -i
+
 build:		$(BUILD_32)
 
 install:	$(INSTALL_32) 
 
-# To ensure that all tests that are expected to pass actually
-# pass, we have to increase the stacksize limit to at least 
-# 16384 Kb. Otherwise we'll get spurious failures in the test
-# harness (gcc.c-torture/compile/limits-exprparen.c and others).
-# With the soft stacksize limit set to 16384 we get very good
-# test results.
-test:
-	( cd $(BUILD_DIR_32)/gcc ; \
-	    ulimit -Ss 16384 ; \
-	    $(GMAKE) -k -i check )
+test:		$(TEST_32)
 
 BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
 
--- a/components/ghostscript/Makefile	Tue Oct 21 02:05:30 2014 -0700
+++ b/components/ghostscript/Makefile	Tue Oct 21 12:20:30 2014 -0700
@@ -108,8 +108,6 @@
 # install gs and ijs
 install: $(VARIANTS:%=%/.installed)
 
-# empty test target
-test:
-	@echo "no tests available"
+test:	$(NO_TESTS)
 
 include ../../make-rules/depend.mk
--- a/components/indent/Makefile	Tue Oct 21 02:05:30 2014 -0700
+++ b/components/indent/Makefile	Tue Oct 21 12:20:30 2014 -0700
@@ -46,6 +46,11 @@
 CONFIGURE_OPTIONS +=	CFLAGS="$(CFLAGS)"
 CONFIGURE_OPTIONS +=	--infodir=$(CONFIGURE_INFODIR)
 
+COMPONENT_TEST_DIR =		$(@D)/regression
+# Need to put /usr/gnu/bin at the front of $PATH for GNU diff.
+COMPONENT_TEST_ENV +=		PATH=$(GNUBIN):/usr/bin
+COMPONENT_TEST_TARGETS =	test
+
 ASLR_MODE = $(ASLR_ENABLE)
 
 # common targets
@@ -53,9 +58,7 @@
 
 install:	$(INSTALL_64)
 
-# Need to put /usr/gnu/bin at the front of $PATH for GNU diff.
-test:		install
-	@cd $(BUILD_DIR_64)/regression; PATH=/usr/gnu/bin:/usr/bin $(MAKE) test
+test:		install $(TEST_64)
 
 BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
 
--- a/components/isc-dhcp/Makefile	Tue Oct 21 02:05:30 2014 -0700
+++ b/components/isc-dhcp/Makefile	Tue Oct 21 12:20:30 2014 -0700
@@ -55,14 +55,15 @@
 CPPFLAGS  +=	        -DNOMINUM
 CONFIGURE_OPTIONS  +=   CPPFLAGS="$(CPPFLAGS)"
 
+COMPONENT_TEST_DIR =	$(@D)
+
 build:		$(BUILD_32)
 
 install:	build $(INSTALL_32) $(PROTO_DIR)/dhcpd.leases
 
 BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
 
-test:	build
-	@cd $(BUILD_DIR_32); $(MAKE) check
+test:		$(TEST_32)
 
 $(PROTO_DIR)/dhcpd.leases:	$(INSTALL_32)
 	$(TOUCH) $@
--- a/components/jsl/Makefile	Tue Oct 21 02:05:30 2014 -0700
+++ b/components/jsl/Makefile	Tue Oct 21 12:20:30 2014 -0700
@@ -54,6 +54,10 @@
 COMPONENT_INSTALL_ARGS += INSTALL="$(INSTALL)"
 COMPONENT_INSTALL_ARGS += MKDIR="$(MKDIR)"
 
+COMPONENT_TEST_DIR =		$(COMPONENT_SRC)/tests
+COMPONENT_TEST_CMD =            $(PERL) ./run_tests.pl
+COMPONENT_TEST_TARGETS =        $(PROTOUSRBINDIR64)/jsl
+
 # Enable ASLR for this component
 ASLR_MODE = $(ASLR_ENABLE)
 
@@ -61,8 +65,7 @@
 
 install:	$(INSTALL_64)
 
-test:
-	cd $(COMPONENT_SRC)/tests; $(PERL) ./run_tests.pl $(PROTOUSRBINDIR64)/jsl
+test:		install $(TEST_64)
 
 BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
 
--- a/components/mercurial/Makefile	Tue Oct 21 02:05:30 2014 -0700
+++ b/components/mercurial/Makefile	Tue Oct 21 12:20:30 2014 -0700
@@ -51,6 +51,23 @@
 # file consistently gets the same timestamp.
 $(SOURCE_DIR)/.https_proxy.patched: GPATCH_FLAGS += -Z
 
+# Use bash in sh mode for the tests; using /bin/sh on Solaris hasn't always
+# worked, and using /bin/bash doesn't always work, either.  Also skip the
+# tests which try to check all the code in the userland gate.  And finally,
+# test the bits from the proto area, rather than rebuilding.  Given the way the
+# test suite works, the hg executable must be named "hg".
+COMPONENT_PRE_TEST_ACTION = \
+	(cd $(BUILD_DIR); rm -f sh; ln -s /bin/bash sh; \
+	echo "test-check-code-hg.t\ntest-module-imports.t" > blacklist); \
+	(cd $(PROTOUSRBINDIR); ln -s hg-$(PYTHON_VERSION) hg)
+
+COMPONENT_TEST_DIR =	$(COMPONENT_SRC)/tests
+COMPONENT_TEST_ENV =	PYTHONPATH=$(PROTO_DIR)/$(PYTHON_LIB) TERM=dumb
+COMPONENT_TEST_ARGS =	./run-tests.py \
+			--shell $(BUILD_DIR)/sh \
+			--with-hg $(PROTOUSRBINDIR)/hg \
+			--blacklist $(BUILD_DIR)/blacklist
+
 ASLR_MODE = $(ASLR_NOT_APPLICABLE)
 
 # Assuming you have docutils installed, update the manpages patch for a new
@@ -80,19 +97,7 @@
 
 install:	$(INSTALL_32)
 
-# Use bash in sh mode for the tests; using /bin/sh on Solaris hasn't always
-# worked, and using /bin/bash doesn't always work, either.  Also skip the
-# tests which try to check all the code in the userland gate.  And finally,
-# test the bits from the proto area, rather than rebuilding.  Given the way the
-# test suite works, the hg executable must be named "hg".
-test:	$(INSTALL_32)
-	(cd $(BUILD_DIR); rm -f sh; ln -s /bin/bash sh; \
-	 echo "test-check-code-hg.t\ntest-module-imports.t" > blacklist)
-	(cd $(PROTOUSRBINDIR); ln -s hg-$(PYTHON_VERSION) hg)
-	(cd $(COMPONENT_SRC)/tests ; \
-	 PYTHONPATH=$(PROTO_DIR)/$(PYTHON_LIB) TERM=dumb \
-	 $(PYTHON) ./run-tests.py --shell $(BUILD_DIR)/sh \
-	 --with-hg $(PROTOUSRBINDIR)/hg --blacklist $(BUILD_DIR)/blacklist)
+test:		install $(TEST_32)
 
 BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
 
--- a/components/mpc/Makefile	Tue Oct 21 02:05:30 2014 -0700
+++ b/components/mpc/Makefile	Tue Oct 21 12:20:30 2014 -0700
@@ -52,6 +52,8 @@
 
 include ../../make-rules/shared-targets.mk
 
+COMPONENT_TEST_DIR =		$(BUILD_DIR)/$(MACH$(BITS))/tests
+
 ASLR_MODE = $(ASLR_NOT_APPLICABLE)
 
 # common targets
@@ -60,10 +62,8 @@
 
 install:	$(INSTALL_32_and_64)	
 
-test: install
-		@cd $(BUILD_DIR_32)/tests; $(MAKE) check
-		@cd $(BUILD_DIR_64)/tests; $(MAKE) check
- 
+test:		install $(TEST_32_and_64)
+
 BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
 
 include ../../make-rules/depend.mk
--- a/components/ncurses/Makefile	Tue Oct 21 02:05:30 2014 -0700
+++ b/components/ncurses/Makefile	Tue Oct 21 12:20:30 2014 -0700
@@ -69,6 +69,9 @@
 	$(CP) /usr/share/lib/terminfo/s/sun-color \
 	$(PROTO_DIR)$(GNUSHARE)/terminfo/s/
 
+COMPONENT_TEST_DIR =		$(BUILD_DIR)/$(MACH$(BITS))/test
+COMPONENT_TEST_TARGETS =
+
 ASLR_MODE = $(ASLR_ENABLE)
 
 # common targets
@@ -76,9 +79,7 @@
 
 install:        $(INSTALL_32_and_64)
 
-test:           $(BUILD_32_and_64)
-		(cd $(BUILD_DIR)/$(MACH32)/test; $(GMAKE))
-		(cd $(BUILD_DIR)/$(MACH64)/test; $(GMAKE))
+test:           $(TEST_32_and_64)
 
 BUILD_PKG_DEPENDENCIES =        $(BUILD_TOOLS)
 
--- a/components/net-snmp/Makefile	Tue Oct 21 02:05:30 2014 -0700
+++ b/components/net-snmp/Makefile	Tue Oct 21 12:20:30 2014 -0700
@@ -104,6 +104,10 @@
 CCSMAKE_ARGS =	CC="$(CC)" CFGPREFIX=/usr CFGLIB64=/usr/lib/$(MACH64)
 CCSMAKE_ARGS +=	CFGLIB=/usr/lib ARCH=$(ARCH) ROOT=$(PROTO_DIR)
 
+COMPONENT_TEST_DIR =		$(COMPONENT_DIR)
+COMPONENT_TEST_CMD =		$(KSH93)
+COMPONENT_TEST_TARGETS =	./run-tests $(BUILD_DIR) $(MACH32) $(MACH64)
+
 $(BUILD_32): COMPONENT_POST_BUILD_ACTION= \
 	(cd $(BUILD_DIR)/$(MACH32)/sun ; ls agent; $(CCSMAKE) -e $(CCSMAKE_ARGS))
 
@@ -131,8 +135,7 @@
 
 install:	build $(INSTALL_32_and_64)
 
-test:	$(BUILD_32)
-	$(KSH93) ./run-tests $(BUILD_DIR) $(MACH32) $(MACH64)
+test:	$(TEST_32_and_64)
 
 # build the docs
 $(BUILD_DIR_32)/.docs:
--- a/components/p7zip/Makefile	Tue Oct 21 02:05:30 2014 -0700
+++ b/components/p7zip/Makefile	Tue Oct 21 12:20:30 2014 -0700
@@ -47,6 +47,10 @@
 # the tests fail horribly with -Bdirect
 LD_B_DIRECT=
 
+COMPONENT_TEST_DIR =		$(@D)
+COMPONENT_TEST_ENV =		P7ZIP_HOME_DIR=$(BUILD_DIR)/$(MACH$(BITS))/bin
+COMPONENT_TEST_TARGETS =	test test_7z test_7zr
+
 COMPONENT_PREP_ACTION = (cd $(@D); cp ../makefile.solaris makefile.machine)
 COMPONENT_BUILD_TARGETS = all3
 COMPONENT_INSTALL_ARGS += DEST_HOME=/usr DEST_DIR=$(PROTO_DIR)
@@ -76,11 +80,7 @@
 COMPONENT_POST_INSTALL_ACTION += $(GSED) -i -e 's/\r//' $(PROTO_DIR)/usr/man/man1/7zr.1
 
 # build does this always
-test:	$(BUILD_64)
-	cd $(BUILD_DIR_64) && $(MAKE) -e test P7ZIP_HOME_DIR=$(BUILD_DIR_64)/bin
-	cd $(BUILD_DIR_64) && $(MAKE) -e test_7z P7ZIP_HOME_DIR=$(BUILD_DIR_64)/bin
-	cd $(BUILD_DIR_64) && $(MAKE) -e test_7zr P7ZIP_HOME_DIR=$(BUILD_DIR_64)/bin
-
+test:	$(TEST_64)
 
 BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
 
--- a/components/rabbitmq/Makefile	Tue Oct 21 02:05:30 2014 -0700
+++ b/components/rabbitmq/Makefile	Tue Oct 21 12:20:30 2014 -0700
@@ -47,17 +47,20 @@
 
 PKG_PROTO_DIRS += $(BUILD_DIR)/$(MACH32)
 
+# We delegate the running of the tests to a script because it's easier to find
+# and use unique free ports in a single process, and it's easier to make sure
+# that we don't leave any servers running if the tests themselves fail.
+COMPONENT_TEST_DIR =		$(COMPONENT_DIR)
+COMPONENT_TEST_CMD =		$(PYTHON)
+COMPONENT_TEST_TARGETS =	test.py $(TEST_32)
+
 # common targets
 build:		$(BUILD_32)
 
 # The install target in the rabbitmq makefile isn't useful to us.
 install:
 
-# We delegate the running of the tests to a script because it's easier to find
-# and use unique free ports in a single process, and it's easier to make sure
-# that we don't leave any servers running if the tests themselves fail.
-test:
-	$(PYTHON) test.py $(TEST_32)
+test:		$(TEST_32)
 
 BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
 
--- a/components/smp_utils/Makefile	Tue Oct 21 02:05:30 2014 -0700
+++ b/components/smp_utils/Makefile	Tue Oct 21 12:20:30 2014 -0700
@@ -71,15 +71,8 @@
 $(INSTALL_64):  COMPONENT_INSTALL_ARGS += INSTALL_LIB=$(PROTOUSRLIBDIR64)
 $(INSTALL_64):  COMPONENT_INSTALL_ARGS += INSTALL_SBIN=$(PROTOUSRBINDIR64)
 
-ASLR_MODE = $(ASLR_ENABLE)
-
-# common targets
-build:          $(BUILD_64)
-
-install:        $(INSTALL_64)
-
-test:           install
-		($(ENV) LD_LIBRARY_PATH=$(PROTOUSRLIBDIR64) \
+COMPONENT_TEST_ENV +=	LD_LIBRARY_PATH=$(PROTOUSRLIBDIR64)
+COMPONENT_TEST_CMD =	\
 		$(PROTOUSRDIR)/sbin/$(MACH64)/smp_conf_general -V; \
 		$(PROTOUSRDIR)/sbin/$(MACH64)/smp_conf_phy_event -V; \
 		$(PROTOUSRDIR)/sbin/$(MACH64)/smp_conf_route_info -V; \
@@ -108,7 +101,16 @@
 		$(PROTOUSRDIR)/sbin/$(MACH64)/smp_zone_activate -V; \
 		$(PROTOUSRDIR)/sbin/$(MACH64)/smp_zone_lock -V; \
 		$(PROTOUSRDIR)/sbin/$(MACH64)/smp_zone_unlock -V; \
-		$(PROTOUSRDIR)/sbin/$(MACH64)/smp_zoned_broadcast -V)
+		$(PROTOUSRDIR)/sbin/$(MACH64)/smp_zoned_broadcast -V
+
+ASLR_MODE = $(ASLR_ENABLE)
+
+# common targets
+build:          $(BUILD_64)
+
+install:        $(INSTALL_64)
+
+test:           install $(TEST_64)
 
 BUILD_PKG_DEPENDENCIES =        $(BUILD_TOOLS)
 
--- a/components/stdcxx/Makefile	Tue Oct 21 02:05:30 2014 -0700
+++ b/components/stdcxx/Makefile	Tue Oct 21 12:20:30 2014 -0700
@@ -231,6 +231,21 @@
 	$(GCP) -rpd $(COMPONENT_SRC) $(COMPONENT_SRC)-$(BITS) ; \
 	$(RM) -rf $(COMPONENT_SRC) )
 
+COMPONENT_PRE_TEST_ACTION = \
+        $(CP) -p $(COMPONENT_DIR)/Solaris/prep_build_area.sh \
+            $(COMPONENT_DIR)/ ; \
+        $(CHMOD) 0755 $(COMPONENT_DIR)/prep_build_area.sh ; \
+        $(SHELL) $(COMPONENT_DIR)/prep_build_area.sh $(CC_BITS) \
+            -builddir=$(BUILD_DIR)/$(MACH$(BITS)) \
+            -srcdir=$(TOPDIR)-$(BITS)
+COMPONENT_TEST_DIR = $(BUILD_DIR)/$(MACH$(BITS))/build/tests
+COMPONENT_TEST_CMD = \
+	$(CP) -p $(COMPONENT_DIR)/Solaris/run_tests.sh . ; \
+	$(CHMOD) 0755 run_tests.sh ; \
+	$(SHELL) ./run_tests.sh > \
+		$(COMPONENT_DIR)/runtests-$(MACH).out 2>&1
+COMPONENT_TEST_TARGETS =
+
 ASLR_MODE = $(ASLR_NOT_APPLICABLE)
 
 build: $(BUILD_32) $(BUILD_64)
@@ -254,28 +269,7 @@
 	    -mach64=$(MACH64) )
 	test -d $(TOPDIR) || $(MKDIR) $(TOPDIR)
 
-test:
-	test -d $(BUILD_DIR_32) || echo "$(BUILD_DIR_32) does not exist!"
-	test -d $(BUILD_DIR_64) || echo "$(BUILD_DIR_64) does not exist!"
-	$(CP) -p $(COMPONENT_DIR)/Solaris/prep_build_area.sh \
-	    $(COMPONENT_DIR)/
-	$(CHMOD) 0755 $(COMPONENT_DIR)/prep_build_area.sh
-	$(SHELL) $(COMPONENT_DIR)/prep_build_area.sh -m32 \
-	    -builddir=$(BUILD_DIR_32) \
-	    -srcdir=$(TOPDIR)-32
-	$(SHELL) $(COMPONENT_DIR)/prep_build_area.sh -m64 \
-	    -builddir=$(BUILD_DIR_64) \
-	    -srcdir=$(TOPDIR)-64
-	( cd $(BUILD_DIR_32)/build/tests ; \
-	    $(CP) -p $(COMPONENT_DIR)/Solaris/run_tests.sh . ; \
-	    $(CHMOD) 0755 run_tests.sh ; \
-	    $(SHELL) ./run_tests.sh > \
-		$(COMPONENT_DIR)/runtests-$(MACH).out 2>&1 )
-	( cd $(BUILD_DIR_64)/build/tests ; \
-	    $(CP) -p $(COMPONENT_DIR)/Solaris/run_tests.sh . ; \
-	    $(CHMOD) 0755 run_tests.sh ; \
-	    $(SHELL) ./run_tests.sh > \
-		$(COMPONENT_DIR)/runtests-$(MACH64).out 2>&1 )
+test:	$(TEST_32_and_64)
 
 clean::
 	$(RM) -r $(COMPONENT_SRC) $(COMPONENT_SRC)-32 $(COMPONENT_SRC)-64
--- a/components/sudo/Makefile	Tue Oct 21 02:05:30 2014 -0700
+++ b/components/sudo/Makefile	Tue Oct 21 12:20:30 2014 -0700
@@ -71,6 +71,23 @@
 COMPONENT_INSTALL_ARGS += bindir=$(USRBINDIR)
 COMPONENT_INSTALL_ARGS += sbindir=$(USRSBINDIR)
 
+# Since linking with libmd.so (which provides sha2 capability on
+# Solaris) is optional, we have a check here to make sure that the
+# configure script found it correctly.
+# http://www.sudo.ws/bugs/show_bug.cgi?id=641
+# Make sure that sudo is NOT built with its internal sha2 implementation
+# ... but is linked with libmd instead
+COMPONENT_TEST_ENV_CMD =
+COMPONENT_TEST_CMD = \
+	if [[ -n $$( elfdump -s "$(VISUDO)" | grep SHA256Init | grep -v UNDEF ) ]]; then \
+		echo "SHA256Init is not an undefined symbol in $(VISUDO)"; \
+		exit 1; \
+	fi; \
+	if [[ -z $$( elfdump -d "$(VISUDO)" | grep 'NEEDED .* libmd.so' ) ]]; then \
+		echo "$(VISUDO) is not linked against libmd.so"; \
+		exit 1; \
+	fi
+COMPONENT_TEST_TARGETS =
 
 # Enable aslr for this component
 ASLR_MODE = $(ASLR_ENABLE)
@@ -82,23 +99,7 @@
 install:	$(INSTALL_64)
 
 VISUDO=$(BUILD_DIR_64)/plugins/sudoers/visudo
-test:
-	# Since linking with libmd.so (which provides sha2 capability on
-	# Solaris) is optional, we have a check here to make sure that the
-	# configure script found it correctly.
-	# http://www.sudo.ws/bugs/show_bug.cgi?id=641
-
-	# Make sure that sudo is NOT built with it's internal sha2 implementation
-	if [[ -n $$( elfdump -s "$(VISUDO)" | grep SHA256Init | grep -v UNDEF ) ]]; then \
-		echo "SHA256Init is not an undefined symbol in $(VISUDO)"; \
-		exit 1; \
-	fi
-	# ... but is linked with libmd instead
-	if [[ -z $$( elfdump -d "$(VISUDO)" | grep 'NEEDED .* libmd.so' ) ]]; then \
-		echo "$(VISUDO) is not linked against libmd.so"; \
-		exit 1; \
-	fi
-
+test:		$(TEST_64)
 
 BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
 
--- a/components/text-utilities/Makefile	Tue Oct 21 02:05:30 2014 -0700
+++ b/components/text-utilities/Makefile	Tue Oct 21 12:20:30 2014 -0700
@@ -88,15 +88,16 @@
 	$(CP) $(COMPONENT_DIR)/files/hexdump-expected \
 		$(COMPONENT_SRC)/tests/expected/hexdump/empty-format; )
 
+COMPONENT_TEST_CMD =		./run.sh
+COMPONENT_TEST_ARGS =		--verbose
+COMPONENT_TEST_TARGETS =	colrm column hexdump tailf
+
 # common targets
 build:		$(BUILD_64)
 
 install:	$(INSTALL_64)
 
-test:		install
-	$(COMPONENT_PRE_TEST_ACTION)
-	(cd $(COMPONENT_TEST_DIR) ; $(ENV) $(COMPONENT_TEST_ENV) \
-		./run.sh --verbose colrm column hexdump tailf)
+test:		install $(TEST_64)
 
 BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
 
--- a/components/tomcat/Makefile	Tue Oct 21 02:05:30 2014 -0700
+++ b/components/tomcat/Makefile	Tue Oct 21 12:20:30 2014 -0700
@@ -64,15 +64,18 @@
 	(cd $(PROTO_DIR) ; $(RM) conf/CONF.tar.gz ; \
 	    gtar cfz conf/CONF.tar.gz conf/* )
 
+COMPONENT_TEST_DIR =		$(@D)/test
+COMPONENT_TEST_ARGS =		$(COMPONENT_BUILD_ARGS) \
+				-Djunit.home=/usr/share/lib/java
+COMPONENT_TEST_TARGETS =
+
 ASLR_MODE = $(ASLR_NOT_APPLICABLE)
 
 build:	$(BUILD_32)
 
 install: build
 
-test:  build
-	@cd $(BUILD_DIR_32)/test; $(ENV) $(COMPONENT_BUILD_ENV) \
-	    $(ANT) $(COMPONENT_BUILD_ARGS) -Djunit.home=/usr/share/lib/java
+test:	$(TEST_32)
 
 BUILD_PKG_DEPENDENCIES =	$(BUILD_TOOLS)
 
--- a/make-rules/ant.mk	Tue Oct 21 02:05:30 2014 -0700
+++ b/make-rules/ant.mk	Tue Oct 21 12:20:30 2014 -0700
@@ -18,7 +18,7 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 
 ANT=/usr/bin/ant
@@ -46,6 +46,17 @@
 	$(COMPONENT_POST_INSTALL_ACTION)
 	$(TOUCH) $@
 
+COMPONENT_TEST_ENV += JAVA_HOME="$(JAVA_HOME)"
+COMPONENT_TEST_CMD = $(ANT)
+# test the built source
+$(BUILD_DIR)/%/.tested: $(BUILD_DIR)/%/.built
+	$(COMPONENT_PRE_TEST_ACTION)
+	(cd $(COMPONENT_TEST_DIR) ; $(ENV) $(COMPONENT_TEST_ENV) \
+		$(COMPONENT_TEST_CMD) \
+			$(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS))
+	$(COMPONENT_POST_TEST_ACTION)
+	$(TOUCH) $@
+
 ifeq   ($(strip $(PARFAIT_BUILD)),yes)
 parfait: build
 else
--- a/make-rules/attpackagemake.mk	Tue Oct 21 02:05:30 2014 -0700
+++ b/make-rules/attpackagemake.mk	Tue Oct 21 12:20:30 2014 -0700
@@ -91,7 +91,8 @@
 # test the built source
 $(BUILD_DIR)/%/.tested: $(BUILD_DIR)/%/.built
 	$(COMPONENT_PRE_TEST_ACTION)
-	cd $(COMPONENT_TEST_DIR); $(ENV) $(COMPONENT_TEST_ENV) \
+	cd $(COMPONENT_TEST_DIR); $(COMPONENT_TEST_ENV_CMD) \
+		$(COMPONENT_TEST_ENV) \
 		bin/package test $(COMPONENT_TEST_TARGETS) \
 		$(COMPONENT_TEST_ARGS)
 	$(COMPONENT_POST_TEST_ACTION)
--- a/make-rules/configure.mk	Tue Oct 21 02:05:30 2014 -0700
+++ b/make-rules/configure.mk	Tue Oct 21 12:20:30 2014 -0700
@@ -137,7 +137,8 @@
 # test the built source
 $(BUILD_DIR)/%/.tested:	$(BUILD_DIR)/%/.built
 	$(COMPONENT_PRE_TEST_ACTION)
-	(cd $(COMPONENT_TEST_DIR) ; $(ENV) $(COMPONENT_TEST_ENV) \
+	(cd $(COMPONENT_TEST_DIR) ; $(COMPONENT_TEST_ENV_CMD) \
+		$(COMPONENT_TEST_ENV) \
 		$(COMPONENT_TEST_CMD) \
 			$(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS))
 	$(COMPONENT_POST_TEST_ACTION)
--- a/make-rules/justmake.mk	Tue Oct 21 02:05:30 2014 -0700
+++ b/make-rules/justmake.mk	Tue Oct 21 12:20:30 2014 -0700
@@ -71,7 +71,8 @@
 # test the built source
 $(BUILD_DIR)/%/.tested: $(BUILD_DIR)/%/.built
 	$(COMPONENT_PRE_TEST_ACTION)
-	(cd $(COMPONENT_TEST_DIR) ; $(ENV) $(COMPONENT_TEST_ENV) \
+	(cd $(COMPONENT_TEST_DIR) ; $(COMPONENT_TEST_ENV_CMD) \
+		$(COMPONENT_TEST_ENV) \
 		$(COMPONENT_TEST_CMD) \
 			$(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS))
 	$(COMPONENT_POST_TEST_ACTION)
--- a/make-rules/makemaker.mk	Tue Oct 21 02:05:30 2014 -0700
+++ b/make-rules/makemaker.mk	Tue Oct 21 12:20:30 2014 -0700
@@ -99,7 +99,8 @@
 COMPONENT_TEST_ENV +=	$(COMMON_PERL_ENV)
 $(BUILD_DIR)/%/.tested:	$(BUILD_DIR)/%/.built
 	$(COMPONENT_PRE_TEST_ACTION)
-	(cd $(COMPONENT_TEST_DIR) ; $(ENV) $(COMPONENT_TEST_ENV) \
+	(cd $(COMPONENT_TEST_DIR) ; $(COMPONENT_TEST_ENV_CMD) \
+		$(COMPONENT_TEST_ENV) \
 		$(COMPONENT_TEST_CMD) \
 			$(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS))
 	$(COMPONENT_POST_TEST_ACTION)
--- a/make-rules/setup.py.mk	Tue Oct 21 02:05:30 2014 -0700
+++ b/make-rules/setup.py.mk	Tue Oct 21 12:20:30 2014 -0700
@@ -118,7 +118,7 @@
 
 COMPONENT_TEST_DEP =	$(BUILD_DIR)/%/.installed
 COMPONENT_TEST_DIR =	$(COMPONENT_SRC)/test
-COMPONENT_TEST_ENV_CMD =	$(ENV) -
+COMPONENT_TEST_ENV_CMD =	$(ENV)
 COMPONENT_TEST_ENV +=	PYTHONPATH=$(PROTO_DIR)$(PYTHON_VENDOR_PACKAGES)
 COMPONENT_TEST_CMD =	$(PYTHON)
 COMPONENT_TEST_ARGS +=	./runtests.py
--- a/make-rules/shared-macros.mk	Tue Oct 21 02:05:30 2014 -0700
+++ b/make-rules/shared-macros.mk	Tue Oct 21 12:20:30 2014 -0700
@@ -230,6 +230,9 @@
 $(BUILD_DIR_32)/.tested:       BITS=32
 $(BUILD_DIR_64)/.tested:       BITS=64
 
+# set the default env command to use for test of the component
+COMPONENT_TEST_ENV_CMD =        $(ENV)
+
 # set the default command to use for test of the component
 COMPONENT_TEST_CMD =		$(GMAKE)