From 2813e41e9049ccd0c75edc19c4fdefb21213b495 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Thu, 9 Aug 2018 15:34:12 +0000 Subject: Replace gen-libm-test.pl with gen-libm-test.py. Following the recent discussion of using Python instead of Perl and Awk for glibc build / test, this patch replaces gen-libm-test.pl with a new gen-libm-test.py script. This script should work with all Python versions supported by glibc (tested by hand with Python 2.7, tested in the build system with Python 3.5; configure prefers Python 3 if available). This script is designed to give identical output to gen-libm-test.pl for ease of verification of the change, except for generated comments referring to .py instead of .pl. (That is, identical for actual inputs passed to the script, not necessarily for all possible input; for example, this version more precisely follows the C standard syntax for floating-point constants when deciding when to add LIT macro calls.) In one place a comment notes that the generation of NON_FINITE flags is replicating a bug in the Perl script to assist in such comparisons (with the expectation that this bug can then be separately fixed in the Python script later). Tested for x86_64, including comparison of generated files (and hand testing of the case of generating a sorted libm-test-ulps file, which isn't covered by normal "make check"). I'd expect to follow this up by extending the new script to produce the ulps tables for the manual as well (replacing manual/libm-err-tab.pl, so that then we just have one ulps file parser) - at which point the manual build would depend on both Perl and Python (eliminating the Perl dependency would require someone to rewrite summary.pl in Python, and that would only eliminate the *direct* Perl dependency; current makeinfo is written in Perl so there would still be an indirect dependency). I think install.texi is more or less equally out-of-date regarding Perl and Python uses before and after this patch, so I don't think this patch depends on my patch to update install.texi regarding such uses (pending review). * math/gen-libm-test.py: New file. * math/gen-libm-test.pl: Remove. * math/Makefile [$(PERL) != no]: Change condition to [PYTHON]. ($(objpfx)libm-test-ulps.h): Use gen-libm-test.py instead of gen-libm-test.pl. ($(libm-test-c-noauto-obj)): Likewise. ($(libm-test-c-auto-obj)): Likewise. ($(libm-test-c-narrow-obj)): Likewise. (regen-ulps): Likewise. * math/README.libm-test: Update references to gen-libm-test.pl. * math/libm-test-driver.c (struct test_fj_f_data): Update comment referencing gen-libm-test.pl. * math/libm-test-nexttoward.inc (nexttoward_test_data): Likewise. * math/libm-test-support.c: Likewise. * math/libm-test-support.h: Likewise. * sysdeps/generic/libm-test-ulps: Likewise. --- math/README.libm-test | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'math/README.libm-test') diff --git a/math/README.libm-test b/math/README.libm-test index 41702c6537..53172bbff8 100644 --- a/math/README.libm-test +++ b/math/README.libm-test @@ -3,10 +3,10 @@ README for libm-test math test suite The libm-test math test suite tests a number of function points of math functions in the GNU C library. The following sections contain a -brief overview. Please note that the test drivers and the Perl script -"gen-libm-test.pl" have some options. A full list of options is -available with --help (for the test drivers) and -h for -"gen-libm-test.pl". +brief overview. Please note that the test drivers and the Python +script "gen-libm-test.py" have some options. A full list of options +is available with --help (for the test drivers) and -h for +"gen-libm-test.py". What is tested? @@ -25,8 +25,8 @@ The main files are "libm-test-.inc". They are independent of the target platform and the specific real floating type and format and contain placeholder test "templates" for math functions defined in libm. These files, along with generated files named -"auto-libm-test-out-", are preprocessed by the Perl script -"gen-libm-test.pl" to expand the templates and produce a set of test +"auto-libm-test-out-", are preprocessed by the Python script +"gen-libm-test.py" to expand the templates and produce a set of test cases for each math function that are specific to the target platform but still independent of the real floating type. The results of the processing are "libm-test-.c" and a file "libm-test-ulps.h" with @@ -48,7 +48,7 @@ defines or undefines the __NO_MATH_INLINES macro just before including respectively. Each driver is compiled into a single executable test program with the corresponding name. -As mentioned above, the "gen-libm-test.pl" script looks for a file +As mentioned above, the "gen-libm-test.py" script looks for a file named "libm-test-ulps" in the platform specific sysdep directory (or its fpu or nofpu subdirectory) and for each variant (real floating type and rounding mode) of every tested function reads from it the @@ -80,17 +80,17 @@ This generates a file "ULPs" with all double ULPs in it, ignoring any previously calculated ULPs, and running with the newly built dynamic loader and math library (assumes you didn't install your build). Now generate the ULPs for all other formats, the tests will be appending the -data to the "ULPs" file. As final step run "gen-libm-test.pl" with the +data to the "ULPs" file. As final step run "gen-libm-test.py" with the file as input and ask to generate a pretty printed output in the file "NewUlps": - gen-libm-test.pl -u ULPs -n NewUlps + gen-libm-test.py -u ULPs -n NewUlps Copy "NewUlps" to "libm-test-ulps" in the appropriate machine sysdep directory. Note that the test drivers have an option "-u" to output an unsorted list of all epsilons that the functions have. The output can be read in directly but it's better to pretty print it first. -"gen-libm-test.pl" has an option to generate a pretty-printed and +"gen-libm-test.py" has an option to generate a pretty-printed and sorted new ULPs file from the output of the test drivers. Contents of libm-test-ulps -- cgit v1.2.3