Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Jan 2014 18:34:02 -0500
From:      Julio Merino <julio@meroh.net>
To:        freebsd-testing@freebsd.org
Cc:        sjg@freebsd.org
Subject:   Fixing installation of Kyuafiles
Message-ID:  <20140109233402.GA8193@fbair.virtual.network>

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

--/04w6evG8XlLl3ft
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hello,

The bin/sh and bin/test tests are broken because they cannot be run as root,
yet the testing machines are currently running stuff as root.  This is easy
to fix by adding a require_user="unprivileged" property to the tests.

I was going to fix this by adding manually-crafted Kyuafile files that do
the above in bin/sh/tests/ and bin/test/tests/ and setting KYUAFILE=yes in
the corresponding Makefile files... but unfortunately that does not work
with NO_CLEAN builds.

The problem is that bsd.test.mk generates Kyuafile files in the obj directory
and setting KYUAFILE=yes means that make will _still_ see the Kyuafile in the
obj directory and not the one that just appeared in src.

Does the attached patch seem reasonable to prevent this in the future?

The patch does not fix current build trees with NO_CLEAN, but because
WITH_TESTS is not yet the default I don't think it's a big deal.

Thank you.

--/04w6evG8XlLl3ft
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="kyuafiles.diff"

Allow tests to provide a Kyuafile when they relied on auto-generation.

When generating a Kyuafile in the KYUAFILE=auto case, use a filename
that is unlikely to clash with the filename used by explicitly-provided
Kyuafiles.

This allows a Makefile to set KYUAFILE=yes and provide a Kyuafile in
the same directory when such Makefile was previously relying on
KYUAFILE=auto.

Fixes issues with new Kyuafiles not being picked up in NO_CLEAN builds.

Index: UPDATING
===================================================================
--- UPDATING	(revision 260496)
+++ UPDATING	(working copy)
@@ -31,6 +31,14 @@
 	disable the most expensive debugging functionality run
 	"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
+20140109:
+	If a Makefile in a tests/ directory was auto-generating a Kyuafile
+	instead of providing an explicit one, this would prevent such
+	Makefile from providing its own Kyuafile in the future during
+	NO_CLEAN builds.  This has been fixed in the Makefiles but manual
+	intervention is needed to clean an objdir if you use NO_CLEAN:
+	  # find /usr/obj -name Kyuafile | xargs rm -f
+
 20131213:
 	The behavior of gss_pseudo_random() for the krb5 mechanism
 	has changed, for applications requesting a longer random string
Index: share/mk/bsd.test.mk
===================================================================
--- share/mk/bsd.test.mk	(revision 260496)
+++ share/mk/bsd.test.mk	(working copy)
@@ -79,14 +79,17 @@
 PROG_VARS+= BINDIR
 PROGS_TARGETS+= install
 
-.if ${KYUAFILE:tl} != "no"
+.if ${KYUAFILE:tl} == "yes"
 FILES+=	Kyuafile
 FILESDIR_Kyuafile= ${TESTSDIR}
+.elif ${KYUAFILE:tl} == "auto"
+FILES+=	Kyuafile.auto
+FILESDIR_Kyuafile.auto= ${TESTSDIR}
+FILESNAME_Kyuafile.auto= Kyuafile
 
-.if ${KYUAFILE:tl} == "auto"
-CLEANFILES+= Kyuafile Kyuafile.tmp
+CLEANFILES+= Kyuafile.auto Kyuafile.auto.tmp
 
-Kyuafile: Makefile
+Kyuafile.auto: Makefile
 	@{ \
 	    echo '-- Automatically generated by bsd.test.mk.'; \
 	    echo; \
@@ -94,17 +97,16 @@
 	    echo; \
 	    echo 'test_suite("${TESTSUITE}")'; \
             echo; \
-	} >Kyuafile.tmp
+	} >Kyuafile.auto.tmp
 .for _T in ${_TESTS}
 	@echo "${TEST_INTERFACE.${_T}}_test_program{name=\"${_T}\"}" \
-	    >>Kyuafile.tmp
+	    >>Kyuafile.auto.tmp
 .endfor
 .for _T in ${TESTS_SUBDIRS:N.WAIT}
-	@echo "include(\"${_T}/Kyuafile\")" >>Kyuafile.tmp
+	@echo "include(\"${_T}/Kyuafile\")" >>Kyuafile.auto.tmp
 .endfor
-	@mv Kyuafile.tmp Kyuafile
+	@mv Kyuafile.auto.tmp Kyuafile.auto
 .endif
-.endif
 
 KYUA?= ${KYUA_PREFIX}/bin/kyua
 .if exists(${KYUA})

--/04w6evG8XlLl3ft--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140109233402.GA8193>