mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-12 16:20:06 +00:00
163f65e28c
3 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
Joseph Myers
|
dcd4cd5756 |
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. |
||
Joseph Myers
|
a622c2db55 |
Move libm-test TEST_MSG definitions to libm-test-driver.c.
Various files using the libm-test infrastructure define a TEST_MSG macro with an informal description of the tests being run. This patch moves this macro to libm-test-driver.c (the definition depending on other macros already defined), so files specific to (type, choice of whether to test inline functions or finite-math-only functions, vector length) no longer need to define it. This is in preparation for replacing files such as test-float.c with per-function test-float-<func>.c etc. automatically generated in the build directory when tests are run. Tested for x86_64. * math/libm-test-driver.c (STRX): New macro. (STR): Likewise. (STR_FLOAT): Likewise. (STR_VEC_LEN): Likewise. (TEST_MSG): Likewise. Define here instead of expecting to be defined by including file. * math/test-double-finite.c (TEST_MSG): Remove macro. * math/test-double-vlen2.h (TEST_MSG): Likewise. * math/test-double-vlen4.h (TEST_MSG): Likewise. * math/test-double-vlen8.h (TEST_MSG): Likewise. * math/test-double.c (TEST_MSG): Likewise. * math/test-float-finite.c (TEST_MSG): Likewise. * math/test-float-vlen16.h (TEST_MSG): Likewise. * math/test-float-vlen4.h (TEST_MSG): Likewise. * math/test-float-vlen8.h (TEST_MSG): Likewise. * math/test-float.c (TEST_MSG): Likewise. * math/test-idouble.c (TEST_MSG): Likewise. * math/test-ifloat.c (TEST_MSG): Likewise. * math/test-ildouble.c (TEST_MSG): Likewise. * math/test-ldouble-finite.c (TEST_MSG): Likewise. * math/test-ldouble.c (TEST_MSG): Likewise. |
||
Joseph Myers
|
5a68e857bf |
Move non-function-specific parts of libm-test.inc to separate file.
libm-test.inc contains both test infrastructure and tests of individual functions. This patch moves the infrastructure to a separate file libm-test-driver.c. This is in preparation for splitting the tests of individual functions into separate source files, which will be processed individually by gen-libm-test.pl (so e.g. libm-test-acos.inc and auto-libm-test-out-acos will be processed by gen-libm-test.pl to produce libm-test-acos.c, and files such as test-double-acos.c will be generated by the Makefile to include appropriate headers, libm-test-driver.c and libm-test-acos.c so tests of each function get run separately). It is no doubt possible to split things up further, so that functions not depending on the type being tested only get compiled once and most of those depending on the type being tested get compiled once per type (rather than separately for variants such as inline / no-inline, and separately for each function being tested after that split), but this rearrangement as-is seems a useful incremental step towards splitting these tests by function. * math/libm-test-driver.c: New file. Based on math/libm-test.inc. * math/libm-test.inc: Move all contents, other than tests of individual functions, to libm-test-driver.c. [!FE_TONEAREST] (FE_TONEAREST): Move to libm-test-driver.c. [!FE_TOWARDZERO] (FE_TOWARDZERO): Likewise. [!FE_UPWARD] (FE_UPWARD): Likewise. [!FE_DOWNWARD] (FE_DOWNWARD): Likewise. (NO_EXCEPTION): Likewise. (INVALID_EXCEPTION): Likewise. (DIVIDE_BY_ZERO_EXCEPTION): Likewise. (OVERFLOW_EXCEPTION): Likewise. (UNDERFLOW_EXCEPTION): Likewise. (INEXACT_EXCEPTION): Likewise. (INVALID_EXCEPTION_OK): Likewise. (DIVIDE_BY_ZERO_EXCEPTION_OK): Likewise. (OVERFLOW_EXCEPTION_OK): Likewise. (UNDERFLOW_EXCEPTION_OK): Likewise. (NO_INEXACT_EXCEPTION): Likewise. (EXCEPTIONS_OK): Likewise. (IGNORE_ZERO_INF_SIGN): Likewise. (TEST_NAN_SIGN): Likewise. (TEST_NAN_PAYLOAD): Likewise. (NO_TEST_INLINE): Likewise. (XFAIL_TEST): Likewise. (ERRNO_UNCHANGED): Likewise. (ERRNO_EDOM): Likewise. (ERRNO_ERANGE): Likewise. (IGNORE_RESULT): Likewise. (NON_FINITE): Likewise. (TEST_SNAN): Likewise. (NO_TEST_MATHVEC): Likewise. (TEST_NAN_PAYLOAD_CANONICALIZE): Likewise. (__CONCATX): Likewise. (TYPE_MIN): Likewise. (TYPE_TRUE_MIN): Likewise. (TYPE_MAX): Likewise. (MIN_EXP): Likewise. (MAX_EXP): Likewise. (MANT_DIG): Likewise. (FSTR_MAX): Likewise. (ULP_IDX): Likewise. (QTYPE_STR): Likewise. (TEST_COND_binary32): Likewise. (TEST_COND_binary64): Likewise. (TEST_COND_binary128): Likewise. (TEST_COND_ibm128): Likewise. (TEST_COND_intel96): Likewise. (TEST_COND_m68k96): Likewise. (TEST_COND_ibm128_libgcc): Likewise. (XFAIL_IBM128_LIBGCC): Likewise. (PAYLOAD_DIG): Likewise. (UNDERFLOW_EXCEPTION_FLOAT): Likewise. (UNDERFLOW_EXCEPTION_OK_FLOAT): Likewise. (UNDERFLOW_EXCEPTION_DOUBLE): Likewise. (UNDERFLOW_EXCEPTION_OK_DOUBLE): Likewise. (UNDERFLOW_EXCEPTION_LDOUBLE_IBM): Likewise. (UNDERFLOW_EXCEPTION_BEFORE_ROUNDING): Likewise. (TEST_COND_long32): Likewise. (TEST_COND_long64): Likewise. (TEST_COND_before_rounding): Likewise. (TEST_COND_after_rounding): Likewise. (lit_pi_3_m_4_d): Likewise. (lit_pi_3_m_4_ln10_m_d): Likewise. (lit_pi_2_ln10_m_d): Likewise. (lit_pi_4_ln10_m_d): Likewise. (lit_pi_ln10_d): Likewise. (lit_pi_2_d): Likewise. (lit_pi_4_d): Likewise. (lit_pi): Likewise. (lit_e): Likewise. (ulps_file_name): Likewise. (ulps_file): Likewise. (output_ulps): Likewise. (output_dir): Likewise. (noErrors): Likewise. (noTests): Likewise. (noExcTests): Likewise. (noErrnoTests): Likewise. (verbose): Likewise. (output_max_error): Likewise. (output_points): Likewise. (ignore_max_ulp): Likewise. (plus_zero): Likewise. (minus_zero): Likewise. (plus_infty): Likewise. (minus_infty): Likewise. (qnan_value_pl): Likewise. (qnan_value): Likewise. (snan_value_pl): Likewise. (snan_value): Likewise. (max_value): Likewise. (min_value): Likewise. (min_subnorm_value): Likewise. (snan_value_ld): Likewise. (max_error): Likewise. (real_max_error): Likewise. (imag_max_error): Likewise. (prev_max_error): Likewise. (prev_real_max_error): Likewise. (prev_imag_max_error): Likewise. (max_valid_error): Likewise. (TYPE_DECIMAL_DIG): Likewise. (TYPE_HEX_DIG): Likewise. (fmt_ftostr): Likewise. (compare_ulp_data): Likewise. (find_ulps): Likewise. (init_max_error): Likewise. (set_max_error): Likewise. (print_float): Likewise. (print_screen): Likewise. (print_screen_max_error): Likewise. (update_stats): Likewise. (print_function_ulps): Likewise. (print_complex_function_ulps): Likewise. (fpstack_test): Likewise. (print_max_error): Likewise. (print_complex_max_error): Likewise. (test_single_exception): Likewise. (test_exceptions): Likewise. (test_single_errno): Likewise. (test_errno): Likewise. (ULPDIFF): Likewise. (ulp): Likewise. (check_float_internal): Likewise. (check_float): Likewise. (check_complex): Likewise. (check_int): Likewise. (check_long): Likewise. (check_bool): Likewise. (check_longlong): Likewise. (check_intmax_t): Likewise. (check_uintmax_t): Likewise. (enable_test): Likewise. (struct test_f_f_data): Likewise. (struct test_ff_f_data): Likewise. (struct test_fj_f_data): Likewise. (struct test_fi_f_data): Likewise. (struct test_fl_f_data): Likewise. (struct test_if_f_data): Likewise. (struct test_fff_f_data): Likewise. (struct test_fiu_M_data): Likewise. (struct test_fiu_U_data): Likewise. (struct test_c_f_data): Likewise. (struct test_f_f1_data): Likewise. (struct test_fF_f1_data): Likewise. (struct test_ffI_f1_data): Likewise. (struct test_c_c_data): Likewise. (struct test_cc_c_data): Likewise. (struct test_f_i_data): Likewise. (struct test_ff_i_data): Likewise. (struct test_f_l_data): Likewise. (struct test_f_L_data): Likewise. (struct test_fFF_11_data): Likewise. (struct test_Ff_b1_data): Likewise. (IF_ROUND_INIT_): Likewise. (IF_ROUND_INIT_FE_DOWNWARD): Likewise. (IF_ROUND_INIT_FE_TONEAREST): Likewise. (IF_ROUND_INIT_FE_TOWARDZERO): Likewise. (IF_ROUND_INIT_FE_UPWARD): Likewise. (ROUND_RESTORE_): Likewise. (ROUND_RESTORE_FE_DOWNWARD): Likewise. (ROUND_RESTORE_FE_TONEAREST): Likewise. (ROUND_RESTORE_FE_TOWARDZERO): Likewise. (ROUND_RESTORE_FE_UPWARD): Likewise. (RM_): Likewise. (RM_FE_DOWNWARD): Likewise. (RM_FE_TONEAREST): Likewise. (RM_FE_TOWARDZERO): Likewise. (RM_FE_UPWARD): Likewise. (COMMON_TEST_SETUP): Likewise. (EXTRA_OUTPUT_TEST_SETUP): Likewise. (COMMON_TEST_CLEANUP): Likewise. (EXTRA_OUTPUT_TEST_CLEANUP): Likewise. (RUN_TEST_f_f): Likewise. (RUN_TEST_LOOP_f_f): Likewise. (RUN_TEST_fp_f): Likewise. (RUN_TEST_LOOP_fp_f): Likewise. (RUN_TEST_2_f): Likewise. (RUN_TEST_LOOP_2_f): Likewise. (RUN_TEST_ff_f): Likewise. (RUN_TEST_LOOP_ff_f): Likewise. (RUN_TEST_LOOP_fj_f): Likewise. (RUN_TEST_fi_f): Likewise. (RUN_TEST_LOOP_fi_f): Likewise. (RUN_TEST_fl_f): Likewise. (RUN_TEST_LOOP_fl_f): Likewise. (RUN_TEST_if_f): Likewise. (RUN_TEST_LOOP_if_f): Likewise. (RUN_TEST_fff_f): Likewise. (RUN_TEST_LOOP_fff_f): Likewise. (RUN_TEST_fiu_M): Likewise. (RUN_TEST_LOOP_fiu_M): Likewise. (RUN_TEST_fiu_U): Likewise. (RUN_TEST_LOOP_fiu_U): Likewise. (RUN_TEST_c_f): Likewise. (RUN_TEST_LOOP_c_f): Likewise. (RUN_TEST_f_f1): Likewise. (RUN_TEST_LOOP_f_f1): Likewise. (RUN_TEST_fF_f1): Likewise. (RUN_TEST_LOOP_fF_f1): Likewise. (RUN_TEST_fI_f1): Likewise. (RUN_TEST_LOOP_fI_f1): Likewise. (RUN_TEST_ffI_f1_mod8): Likewise. (RUN_TEST_LOOP_ffI_f1_mod8): Likewise. (RUN_TEST_Ff_b1): Likewise. (RUN_TEST_LOOP_Ff_b1): Likewise. (RUN_TEST_Ffp_b1): Likewise. (RUN_TEST_LOOP_Ffp_b1): Likewise. (RUN_TEST_c_c): Likewise. (RUN_TEST_LOOP_c_c): Likewise. (RUN_TEST_cc_c): Likewise. (RUN_TEST_LOOP_cc_c): Likewise. (RUN_TEST_f_i): Likewise. (RUN_TEST_LOOP_f_i): Likewise. (RUN_TEST_f_i_tg): Likewise. (RUN_TEST_LOOP_f_i_tg): Likewise. (RUN_TEST_ff_b): Likewise. (RUN_TEST_LOOP_ff_b): Likewise. (RUN_TEST_ff_i_tg): Likewise. (RUN_TEST_LOOP_ff_i_tg): Likewise. (RUN_TEST_f_b): Likewise. (RUN_TEST_LOOP_f_b): Likewise. (RUN_TEST_f_b_tg): Likewise. (RUN_TEST_LOOP_f_b_tg): Likewise. (RUN_TEST_f_l): Likewise. (RUN_TEST_LOOP_f_l): Likewise. (RUN_TEST_f_L): Likewise. (RUN_TEST_LOOP_f_L): Likewise. (RUN_TEST_fFF_11): Likewise. (RUN_TEST_LOOP_fFF_11): Likewise. (VEC_SUFF): Likewise. (STR_CONCAT): Likewise. (STR_CON3): Likewise. (HAVE_VECTOR): Likewise. (START): Likewise. (END): Likewise. (END_COMPLEX): Likewise. (ALL_RM_TEST): Likewise. (matherr): Likewise. (initialize): Likewise. (options): Likewise. (doc): Likewise. (parse_opt): Likewise. (argp): Likewise. (check_ulp): Likewise. (main): Likewise. (do_test): New function. Call tests of individual functions previously called from main. |