Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Nov 2013 17:52:29 -0800
From:      Garrett Cooper <yaneurabeya@gmail.com>
To:        Julio Merino <julio@meroh.net>
Cc:        "freebsd-testing@freebsd.org" <freebsd-testing@freebsd.org>, Rui Paulo <rpaulo@fnop.net>
Subject:   Re: Fixing the build with TESTS
Message-ID:  <CAGHfRMDLCKvTXpYUYQWZu64qpeqATkzwH_Yc7%2BZRXSh%2BxWyiNw@mail.gmail.com>
In-Reply-To: <CADyfeQW4GwhKgg4P8OWELnGWvDO8mvSjjo7Og3WMk2uxAGBGoA@mail.gmail.com>
References:  <CADyfeQW4GwhKgg4P8OWELnGWvDO8mvSjjo7Og3WMk2uxAGBGoA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On Tue, Nov 5, 2013 at 4:17 PM, Julio Merino <julio@meroh.net> wrote:
> Hello,
>
> The previous changes to enable the installation of tests broke the
> build and is the reason why Rui had to default the TESTS knob to 'no'.
> The reason for the breakage is the following:
>
> When buildworld starts by building the basic "bootstrap" libraries, it
> does a "make all" within various lib/* directories, including
> libcrypt. libcrypt had tests added to it, which means that "make all"
> recursed into the tests directory and attempted to build them. But, at
> that point, the atf libraries had not yet been built. I did not
> encounter this issue because I'm running builds with MK_CLEAN=no (yup,
> lesson learned).
>
> I think it's wrong for this stage of buildworld to attempt building
> tests at all. atf is just one of the many dependencies we'd encounter,
> and we should not try to build all dependencies upfront... because we
> cannot. (Just imagine when libc starts getting tests.)
>
> The fix-build-bootstrap.patch attached attempts to correct this by
> explicitly disabling the build of any tests during the initial build
> of the bootstrap components.  I'm not sure this patch is nice enough,
> although it follows the style of various other related knobs; if you
> have better ideas, please share.
>
> Additionally, we will encounter similar issues once we have tests that
> use C++ (which we will, if only because of libatf-c++'s tests), so we
> should also do what fix-build-atf-cxx.patch proposes.
>
> Thoughts?

I fixed this on my branch some time ago. See this patch for more
details (from http://lists.freebsd.org/pipermail/freebsd-toolchain/2013-April/000804.html
) : http://lists.freebsd.org/pipermail/freebsd-toolchain/attachments/20130424/c44daa61/attachment.obj
.

If you change the former patch to refer to lib/atf instead of
lib/atf/libatf-c, things will just work too is the order is properly
specified in lib/atf :).

I've attached entire up-to-date patch set, just for simplicity.

Thanks!
-Garrett

[-- Attachment #2 --]
--- share/mk/bsd.own.mk	2013-11-03 13:32:26.000000000 -0800
+++ share/mk/bsd.own.mk	2013-11-04 15:49:43.000000000 -0800
@@ -379,6 +383,14 @@
     TESTS \
     USB_GADGET_EXAMPLES
 
+# bsd.test.mk doesn't work with !bmake. Also don't build tests if NO_TESTS is
+# defined; this is for buildworld and elsewhere (ports potentially).
+.if !defined(NO_TESTS)
+__DEFAULT_NO_OPTIONS+=TESTS
+.else
+MK_TESTS:=	no
+.endif
+
 #
 # Default behaviour of some options depends on the architecture.  Unfortunately
 # this means that we have to test TARGET_ARCH (the buildworld case) as well

[-- Attachment #3 --]
--- /usr/src.svn/share/mk/bsd.subdir.mk	2013-11-03 13:32:26.000000000 -0800
+++ share/mk/bsd.subdir.mk	2013-11-04 15:49:43.000000000 -0800
@@ -43,6 +43,11 @@
 .endfor
 .endif
 
+.if ${MK_TESTS} != "no" && exists(${.CURDIR}/tests/Makefile)
+SUBDIR+= tests
+SUBDIR_TARGETS+= test
+.endif
+
 _SUBDIR: .USE .MAKE
 .if defined(SUBDIR) && !empty(SUBDIR) && !defined(NO_SUBDIR)
 	@${_+_}set -e; for entry in ${SUBDIR}; do \

[-- Attachment #4 --]
--- Makefile.inc1	2013-11-04 15:39:39.000000000 -0800
+++ Makefile.inc1	2013-11-04 15:51:03.000000000 -0800
@@ -91,6 +92,9 @@
 .if ${MK_OFED} != "no"
 SUBDIR+=contrib/ofed
 .endif
+.if ${MK_TESTS} != "no"
+SUBDIR+=tests
+.endif
 #
 # We must do etc/ last for install/distribute to work.
 #
@@ -246,7 +250,7 @@
 		SSP_CFLAGS= \
 		-DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \
 		-DNO_PIC -DNO_PROFILE -DNO_SHARED \
-		-DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
+		-DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD -DNO_TESTS
 
 # build-tools stage
 TMAKE=		MAKEOBJDIRPREFIX=${OBJTREE} \
@@ -256,12 +260,12 @@
 		BOOTSTRAPPING=${OSRELDATE} \
 		SSP_CFLAGS= \
 		-DNO_LINT \
-		-DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD
+		-DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD -DNO_TESTS
 
 # cross-tools stage
 XMAKE=		TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \
 		TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
-		-DWITHOUT_GDB
+		-DWITHOUT_GDB -DNO_TESTS
 
 # world stage
 WMAKEENV=	${CROSSENV} \
@@ -399,7 +403,8 @@
 		-DLIBRARIES_ONLY \
 		-DNO_CPU_CFLAGS \
 		-DNO_CTF \
-		-DNO_LINT
+		-DNO_LINT \
+		-DNO_TESTS
 
 LIB32WMAKE=	${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \
 		-DWITHOUT_MAN -DWITHOUT_INFO -DWITHOUT_HTML
@@ -563,7 +566,7 @@
 	@echo "--------------------------------------------------------------"
 	${_+_}cd ${.CURDIR}; \
 	    ${WMAKE} -DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
-	    -DWITHOUT_MAN -DNO_PROFILE libraries
+	    -DWITHOUT_MAN -DNO_PROFILE -DNO_TESTS libraries
 _depend:
 	@echo
 	@echo "--------------------------------------------------------------"
@@ -1487,7 +1478,7 @@
 		${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
 		${_kerberos5_lib_libroken} \
 		${_kerberos5_lib_libwind} \
-		${_lib_atf_libatf_c} \
+		${_lib_atf} \
 		lib/libbz2 ${_libcom_err} lib/libcrypt \
 		lib/libelf lib/libexpat \
 		${_lib_libgssapi} ${_lib_libipx} \
@@ -1502,7 +1493,7 @@
 		${_secure_lib_libssh} ${_secure_lib_libssl}
 
 .if ${MK_ATF} != "no"
-_lib_atf_libatf_c=	lib/atf/libatf-c
+_lib_atf=	lib/atf
 .endif
 
 .if ${MK_LIBTHR} != "no"
@@ -1866,7 +1859,7 @@
 
 NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT \
 	-DWITHOUT_MAN -DWITHOUT_NLS -DNO_PROFILE \
-	-DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_WARNS \
+	-DWITHOUT_KERBEROS -DWITHOUT_RESCUE -DNO_TESTS -DNO_WARNS \
 	TARGET=${XDEV} TARGET_ARCH=${XDEV_ARCH} \
 	CPUTYPE=${XDEV_CPUTYPE}
 

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGHfRMDLCKvTXpYUYQWZu64qpeqATkzwH_Yc7%2BZRXSh%2BxWyiNw>