20191770 allow exclusion of components for "gmake test" at the top level
authorApril Chin <april.chin@oracle.com>
Thu, 29 Jan 2015 08:52:10 -0800
changeset 3701 2c4a1656e035
parent 3700 86697167a9fb
child 3702 a4cf62e97757
20191770 allow exclusion of components for "gmake test" at the top level
components/Makefile
components/berkeleydb/Makefile
components/gutenprint/Makefile
doc/makefile-variables.txt
make-rules/shared-macros.mk
make-rules/skip-test.mk
--- a/components/Makefile	Wed Jan 28 15:28:28 2015 -0800
+++ b/components/Makefile	Thu Jan 29 08:52:10 2015 -0800
@@ -18,7 +18,7 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
 #
 
 include ../make-rules/shared-macros.mk
@@ -72,6 +72,8 @@
 # they have published all of their packages.
 publish:		MAKEFLAGS += DISABLE_IPS_CATALOG_AND_INDEX_UPDATES=yes
 
+# For cases in which a component test should be skipped at at the top level
+test:			MAKEFLAGS += TOP_LEVEL_TEST=yes
 
 .DEFAULT:	publish
 
--- a/components/berkeleydb/Makefile	Wed Jan 28 15:28:28 2015 -0800
+++ b/components/berkeleydb/Makefile	Thu Jan 29 08:52:10 2015 -0800
@@ -20,7 +20,7 @@
 #
 
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 #
 
 include ../../make-rules/shared-macros.mk
@@ -93,6 +93,8 @@
 
 COMPONENT_TEST_TARGETS = test
 
+$(SKIP_TEST_AT_TOP_LEVEL)
+
 # Enable ASLR for this component
 ASLR_MODE = $(ASLR_ENABLE)
 
--- a/components/gutenprint/Makefile	Wed Jan 28 15:28:28 2015 -0800
+++ b/components/gutenprint/Makefile	Thu Jan 29 08:52:10 2015 -0800
@@ -18,7 +18,7 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 #
 include ../../make-rules/shared-macros.mk
 
@@ -53,6 +53,8 @@
 
 COMPONENT_BUILD_TARGETS = all
 
+$(SKIP_TEST_AT_TOP_LEVEL)
+
 configure:	$(CONFIGURE_32)
 
 build:		$(BUILD_32)
--- a/doc/makefile-variables.txt	Wed Jan 28 15:28:28 2015 -0800
+++ b/doc/makefile-variables.txt	Thu Jan 29 08:52:10 2015 -0800
@@ -92,6 +92,11 @@
 but your component Makefile might have to += some more for specific transforms
 that need to be applied to the test output for just this component.
 
+* SKIP_TEST_AT_TOP_LEVEL inclusion of this variable in a component Makefile
+  will cause that component's tests to be skipped when running "gmake test"
+  at the top level.  It's often used for excluding long-running tests 
+  that may slow down comprehensive component testing.  
+
 * COMPONENT_POST_UNPACK_ACTION is for making minor alterations to the unpacked
   source directory before any patching has taken place.  It should almost never
   be used.
--- a/make-rules/shared-macros.mk	Wed Jan 28 15:28:28 2015 -0800
+++ b/make-rules/shared-macros.mk	Thu Jan 29 08:52:10 2015 -0800
@@ -18,7 +18,7 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
 #
 
 PATH=/usr/bin:/usr/gnu/bin
@@ -313,6 +313,16 @@
 TEST_64 =		$(BUILD_DIR_64)/.tested-and-compared
 endif
 TEST_32_and_64 =	$(TEST_32) $(TEST_64)
+
+# When running tests at the top level, skip those tests,
+# by redefining the above TEST_* targets,
+# when a component Makefile includes $(SKIP_TEST_AT_TOP_LEVEL).
+# It's done in separate skip-test.mk file, to allow inclusion of 
+# a multi-line ifdef statement which is evaluated at the component
+# Makefile level
+
+SKIP_TEST_AT_TOP_LEVEL = $(eval include $(WS_MAKE_RULES)/skip-test.mk)
+
 $(BUILD_DIR_32)/.tested:		BITS=32
 $(BUILD_DIR_64)/.tested:		BITS=64
 $(BUILD_DIR_32)/.tested-and-compared:	BITS=32
@@ -835,6 +845,11 @@
 test-nothing:
 	@echo "There are no tests available at this time."
 
+# There are tests, but we're skipping them.
+SKIP_TEST =	skip-test
+skip-test:
+	@echo "Skipping tests"
+
 # default behaviour for 'component-hook' target is to echo the component
 # name and version information, but more complex behaviour can be implemented
 # via command line setting of the COMPONENT_HOOK macro.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make-rules/skip-test.mk	Thu Jan 29 08:52:10 2015 -0800
@@ -0,0 +1,34 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+#
+
+# Put
+# $(SKIP_TEST_AT_TOP_LEVEL) 
+# in your component Makefile if you want that component to skip its
+# testing when "gmake test" is run at the top level.
+# We assume shared_macros.mk is already included.
+ifdef TOP_LEVEL_TEST
+TEST_32 = $(SKIP_TEST)
+TEST_64 = $(SKIP_TEST)
+TEST_32_and_64 = $(SKIP_TEST)
+TEST_NO_ARCH = $(SKIP_TEST)
+endif