git: 2f3c018ba8e8 - main - test-includes: use the same header set for badfiles.inc as for testing

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Fri, 17 Dec 2021 11:39:05 UTC
The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=2f3c018ba8e8e807784c6af06665c8eb08a99292

commit 2f3c018ba8e8e807784c6af06665c8eb08a99292
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2021-12-16 08:53:42 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2021-12-17 11:38:35 +0000

    test-includes: use the same header set for badfiles.inc as for testing
    
    This ensures we don't end up listing files we've excluded (e.g. those
    starting with _).
    Add a slight hack to preserve the existing order (sys, then net) in
    badfiles.inc.
    
    Reviewed by:    imp
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D33505
---
 tools/build/test-includes/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/build/test-includes/Makefile b/tools/build/test-includes/Makefile
index b1e5023663af..3ae39a2cb61f 100644
--- a/tools/build/test-includes/Makefile
+++ b/tools/build/test-includes/Makefile
@@ -16,7 +16,7 @@
 LIB=	test-includes
 INTERNALLIB=	This is a compile-only test
 MAN=
-HDRS!=	(cd ${SRCTOP}/sys; ls sys/[^_]*.h net*/[^_]*.h)
+HDRS!=	(cd ${SRCTOP}/sys; ls sys/[^_]*.h | sort ; ls net*/[^_]*.h | sort)
 NO_PIC=	yes
 
 # Some files have to be clean for extra defines too...
@@ -44,7 +44,7 @@ badfiles.inc:
 	@(cd ${SRCTOP}/sys;							\
 	echo "# DO NOT EDIT-- this file is automatically @""generated.";	\
 	echo "BADHDRS= \\";							\
-	for i in sys/*.h net*/*.h; do						\
+	for i in ${HDRS}; do						\
 		echo "#include <$$i>" |						\
 			${CC} ${CFLAGS} -xc - -c -o /dev/null 2> /dev/null ||	\
 			echo "	$$i \\";					\