From 2bbd06bcee5fe62896d71f78c6c2b6d0f3a23467 Mon Sep 17 00:00:00 2001
From: Joseph Myers <joseph@codesourcery.com>
Date: Fri, 31 Aug 2018 21:19:51 +0000
Subject: Replace conform/list-header-symbols.pl with a Python script.

Continuing the move of test code from Perl to Python (which seems
uncontroversial, unlike dependencies on Python in the actual build of
glibc), this patch replaces conform/list-header-symbols.pl with a
Python script, as a first step in converting the conform/ tests.
(conform/glibcconform.py is an equivalent to GlibcConform.pm,
containing code that will be relevant to move than one of the conform/
scripts.)

Tested for x86_64, including verifying that the symbol lists generated
are identical to those generated by the Perl version.

	* conform/glibcconform.py: New file.
	* conform/list-header-symbols.py: Likewise.
	* conform/list-header-symbols.pl: Remove.
	* conform/Makefile (tests-special): Only add linknamespace tests
	if [PYTHON].
	($(linknamespace-symlists-tests)): Use list-header-symbols.py.
---
 conform/Makefile | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

(limited to 'conform/Makefile')

diff --git a/conform/Makefile b/conform/Makefile
index d43093171b..71e58a46c8 100644
--- a/conform/Makefile
+++ b/conform/Makefile
@@ -120,7 +120,9 @@ linknamespace-symlists-base := $(foreach std,$(conformtest-standards),\
 					     symlist-$(std))
 linknamespace-symlists-tests := $(addprefix $(objpfx),\
 					    $(linknamespace-symlists-base))
+ifdef PYTHON
 tests-special += $(linknamespace-symlists-tests)
+endif
 
 linknamespace-symlist-stdlibs-base := $(foreach std,$(conformtest-standards),\
 						    symlist-stdlibs-$(std))
@@ -128,7 +130,9 @@ linknamespace-symlist-stdlibs-tests := \
 	$(addprefix $(objpfx),\
 		    $(linknamespace-symlist-stdlibs-base))
 
+ifdef PYTHON
 tests-special += $(linknamespace-symlist-stdlibs-tests)
+endif
 
 linknamespace-header-base := $(foreach std,\
 				       $(conformtest-standards),\
@@ -137,7 +141,9 @@ linknamespace-header-base := $(foreach std,\
 						 $(std)/$(h)/linknamespace.out))
 linknamespace-header-tests := $(addprefix $(objpfx),\
 					  $(linknamespace-header-base))
+ifdef PYTHON
 tests-special += $(linknamespace-header-tests)
+endif
 
 include ../Rules
 
@@ -181,11 +187,10 @@ $(conformtest-header-tests): $(objpfx)%/conform.out: \
 		 > $@); \
 	$(evaluate-test)
 
-$(linknamespace-symlists-tests): $(objpfx)symlist-%: list-header-symbols.pl
-	$(PERL) -I. -w $< --tmpdir=$(objpfx) --cc='$(CC)' \
-		--flags='$(conformtest-cc-flags)' --standard=$* \
-		--headers="$(strip $(conformtest-headers-$*))" \
-		> $@ 2> $@.err; \
+$(linknamespace-symlists-tests): $(objpfx)symlist-%: list-header-symbols.py
+	$(PYTHON) $< --cc='$(CC)' --flags='$(conformtest-cc-flags)' \
+		  --standard=$* --headers="$(strip $(conformtest-headers-$*))" \
+		  > $@ 2> $@.err; \
 	$(evaluate-test)
 
 linknamespace-libs-isoc = $(common-objpfx)libc.a $(common-objpfx)math/libm.a
-- 
cgit v1.2.1