21606619 Yet even more Userland components should hook up their system tests
authorRich Burridge <rich.burridge@oracle.com>
Mon, 10 Aug 2015 14:28:29 -0700
changeset 4762 4d5e4d2893b8
parent 4761 0904e6cd33e4
child 4763 2f2b5e6d6c17
21606619 Yet even more Userland components should hook up their system tests
components/erlang/Makefile
components/libconfuse/Makefile
components/libconfuse/test/results-all.master
components/libdnet/Makefile
components/libdnet/test/results-all.master
components/lua/Makefile
components/xz/Makefile
components/xz/patches/system-test.patch
--- a/components/erlang/Makefile	Mon Aug 10 12:52:35 2015 -0700
+++ b/components/erlang/Makefile	Mon Aug 10 14:28:29 2015 -0700
@@ -108,6 +108,9 @@
 	'-e "s|/ldisk/tests|XXX_UID_XXX|g" ' \
 	'-e "/XXX_UID_XXX/d" '
 
+COMPONENT_SYSTEM_TEST_ENV +=		ERL_TOP=$(BUILD_DIR_64)
+COMPONENT_SYSTEM_TEST_TARGETS =	tests
+
 ASLR_MODE = $(ASLR_ENABLE)
 
 configure:	$(CONFIGURE_64)
@@ -122,7 +125,7 @@
 
 test:	$(TEST_64)
 
-system-test:    $(SYSTEM_TESTS_NOT_IMPLEMENTED)
+system-test:	configure $(SYSTEM_TEST_64)
 
 REQUIRED_PACKAGES += library/ncurses
 REQUIRED_PACKAGES += library/security/openssl
--- a/components/libconfuse/Makefile	Mon Aug 10 12:52:35 2015 -0700
+++ b/components/libconfuse/Makefile	Mon Aug 10 14:28:29 2015 -0700
@@ -46,27 +46,40 @@
 # This is really only needed to get the test target to pass.
 COMPONENT_PRE_CONFIGURE_ACTION = ($(CLONEY) $(SOURCE_DIR) $(@D))
 
-# Master test results are the same for all versions of Python, so override
-# here, rather than create multiple identical master files.
+COMPONENT_TEST_DIR =		$(@D)/tests
+
+COMPONENT_SYSTEM_TEST_DIR =	$(@D)/tests
+
 COMPONENT_TEST_MASTER = $(COMPONENT_TEST_RESULTS_DIR)/results-all.master
 
 # The additional libconfuse specific set of transforms to be applied to the
 # test results to try to normalize them.
 COMPONENT_TEST_TRANSFORMS += \
+	'-e "s|^make.*: Leaving directory.*$$|XXX_CC_XXX|g" ' \
+	'-e "s|^make.*: Entering directory.*$$|XXX_CC_XXX|g" ' \
+	'-e "s|^make.*: Nothing to be.*$$|XXX_CC_XXX|g" ' \
 	'-e "s|^.*$(CC).*$$|XXX_CC_XXX|g" ' \
 	'-e "/^XXX_CC_XXX$$/d" '
 
+# Needed to build the test programs.
+COMPONENT_PRE_SYSTEM_TEST_ACTION += \
+	(cd $(@D)/src ; $(GMAKE) libconfuse.la )
+
+# Get correct libconfuse.so.0 from the proto area.
+TEST_LIBPATH.32 =       $(PROTOUSRLIBDIR)
+TEST_LIBPATH.64 =       $(PROTOUSRLIBDIR64)
+COMPONENT_TEST_ENV +=   LD_LIBRARY_PATH=$(TEST_LIBPATH.$(BITS))
+
 ASLR_MODE = $(ASLR_ENABLE)
 
-# common targets
 configure:	$(CONFIGURE_32_and_64)
 
 build:		$(BUILD_32_and_64)
 
 install:	$(INSTALL_32_and_64)
 
-test:		$(TEST_32_and_64)
+test:		install $(TEST_32_and_64)
 
-system-test:    $(SYSTEM_TESTS_NOT_IMPLEMENTED)
+system-test:    configure $(SYSTEM_TEST_32_and_64)
 
 REQUIRED_PACKAGES += system/library
--- a/components/libconfuse/test/results-all.master	Mon Aug 10 12:52:35 2015 -0700
+++ b/components/libconfuse/test/results-all.master	Mon Aug 10 14:28:29 2015 -0700
@@ -1,24 +1,4 @@
-make[1]: Entering directory `$(@D)'
-Making check in m4
-make[2]: Entering directory `$(@D)/m4'
-make[2]: Nothing to be done for `check'.
-make[2]: Leaving directory `$(@D)/m4'
-Making check in po
-make[2]: Entering directory `$(@D)/po'
-make[2]: Nothing to be done for `check'.
-make[2]: Leaving directory `$(@D)/po'
-Making check in src
-make[2]: Entering directory `$(@D)/src'
-make[2]: Nothing to be done for `check'.
-make[2]: Leaving directory `$(@D)/src'
-Making check in examples
-make[2]: Entering directory `$(@D)/examples'
-make[2]: Nothing to be done for `check'.
-make[2]: Leaving directory `$(@D)/examples'
-Making check in tests
-make[2]: Entering directory `$(@D)/tests'
 /usr/gnu/bin/make  suite_single suite_dup suite_func suite_list suite_validate list_plus_syntax section_title_dupes single_title_sections quote_before_print
-make[3]: Entering directory `$(@D)/tests'
 source='suite_single.c' object='suite_single.o' libtool=no \
 depfile='.deps/suite_single.Po' tmpdepfile='.deps/suite_single.TPo' \
 depmode=none /bin/bash $(SOURCE_DIR)/support/depcomp \
@@ -56,9 +36,7 @@
 depfile='.deps/quote_before_print.Po' tmpdepfile='.deps/quote_before_print.TPo' \
 depmode=none /bin/bash $(SOURCE_DIR)/support/depcomp \
 creating quote_before_print
-make[3]: Leaving directory `$(@D)/tests'
 /usr/gnu/bin/make  check-TESTS
-make[3]: Entering directory `$(@D)/tests'
 [buf]:1: invalid boolean value for option 'bool'
 [buf]:1: premature end of file
 [buf]:1: no such option 'option'
@@ -84,12 +62,3 @@
 ==================
 All 9 tests passed
 ==================
-make[3]: Leaving directory `$(@D)/tests'
-make[2]: Leaving directory `$(@D)/tests'
-Making check in doc
-make[2]: Entering directory `$(@D)/doc'
-make[2]: Nothing to be done for `check'.
-make[2]: Leaving directory `$(@D)/doc'
-make[2]: Entering directory `$(@D)'
-make[2]: Leaving directory `$(@D)'
-make[1]: Leaving directory `$(@D)'
--- a/components/libdnet/Makefile	Mon Aug 10 12:52:35 2015 -0700
+++ b/components/libdnet/Makefile	Mon Aug 10 14:28:29 2015 -0700
@@ -77,6 +77,25 @@
 
 COMPONENT_TEST_MASTER = $(COMPONENT_TEST_RESULTS_DIR)/results-all.master
 
+COMPONENT_TEST_TRANSFORMS += \
+	'-n ' \
+	'-e "/TOTAL/p" ' \
+	'-e "/SKIP/p" ' \
+	'-e "/PASS/p" ' \
+	'-e "/FAIL/p" ' \
+	'-e "/ERROR/p" '
+
+# Needed to build the test programs.
+COMPONENT_PRE_SYSTEM_TEST_ACTION += \
+	(cd $(@D)/src ; $(GMAKE) libdnet.la )
+
+COMPONENT_SYSTEM_TEST_DIR =	$(@D)/test/check
+
+# Get correct libdnet.so.1 from the proto area.
+TEST_LIBPATH.32 =	$(PROTOUSRLIBDIR)
+TEST_LIBPATH.64 =	$(PROTOUSRLIBDIR64)
+COMPONENT_TEST_ENV +=	LD_LIBRARY_PATH=$(TEST_LIBPATH.$(BITS))
+
 ASLR_MODE = $(ASLR_ENABLE)
 
 configure:	$(CONFIGURE_32_and_64)
@@ -85,9 +104,9 @@
 
 install:	$(INSTALL_32_and_64)
 
-test:		$(TEST_32_and_64)
+test:		install $(TEST_32_and_64)
 
-system-test:    $(SYSTEM_TESTS_NOT_IMPLEMENTED)
+system-test:    configure $(SYSTEM_TEST_32_and_64)
 
 REQUIRED_PACKAGES += developer/test/check
 REQUIRED_PACKAGES += runtime/python-27
--- a/components/libdnet/test/results-all.master	Mon Aug 10 12:52:35 2015 -0700
+++ b/components/libdnet/test/results-all.master	Mon Aug 10 14:28:29 2015 -0700
@@ -1,7 +1,3 @@
-make[1]: Entering directory `$(@D)/test/check'
-/usr/gnu/bin/make  check-TESTS
-make[2]: Entering directory `$(@D)/test/check'
-make[3]: Entering directory `$(@D)/test/check'
 FAIL: check_addr
 FAIL: check_arp
 PASS: check_blob
@@ -11,9 +7,6 @@
 PASS: check_intf
 PASS: check_rand
 FAIL: check_route
-============================================================================
-Testsuite summary for 
-============================================================================
 # TOTAL: 9
 # PASS:  4
 # SKIP:  0
@@ -21,12 +14,3 @@
 # FAIL:  5
 # XPASS: 0
 # ERROR: 0
-============================================================================
-See test/check/test-suite.log
-============================================================================
-make[3]: *** [test-suite.log] Error 1
-make[3]: Leaving directory `$(@D)/test/check'
-make[2]: *** [check-TESTS] Error 2
-make[2]: Leaving directory `$(@D)/test/check'
-make[1]: *** [check-am] Error 2
-make[1]: Leaving directory `$(@D)/test/check'
--- a/components/lua/Makefile	Mon Aug 10 12:52:35 2015 -0700
+++ b/components/lua/Makefile	Mon Aug 10 14:28:29 2015 -0700
@@ -95,14 +95,27 @@
 	'-e "s|\(total time:\).*|\1|" ' \
 	'-e "s|\(test done on\).*|\1|" '
 
-# common targets
+# Unpack and patch the tests once, and work around CR #19661394, which is
+# causing the lua self-tests to fail.
+COMPONENT_PRE_SYSTEM_TEST_ACTION = \
+	(if ! test -d $(LUA_TESTS) ; then \
+		$(UNPACK) $(UNPACK_ARGS) $(LUA_TESTS).tar.gz ; \
+		(cd $(LUA_TESTS); $(GPATCH) $(GPATCH_FLAGS) \
+			<$(COMPONENT_DIR)/files/fix-tests.patch) ; \
+	fi)
+
+COMPONENT_SYSTEM_TEST_DIR =	$(LUA_TESTS)
+COMPONENT_SYSTEM_TEST_CMD =	/usr/bin/lua
+COMPONENT_SYSTEM_TEST_ARGS =	-e"_U=true"
+COMPONENT_SYSTEM_TEST_TARGETS =	all.lua
+
 build:		$(BUILD_32_and_64)
 
 install:	$(INSTALL_32_and_64) $(BUILD_DIR)/lua-64.pc
 
 test: 		$(TEST_32_and_64)
 
-system-test:    $(SYSTEM_TESTS_NOT_IMPLEMENTED)
+system-test:	$(SYSTEM_TEST_32_and_64)
 
 REQUIRED_PACKAGES += system/library
 REQUIRED_PACKAGES += system/library/math
--- a/components/xz/Makefile	Mon Aug 10 12:52:35 2015 -0700
+++ b/components/xz/Makefile	Mon Aug 10 14:28:29 2015 -0700
@@ -55,9 +55,18 @@
 	'-e "s|^.*DEPDIR=.deps.*$$|XXX_CC_XXX|g" ' \
 	'-e "/^XXX_CC_XXX$$/d" '
 
+# Needed to build the test programs.
+COMPONENT_PRE_SYSTEM_TEST_ACTION += \
+	(cd $(@D)/src/liblzma ; $(GMAKE) liblzma.la )
+
+COMPONENT_SYSTEM_TEST_DIR =	$(@D)/tests
+COMPONENT_SYSTEM_TEST_ENV +=	XZ_SCRIPT=/usr/bin/xz
+COMPONENT_SYSTEM_TEST_ENV +=	XZDEC_SCRIPT=/usr/bin/xzdec
+COMPONENT_SYSTEM_TEST_ENV +=	XZDIFF_SCRIPT=/usr/bin/xzdiff
+COMPONENT_SYSTEM_TEST_ENV +=	XZGREP_SCRIPT=/usr/bin/xzgrep
+
 ASLR_MODE = $(ASLR_ENABLE)
 
-# common targets
 configure:	$(CONFIGURE_32_and_64)
 
 build:		$(BUILD_32_and_64)
@@ -68,7 +77,7 @@
 
 test:		$(TEST_32_and_64)
 
-system-test:    $(SYSTEM_TESTS_NOT_IMPLEMENTED)
+system-test:    configure $(SYSTEM_TEST_32_and_64)
 
 REQUIRED_PACKAGES += shell/bash
 REQUIRED_PACKAGES += system/library
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/xz/patches/system-test.patch	Mon Aug 10 14:28:29 2015 -0700
@@ -0,0 +1,84 @@
+Patches to allow us to specify alternate locations for various xz scripts
+when running tests
+
+This patch should be sent upstream.
+
+--- xz-5.2.1/tests/test_compress.sh.orig	2015-08-10 05:34:11.999000878 -0700
++++ xz-5.2.1/tests/test_compress.sh	2015-08-10 05:49:30.044238292 -0700
[email protected]@ -9,13 +9,15 @@
+ #
+ ###############################################################################
+ 
+-# If xz wasn't built, this test is skipped.
+-if test -x ../src/xz/xz ; then
+-	:
+-else
++# If the xz script isn't found, this test is skipped.
++XZ_PROG="${XZ_SCRIPT:-../src/xz/xz}"
++XZDEC_PROG="${XZDEC_SCRIPT:-../src/xzdec/xzdec}"
++
++for i in XZ_PROG XZDEC_PROG; do
++	eval test -x "\$$i" && continue
+ 	(exit 77)
+ 	exit 77
+-fi
++done
+ 
+ # Find out if our shell supports functions.
+ eval 'unset foo ; foo() { return 42; } ; foo'
[email protected]@ -74,10 +76,10 @@
+ 	echo . | tr -d '\n\r'
+ }
+ 
+-XZ="../src/xz/xz --memlimit-compress=48MiB --memlimit-decompress=5MiB \
++XZ="$XZ_PROG --memlimit-compress=48MiB --memlimit-decompress=5MiB \
+ 		--no-adjust --threads=1 --check=crc64"
+-XZDEC="../src/xzdec/xzdec" # No memory usage limiter available
+-test -x ../src/xzdec/xzdec || XZDEC=
++XZDEC="$XZDEC_PROG" # No memory usage limiter available
++test -x $XZDEC_PROG || XZDEC=
+ 
+ # Create the required input files.
+ if ./create_compress_files ; then
+--- xz-5.2.1/tests/test_files.sh.orig	2015-08-10 05:33:23.741544673 -0700
++++ xz-5.2.1/tests/test_files.sh	2015-08-10 05:46:25.045018366 -0700
[email protected]@ -9,15 +9,15 @@
+ #
+ ###############################################################################
+ 
+-# If both xz and xzdec were not build, skip this test.
+-XZ=../src/xz/xz
+-XZDEC=../src/xzdec/xzdec
+-test -x "$XZ" || XZ=
+-test -x "$XZDEC" || XZDEC=
+-if test -z "$XZ$XZDEC"; then
++# If both xz and xzdec are not found, skip this test.
++XZ="${XZ_SCRIPT:-../src/xz/xz}"
++XZDEC="${XZDEC_SCRIPT:-../src/xzdec/xzdec}"
++
++for i in XZ XZDEC; do
++	eval test -x "\$$i" && continue
+ 	(exit 77)
+ 	exit 77
+-fi
++done
+ 
+ for I in "$srcdir"/files/good-*.xz
+ do
+--- xz-5.2.1/tests/test_scripts.sh.orig	2015-08-10 05:35:11.436118619 -0700
++++ xz-5.2.1/tests/test_scripts.sh	2015-08-10 05:38:39.611332394 -0700
[email protected]@ -9,10 +9,10 @@
+ #
+ ###############################################################################
+ 
+-# If scripts weren't built, this test is skipped.
+-XZ=../src/xz/xz
+-XZDIFF=../src/scripts/xzdiff
+-XZGREP=../src/scripts/xzgrep
++# If scripts not found, this test is skipped.
++XZ="${XZ_SCRIPT:-../src/xz/xz}"
++XZDIFF="${XZDIFF_SCRIPT:-../src/scripts/xzdiff}"
++XZGREP="${XZGREP_SCRIPT:-../src/scripts/xzgrep}"
+ 
+ for i in XZ XZDIFF XZGREP; do
+ 	eval test -x "\$$i" && continue