]> sourceware.org Git - glibc.git/commit
Refactor some code in libm-test-driver.c.
authorJoseph Myers <joseph@codesourcery.com>
Mon, 6 Feb 2017 23:23:54 +0000 (23:23 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Mon, 6 Feb 2017 23:23:54 +0000 (23:23 +0000)
commitdcd4cd575678c94f042c1a6b08663c648781a9eb
treec9a8d1a8949f27140a8cb4844474d4f095d78ba2
parenta622c2db5511e9633870e3ced9fb2406e4ebdb09
Refactor some code in libm-test-driver.c.

Splitting libm tests by function will mean about a thousand such tests
built separately instead of the present nine (plus vector variants).

When this is done, it's desirable to avoid needing to build all the
test infrastructure so many times.  Also, simply including
libm-test-driver.c as-is into per-function tests doesn't actually
work, because the various check_* functions are not used by all tests
and so generate errors for unused static functions.

Although some pieces of infrastructure depend on the type being tested
while others don't, building once per type seems the simplest
approach.  This patch makes changes to libm-test-driver.c in
preparation for that.  Various cases where functions directly use
macros such as TEST_ERRNO (that may vary depending on things other
than the type under test) are changed to use variables initialized
using those macros, while most of the code in main is moved out to
functions libm_test_init and libm_test_fini.

The idea is that all the functions in libm-test-driver.c will be moved
out in a subsequent patch to be built once per type (and be no longer
static when they are used from per-function tests), while
libm-test-driver.c remains containing definitions of various variables
(no longer static, of course, because they'll be used in the per-type
code) and the main function.  Declarations / macros relevant to both
the once-per-type code and the per-function tests will go in a shared
header.

Tested for x86_64.

* math/libm-test-driver.c (flag_test_errno): New variable.
(flag_test_exceptions): Likewise.
(flag_test_finite): Likewise.
(flag_test_inline): Likewise.
(flag_test_mathvec): Likewise.
(test_msg): Likewise.
(ulp_idx): Likewise.
(qtype_str): Likewise.
(ULP_IDX): Remove macro.
(QTYPE_STR): Likewise.
(find_ulps): Use ulp_idx not ULP_IDX.
(print_function_ulps): Use qtype_str, printed with %s, not
QTYPE_STR, printed with concatentation to format string.
(print_complex_function_ulps): Likewise.
(test_exceptions): Use flag_test_exceptions not TEST_EXCEPTIONS.
(test_errno): Use flag_test_errno not TEST_ERRNO.
(enable_test): Use flag_test_inline, flag_test_finite and
flag_test_mathvec instead of TEST_INLINE, TEST_FINITE and
TEST_MATHVEC.
(libm_test_init): New function.  Factored out of main.
(libm_test_finish): Likewise.
(main): Call libm_test_init and libm_test_finish and move most
code to those functions.
ChangeLog
math/libm-test-driver.c
This page took 0.045095 seconds and 5 git commands to generate.