Subject: bug#36150: ERROR: testsuite/inplace-selinux.sh

From: Chris Marusich <[email-masked]>
Date: Sat, 30 May 2020 01:04:19 -0700

Timothy Sample <[email-masked]> writes:

> I ran into this bug when building Sed via GNU Guix running on top of
> Fedora 31.  This means I was building Sed version 4.7 from the release
> tarball.

Me, too!  I reported it here:

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=41498

> The generated Makefile did set “CONFIG_HEADER”.  However, I noticed that
> “CONFIG_HEADER” was absent from the list of variables propagated into
> the test environment (see the “TEST_ENVIRONMENT” variable in
> “testsuite/local.mk”).  Adding it there allowed the test to be skipped
> rather than causing a hard error.

Yes, this fixes the issue for me, too.  I have attached a patch.

Assaf, how does this look?

-- 
Chris
From ff001cbe5c7253a8825e5ad553f84b8d763013ac Mon Sep 17 00:00:00 2001
From: Chris Marusich <[email-masked]>
Date: Sat, 30 May 2020 00:20:48 -0700
Subject: [PATCH] tests: Export CONFIG_HEADER to test scripts.

Before this change, the testsuite/inplace-selinux test fails in some
cases when SELinux is available.  The reason it fails is because the
require_selinux_ function in init.cfg expects the CONFIG_HEADER
environment variable to be defined, but in fact it is not defined.
Even though we do invoke AM_CONFIG_HEADER in configure.ac, and even
though the CONFIG_HEADER variable does get set in the resulting
Makefile, nothing actually exports the CONFIG_HEADER variable, so the
test is doomed to fail whenever it is not skipped.  Fix this by
exporting the variable.

* testsuite/local.mk (TESTS_ENVIRONMENT): Add CONFIG_HEADER to the
list of variables to export to the environment of the test scripts.

Reported by Vineet Jain <[email-masked]> in
https://bugs.gnu.org/36150 .  The fix was suggested by Timothy Sample
<[email-masked]> in the same bug report.
---
 testsuite/local.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/testsuite/local.mk b/testsuite/local.mk
index 2b3bf86..9dac4f3 100644
--- a/testsuite/local.mk
+++ b/testsuite/local.mk
@@ -161,6 +161,7 @@ TESTS_ENVIRONMENT =				\
   abs_top_builddir='$(abs_top_builddir)'	\
   abs_top_srcdir='$(abs_top_srcdir)'		\
   abs_srcdir='$(abs_srcdir)'			\
+  CONFIG_HEADER='$(CONFIG_HEADER)'		\
   built_programs=sed;				\
   srcdir='$(srcdir)'				\
   top_srcdir='$(top_srcdir)'			\
-- 
2.26.2