mirror of
git://sourceware.org/git/glibc.git
synced 2024-11-27 03:41:23 +08:00
Make libm-test support ALL_RM_TEST with AUTO_TESTS_*.
This patch continues improvements to all-rounding-mode libm testing by making testing with ALL_RM_TEST support test results from auto-libm-test-out. gen-libm-test.pl is adapted to generate appropriate output with results for each rounding mode, with AUTO_TESTS_* calls no longer specifying a rounding mode. Where there were separate functions in libm-test.inc to test a function in each rounding mode, using AUTO_TESTS_* to list the tests for each rounding mode, those are converted to using ALL_RM_TEST (so generally this patch doesn't change the sets of tests run in each rounding mode, except that in various cases special-case tests given directly in libm-test.inc were previously run only for round-to-nearest, and now are run for all rounding modes). Tested x86_64 and x86. * math/gen-libm-test.pl (generate_testfile): Expect only function name as argument to AUTO_TESTS_* and pass results for all rounding modes to parse_args. (parse_auto_input): Separate inputs of automatic tests from outputs before storing in %auto_tests. * math/libm-test.inc (acos_test_data): Update call to AUTO_TESTS_f_f. (acos_test): Use ALL_RM_TEST. (acos_tonearest_test_data): Remove. (acos_test_tonearest): Likewise. (acos_towardzero_test_data): Likewise. (acos_test_towardzero): Likewise. (acos_downward_test_data): Likewise. (acos_test_downward): Likewise. (acos_upward_test_data): Likewise. (acos_test_upward): Likewise. (acosh_test_data): Update call to AUTO_TESTS_f_f. (asin_test_data): Likewise. (asin_test): Use ALL_RM_TEST. (asin_tonearest_test_data): Remove. (asin_test_tonearest): Likewise. (asin_towardzero_test_data): Likewise. (asin_test_towardzero): Likewise. (asin_downward_test_data): Likewise. (asin_test_downward): Likewise. (asin_upward_test_data): Likewise. (asin_test_upward): Likewise. (asinh_test_data): Update call to AUTO_TESTS_f_f. (atan_test_data): Likewise. (atanh_test_data): Likewise. (atan2_test_data): Update call to AUTO_TESTS_ff_f. (cabs_test_data): Update call to AUTO_TESTS_c_f. (carg_test_data): Likewise. (cbrt_test_data): Update call to AUTO_TESTS_f_f. (ccos_test_data): Update call to AUTO_TESTS_c_c. (ccosh_test_data): Likewise. (cexp_test_data): Likewise. (clog_test_data): Likewise. (clog10_test_data): Likewise. (cos_test_data): Update call to AUTO_TESTS_f_f. (cos_test): Use ALL_RM_TEST. (cos_tonearest_test_data): Remove. (cos_test_tonearest): Likewise. (cos_towardzero_test_data): Likewise. (cos_test_towardzero): Likewise. (cos_downward_test_data): Likewise. (cos_test_downward): Likewise. (cos_upward_test_data): Likewise. (cos_test_upward): Likewise. (cosh_test_data): Update call to AUTO_TESTS_f_f. (cosh_test): Use ALL_RM_TEST. (cosh_tonearest_test_data): Remove. (cosh_test_tonearest): Likewise. (cosh_towardzero_test_data): Likewise. (cosh_test_towardzero): Likewise. (cosh_downward_test_data): Likewise. (cosh_test_downward): Likewise. (cosh_upward_test_data): Likewise. (cosh_test_upward): Likewise. (cpow_test_data): Update call to AUTO_TESTS_cc_c. (csqrt_test_data): Update call to AUTO_TESTS_c_c. (ctan_test_data): Likewise. (ctan_test): Use ALL_RM_TEST. (ctan_tonearest_test_data): Remove. (ctan_test_tonearest): Likewise. (ctan_towardzero_test_data): Likewise. (ctan_test_towardzero): Likewise. (ctan_downward_test_data): Likewise. (ctan_test_downward): Likewise. (ctan_upward_test_data): Likewise. (ctan_test_upward): Likewise. (ctanh_test_data): Update call to AUTO_TESTS_c_c. (ctanh_test): Use ALL_RM_TEST. (ctanh_tonearest_test_data): Remove. (ctanh_test_tonearest): Likewise. (ctanh_towardzero_test_data): Likewise. (ctanh_test_towardzero): Likewise. (ctanh_downward_test_data): Likewise. (ctanh_test_downward): Likewise. (ctanh_upward_test_data): Likewise. (ctanh_test_upward): Likewise. (erf_test_data): Update call to AUTO_TESTS_f_f. (erfc_test_data): Likewise. (exp_test_data): Likewise. (exp_test): Use ALL_RM_TEST. (exp_tonearest_test_data): Remove. (exp_test_tonearest): Likewise. (exp_towardzero_test_data): Likewise. (exp_test_towardzero): Likewise. (exp_downward_test_data): Likewise. (exp_test_downward): Likewise. (exp_upward_test_data): Likewise. (exp_test_upward): Likewise. (exp10_test_data): Update call to AUTO_TESTS_f_f. (exp10_test): Use ALL_RM_TEST. (exp10_tonearest_test_data): Remove. (exp10_test_tonearest): Likewise. (exp10_towardzero_test_data): Likewise. (exp10_test_towardzero): Likewise. (exp10_downward_test_data): Likewise. (exp10_test_downward): Likewise. (exp10_upward_test_data): Likewise. (exp10_test_upward): Likewise. (exp2_test_data): Update call to AUTO_TESTS_f_f. (expm1_test_data): Likewise. (expm1_test): Use ALL_RM_TEST. (expm1_tonearest_test_data): Remove. (expm1_test_tonearest): Likewise. (expm1_towardzero_test_data): Likewise. (expm1_test_towardzero): Likewise. (expm1_downward_test_data): Likewise. (expm1_test_downward): Likewise. (expm1_upward_test_data): Likewise. (expm1_test_upward): Likewise. (fma_test_data): Update call to AUTO_TESTS_fff_f. (fma_test): Use ALL_RM_TEST. (fma_towardzero_test_data): Remove. (fma_test_towardzero): Likewise. (fma_downward_test_data): Likewise. (fma_test_downward): Likewise. (fma_upward_test_data): Likewise. (fma_test_upward): Likewise. (hypot_test_data): Update call to AUTO_TESTS_ff_f. (j0_test_data): Update call to AUTO_TESTS_f_f. (j1_test_data): Likewise. (jn_test_data): Update call to AUTO_TESTS_if_f. (lgamma_test_data): Update call to AUTO_TESTS_f_f1. (log_test_data): Update call to AUTO_TESTS_f_f. (log10_test_data): Likewise. (log1p_test_data): Likewise. (log2_test_data): Likewise. (pow_test_data): Update call to AUTO_TESTS_ff_f. (pow_tonearest_test_data): Likewise. (sin_test_data): Update call to AUTO_TESTS_f_f. (sin_test): Use ALL_RM_TEST. (sin_tonearest_test_data): Remove. (sin_test_tonearest): Likewise. (sin_towardzero_test_data): Likewise. (sin_test_towardzero): Likewise. (sin_downward_test_data): Likewise. (sin_test_downward): Likewise. (sin_upward_test_data): Likewise. (sin_test_upward): Likewise. (sincos_test_data): Update call to AUTO_TESTS_fFF_11. (sinh_test_data): Update call to AUTO_TESTS_f_f. (sinh_test): Use ALL_RM_TEST. (sinh_tonearest_test_data): Remove. (sinh_test_tonearest): Likewise. (sinh_towardzero_test_data): Likewise. (sinh_test_towardzero): Likewise. (sinh_downward_test_data): Likewise. (sinh_test_downward): Likewise. (sinh_upward_test_data): Likewise. (sinh_test_upward): Likewise. (sqrt_test_data): Update call to AUTO_TESTS_f_f. (sqrt_test): Use ALL_RM_TEST. (sqrt_tonearest_test_data): Remove. (sqrt_test_tonearest): Likewise. (sqrt_towardzero_test_data): Likewise. (sqrt_test_towardzero): Likewise. (sqrt_downward_test_data): Likewise. (sqrt_test_downward): Likewise. (sqrt_upward_test_data): Likewise. (sqrt_test_upward): Likewise. (tan_test_data): Update call to AUTO_TESTS_f_f. (tan_test): Use ALL_RM_TEST. (tan_tonearest_test_data): Remove. (tan_test_tonearest): Likewise. (tan_towardzero_test_data): Likewise. (tan_test_towardzero): Likewise. (tan_downward_test_data): Likewise. (tan_test_downward): Likewise. (tan_upward_test_data): Likewise. (tan_test_upward): Likewise. (tanh_test_data): Update call to AUTO_TESTS_f_f. (tgamma_test_data): Likewise. (y0_test_data): Likewise. (y1_test_data): Likewise. (yn_test_data): Update call to AUTO_TESTS_if_f. (main): Do not call removed functions.
This commit is contained in:
parent
d71aeee886
commit
ae3a5dff0f
183
ChangeLog
183
ChangeLog
@ -1,3 +1,186 @@
|
||||
2014-03-20 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* math/gen-libm-test.pl (generate_testfile): Expect only function
|
||||
name as argument to AUTO_TESTS_* and pass results for all rounding
|
||||
modes to parse_args.
|
||||
(parse_auto_input): Separate inputs of automatic tests from
|
||||
outputs before storing in %auto_tests.
|
||||
* math/libm-test.inc (acos_test_data): Update call to
|
||||
AUTO_TESTS_f_f.
|
||||
(acos_test): Use ALL_RM_TEST.
|
||||
(acos_tonearest_test_data): Remove.
|
||||
(acos_test_tonearest): Likewise.
|
||||
(acos_towardzero_test_data): Likewise.
|
||||
(acos_test_towardzero): Likewise.
|
||||
(acos_downward_test_data): Likewise.
|
||||
(acos_test_downward): Likewise.
|
||||
(acos_upward_test_data): Likewise.
|
||||
(acos_test_upward): Likewise.
|
||||
(acosh_test_data): Update call to AUTO_TESTS_f_f.
|
||||
(asin_test_data): Likewise.
|
||||
(asin_test): Use ALL_RM_TEST.
|
||||
(asin_tonearest_test_data): Remove.
|
||||
(asin_test_tonearest): Likewise.
|
||||
(asin_towardzero_test_data): Likewise.
|
||||
(asin_test_towardzero): Likewise.
|
||||
(asin_downward_test_data): Likewise.
|
||||
(asin_test_downward): Likewise.
|
||||
(asin_upward_test_data): Likewise.
|
||||
(asin_test_upward): Likewise.
|
||||
(asinh_test_data): Update call to AUTO_TESTS_f_f.
|
||||
(atan_test_data): Likewise.
|
||||
(atanh_test_data): Likewise.
|
||||
(atan2_test_data): Update call to AUTO_TESTS_ff_f.
|
||||
(cabs_test_data): Update call to AUTO_TESTS_c_f.
|
||||
(carg_test_data): Likewise.
|
||||
(cbrt_test_data): Update call to AUTO_TESTS_f_f.
|
||||
(ccos_test_data): Update call to AUTO_TESTS_c_c.
|
||||
(ccosh_test_data): Likewise.
|
||||
(cexp_test_data): Likewise.
|
||||
(clog_test_data): Likewise.
|
||||
(clog10_test_data): Likewise.
|
||||
(cos_test_data): Update call to AUTO_TESTS_f_f.
|
||||
(cos_test): Use ALL_RM_TEST.
|
||||
(cos_tonearest_test_data): Remove.
|
||||
(cos_test_tonearest): Likewise.
|
||||
(cos_towardzero_test_data): Likewise.
|
||||
(cos_test_towardzero): Likewise.
|
||||
(cos_downward_test_data): Likewise.
|
||||
(cos_test_downward): Likewise.
|
||||
(cos_upward_test_data): Likewise.
|
||||
(cos_test_upward): Likewise.
|
||||
(cosh_test_data): Update call to AUTO_TESTS_f_f.
|
||||
(cosh_test): Use ALL_RM_TEST.
|
||||
(cosh_tonearest_test_data): Remove.
|
||||
(cosh_test_tonearest): Likewise.
|
||||
(cosh_towardzero_test_data): Likewise.
|
||||
(cosh_test_towardzero): Likewise.
|
||||
(cosh_downward_test_data): Likewise.
|
||||
(cosh_test_downward): Likewise.
|
||||
(cosh_upward_test_data): Likewise.
|
||||
(cosh_test_upward): Likewise.
|
||||
(cpow_test_data): Update call to AUTO_TESTS_cc_c.
|
||||
(csqrt_test_data): Update call to AUTO_TESTS_c_c.
|
||||
(ctan_test_data): Likewise.
|
||||
(ctan_test): Use ALL_RM_TEST.
|
||||
(ctan_tonearest_test_data): Remove.
|
||||
(ctan_test_tonearest): Likewise.
|
||||
(ctan_towardzero_test_data): Likewise.
|
||||
(ctan_test_towardzero): Likewise.
|
||||
(ctan_downward_test_data): Likewise.
|
||||
(ctan_test_downward): Likewise.
|
||||
(ctan_upward_test_data): Likewise.
|
||||
(ctan_test_upward): Likewise.
|
||||
(ctanh_test_data): Update call to AUTO_TESTS_c_c.
|
||||
(ctanh_test): Use ALL_RM_TEST.
|
||||
(ctanh_tonearest_test_data): Remove.
|
||||
(ctanh_test_tonearest): Likewise.
|
||||
(ctanh_towardzero_test_data): Likewise.
|
||||
(ctanh_test_towardzero): Likewise.
|
||||
(ctanh_downward_test_data): Likewise.
|
||||
(ctanh_test_downward): Likewise.
|
||||
(ctanh_upward_test_data): Likewise.
|
||||
(ctanh_test_upward): Likewise.
|
||||
(erf_test_data): Update call to AUTO_TESTS_f_f.
|
||||
(erfc_test_data): Likewise.
|
||||
(exp_test_data): Likewise.
|
||||
(exp_test): Use ALL_RM_TEST.
|
||||
(exp_tonearest_test_data): Remove.
|
||||
(exp_test_tonearest): Likewise.
|
||||
(exp_towardzero_test_data): Likewise.
|
||||
(exp_test_towardzero): Likewise.
|
||||
(exp_downward_test_data): Likewise.
|
||||
(exp_test_downward): Likewise.
|
||||
(exp_upward_test_data): Likewise.
|
||||
(exp_test_upward): Likewise.
|
||||
(exp10_test_data): Update call to AUTO_TESTS_f_f.
|
||||
(exp10_test): Use ALL_RM_TEST.
|
||||
(exp10_tonearest_test_data): Remove.
|
||||
(exp10_test_tonearest): Likewise.
|
||||
(exp10_towardzero_test_data): Likewise.
|
||||
(exp10_test_towardzero): Likewise.
|
||||
(exp10_downward_test_data): Likewise.
|
||||
(exp10_test_downward): Likewise.
|
||||
(exp10_upward_test_data): Likewise.
|
||||
(exp10_test_upward): Likewise.
|
||||
(exp2_test_data): Update call to AUTO_TESTS_f_f.
|
||||
(expm1_test_data): Likewise.
|
||||
(expm1_test): Use ALL_RM_TEST.
|
||||
(expm1_tonearest_test_data): Remove.
|
||||
(expm1_test_tonearest): Likewise.
|
||||
(expm1_towardzero_test_data): Likewise.
|
||||
(expm1_test_towardzero): Likewise.
|
||||
(expm1_downward_test_data): Likewise.
|
||||
(expm1_test_downward): Likewise.
|
||||
(expm1_upward_test_data): Likewise.
|
||||
(expm1_test_upward): Likewise.
|
||||
(fma_test_data): Update call to AUTO_TESTS_fff_f.
|
||||
(fma_test): Use ALL_RM_TEST.
|
||||
(fma_towardzero_test_data): Remove.
|
||||
(fma_test_towardzero): Likewise.
|
||||
(fma_downward_test_data): Likewise.
|
||||
(fma_test_downward): Likewise.
|
||||
(fma_upward_test_data): Likewise.
|
||||
(fma_test_upward): Likewise.
|
||||
(hypot_test_data): Update call to AUTO_TESTS_ff_f.
|
||||
(j0_test_data): Update call to AUTO_TESTS_f_f.
|
||||
(j1_test_data): Likewise.
|
||||
(jn_test_data): Update call to AUTO_TESTS_if_f.
|
||||
(lgamma_test_data): Update call to AUTO_TESTS_f_f1.
|
||||
(log_test_data): Update call to AUTO_TESTS_f_f.
|
||||
(log10_test_data): Likewise.
|
||||
(log1p_test_data): Likewise.
|
||||
(log2_test_data): Likewise.
|
||||
(pow_test_data): Update call to AUTO_TESTS_ff_f.
|
||||
(pow_tonearest_test_data): Likewise.
|
||||
(sin_test_data): Update call to AUTO_TESTS_f_f.
|
||||
(sin_test): Use ALL_RM_TEST.
|
||||
(sin_tonearest_test_data): Remove.
|
||||
(sin_test_tonearest): Likewise.
|
||||
(sin_towardzero_test_data): Likewise.
|
||||
(sin_test_towardzero): Likewise.
|
||||
(sin_downward_test_data): Likewise.
|
||||
(sin_test_downward): Likewise.
|
||||
(sin_upward_test_data): Likewise.
|
||||
(sin_test_upward): Likewise.
|
||||
(sincos_test_data): Update call to AUTO_TESTS_fFF_11.
|
||||
(sinh_test_data): Update call to AUTO_TESTS_f_f.
|
||||
(sinh_test): Use ALL_RM_TEST.
|
||||
(sinh_tonearest_test_data): Remove.
|
||||
(sinh_test_tonearest): Likewise.
|
||||
(sinh_towardzero_test_data): Likewise.
|
||||
(sinh_test_towardzero): Likewise.
|
||||
(sinh_downward_test_data): Likewise.
|
||||
(sinh_test_downward): Likewise.
|
||||
(sinh_upward_test_data): Likewise.
|
||||
(sinh_test_upward): Likewise.
|
||||
(sqrt_test_data): Update call to AUTO_TESTS_f_f.
|
||||
(sqrt_test): Use ALL_RM_TEST.
|
||||
(sqrt_tonearest_test_data): Remove.
|
||||
(sqrt_test_tonearest): Likewise.
|
||||
(sqrt_towardzero_test_data): Likewise.
|
||||
(sqrt_test_towardzero): Likewise.
|
||||
(sqrt_downward_test_data): Likewise.
|
||||
(sqrt_test_downward): Likewise.
|
||||
(sqrt_upward_test_data): Likewise.
|
||||
(sqrt_test_upward): Likewise.
|
||||
(tan_test_data): Update call to AUTO_TESTS_f_f.
|
||||
(tan_test): Use ALL_RM_TEST.
|
||||
(tan_tonearest_test_data): Remove.
|
||||
(tan_test_tonearest): Likewise.
|
||||
(tan_towardzero_test_data): Likewise.
|
||||
(tan_test_towardzero): Likewise.
|
||||
(tan_downward_test_data): Likewise.
|
||||
(tan_test_downward): Likewise.
|
||||
(tan_upward_test_data): Likewise.
|
||||
(tan_test_upward): Likewise.
|
||||
(tanh_test_data): Update call to AUTO_TESTS_f_f.
|
||||
(tgamma_test_data): Likewise.
|
||||
(y0_test_data): Likewise.
|
||||
(y1_test_data): Likewise.
|
||||
(yn_test_data): Update call to AUTO_TESTS_if_f.
|
||||
(main): Do not call removed functions.
|
||||
|
||||
2014-03-19 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* math/libm-test.inc (fdim_test): Use ALL_RM_TEST.
|
||||
|
@ -378,114 +378,136 @@ sub generate_testfile {
|
||||
|
||||
# Replace the special macros
|
||||
while (<INPUT>) {
|
||||
# AUTO_TESTS (function, mode),
|
||||
# AUTO_TESTS (function),
|
||||
if (/^\s*AUTO_TESTS_/) {
|
||||
my ($descr, $func, $mode, $auto_test, $num_auto_tests);
|
||||
($descr, $func, $mode) = ($_ =~ /AUTO_TESTS_(\w+)\s*\((\w+),\s*(\w+)\)/);
|
||||
$num_auto_tests = 0;
|
||||
foreach $auto_test (sort keys %{$auto_tests{$func}{$mode}}) {
|
||||
my ($finputs, $format, $inputs, $outputs, $flags);
|
||||
my ($format_conv, $flags_conv, @flags, %flag_cond);
|
||||
$num_auto_tests++;
|
||||
($finputs, $outputs, $flags) = split / : */, $auto_test;
|
||||
($format, $inputs) = split / /, $finputs, 2;
|
||||
$inputs =~ s/ /, /g;
|
||||
$outputs =~ s/ /, /g;
|
||||
$format_conv = convert_condition ($format);
|
||||
print OUTPUT "#if $format_conv\n";
|
||||
@flags = split / /, $flags;
|
||||
foreach (@flags) {
|
||||
if (/^([^:]*):(.*)$/) {
|
||||
my ($flag, $cond);
|
||||
$flag = $1;
|
||||
$cond = convert_condition ($2);
|
||||
if (defined ($flag_cond{$flag})) {
|
||||
if ($flag_cond{$flag} ne "1") {
|
||||
$flag_cond{$flag} .= " || $cond";
|
||||
}
|
||||
} else {
|
||||
$flag_cond{$flag} = $cond;
|
||||
}
|
||||
} else {
|
||||
$flag_cond{$_} = "1";
|
||||
my ($descr, $func, @modes, $auto_test, $num_auto_tests);
|
||||
my (@rm_tests, $rm, $i);
|
||||
@modes = qw(downward tonearest towardzero upward);
|
||||
($descr, $func) = ($_ =~ /AUTO_TESTS_(\w+)\s*\((\w+)\)/);
|
||||
for ($rm = 0; $rm <= 3; $rm++) {
|
||||
$rm_tests[$rm] = [sort keys %{$auto_tests{$func}{$modes[$rm]}}];
|
||||
}
|
||||
$num_auto_tests = scalar @{$rm_tests[0]};
|
||||
for ($rm = 1; $rm <= 3; $rm++) {
|
||||
if ($num_auto_tests != scalar @{$rm_tests[$rm]}) {
|
||||
die ("inconsistent numbers of tests for $func\n");
|
||||
}
|
||||
for ($i = 0; $i < $num_auto_tests; $i++) {
|
||||
if ($rm_tests[0][$i] ne $rm_tests[$rm][$i]) {
|
||||
die ("inconsistent list of tests of $func\n");
|
||||
}
|
||||
}
|
||||
$flags_conv = "";
|
||||
if (defined ($flag_cond{"no-test-inline"})) {
|
||||
$flags_conv .= or_cond_value ($flag_cond{"no-test-inline"},
|
||||
"NO_TEST_INLINE", "0");
|
||||
}
|
||||
if (defined ($flag_cond{"xfail"})) {
|
||||
$flags_conv .= or_cond_value ($flag_cond{"xfail"},
|
||||
"XFAIL_TEST", "0");
|
||||
}
|
||||
my (@exc_list) = qw(divbyzero inexact invalid overflow underflow);
|
||||
my ($exc);
|
||||
foreach $exc (@exc_list) {
|
||||
my ($exc_expected, $exc_ok, $no_exc, $exc_cond, $exc_ok_cond);
|
||||
$exc_expected = "\U$exc\E_EXCEPTION";
|
||||
$exc_ok = "\U$exc\E_EXCEPTION_OK";
|
||||
$no_exc = "0";
|
||||
if ($exc eq "inexact") {
|
||||
$exc_ok = "0";
|
||||
$no_exc = "NO_INEXACT_EXCEPTION";
|
||||
}
|
||||
if (defined ($flag_cond{$exc})) {
|
||||
$exc_cond = $flag_cond{$exc};
|
||||
} else {
|
||||
$exc_cond = "0";
|
||||
}
|
||||
if (defined ($flag_cond{"$exc-ok"})) {
|
||||
$exc_ok_cond = $flag_cond{"$exc-ok"};
|
||||
} else {
|
||||
$exc_ok_cond = "0";
|
||||
}
|
||||
$flags_conv .= or_cond_value ($exc_cond,
|
||||
cond_value ($exc_ok_cond,
|
||||
$exc_ok, $exc_expected),
|
||||
cond_value ($exc_ok_cond,
|
||||
$exc_ok, $no_exc));
|
||||
}
|
||||
my ($errno_expected, $errno_unknown_cond);
|
||||
if (defined ($flag_cond{"errno-edom"})) {
|
||||
if ($flag_cond{"errno-edom"} ne "1") {
|
||||
die ("unexpected condition for errno-edom");
|
||||
}
|
||||
if (defined ($flag_cond{"errno-erange"})) {
|
||||
die ("multiple errno values expected");
|
||||
}
|
||||
$errno_expected = "ERRNO_EDOM";
|
||||
} elsif (defined ($flag_cond{"errno-erange"})) {
|
||||
if ($flag_cond{"errno-erange"} ne "1") {
|
||||
die ("unexpected condition for errno-erange");
|
||||
}
|
||||
$errno_expected = "ERRNO_ERANGE";
|
||||
} else {
|
||||
$errno_expected = "ERRNO_UNCHANGED";
|
||||
}
|
||||
if (defined ($flag_cond{"errno-edom-ok"})) {
|
||||
if (defined ($flag_cond{"errno-erange-ok"})
|
||||
&& $flag_cond{"errno-erange-ok"} ne $flag_cond{"errno-edom-ok"}) {
|
||||
$errno_unknown_cond = "($flag_cond{\"errno-edom-ok\"} || $flag_cond{\"errno-erange-ok\"})";
|
||||
} else {
|
||||
$errno_unknown_cond = $flag_cond{"errno-edom-ok"};
|
||||
}
|
||||
} elsif (defined ($flag_cond{"errno-erange-ok"})) {
|
||||
$errno_unknown_cond = $flag_cond{"errno-erange-ok"};
|
||||
} else {
|
||||
$errno_unknown_cond = "0";
|
||||
}
|
||||
$flags_conv .= or_cond_value ($errno_unknown_cond,
|
||||
"0", $errno_expected);
|
||||
if ($flags_conv ne "") {
|
||||
$flags_conv =~ s/^ \|/,/;
|
||||
}
|
||||
&parse_args (\*OUTPUT, $descr,
|
||||
"$func, $inputs, $outputs$flags_conv");
|
||||
print OUTPUT "#endif\n";
|
||||
}
|
||||
if ($num_auto_tests == 0) {
|
||||
die ("no automatic tests for $func, $mode\n");
|
||||
die ("no automatic tests for $func\n");
|
||||
}
|
||||
foreach $auto_test (@{$rm_tests[0]}) {
|
||||
my ($format, $inputs, $format_conv, $args_str);
|
||||
($format, $inputs) = split / /, $auto_test, 2;
|
||||
$inputs =~ s/ /, /g;
|
||||
$format_conv = convert_condition ($format);
|
||||
print OUTPUT "#if $format_conv\n";
|
||||
$args_str = "$func, $inputs";
|
||||
for ($rm = 0; $rm <= 3; $rm++) {
|
||||
my ($auto_test_out, $outputs, $flags);
|
||||
my ($flags_conv, @flags, %flag_cond);
|
||||
$auto_test_out = $auto_tests{$func}{$modes[$rm]}{$auto_test};
|
||||
($outputs, $flags) = split / : */, $auto_test_out;
|
||||
$outputs =~ s/ /, /g;
|
||||
@flags = split / /, $flags;
|
||||
foreach (@flags) {
|
||||
if (/^([^:]*):(.*)$/) {
|
||||
my ($flag, $cond);
|
||||
$flag = $1;
|
||||
$cond = convert_condition ($2);
|
||||
if (defined ($flag_cond{$flag})) {
|
||||
if ($flag_cond{$flag} ne "1") {
|
||||
$flag_cond{$flag} .= " || $cond";
|
||||
}
|
||||
} else {
|
||||
$flag_cond{$flag} = $cond;
|
||||
}
|
||||
} else {
|
||||
$flag_cond{$_} = "1";
|
||||
}
|
||||
}
|
||||
$flags_conv = "";
|
||||
if (defined ($flag_cond{"no-test-inline"})) {
|
||||
$flags_conv .= or_cond_value ($flag_cond{"no-test-inline"},
|
||||
"NO_TEST_INLINE", "0");
|
||||
}
|
||||
if (defined ($flag_cond{"xfail"})) {
|
||||
$flags_conv .= or_cond_value ($flag_cond{"xfail"},
|
||||
"XFAIL_TEST", "0");
|
||||
}
|
||||
my (@exc_list) = qw(divbyzero inexact invalid overflow underflow);
|
||||
my ($exc);
|
||||
foreach $exc (@exc_list) {
|
||||
my ($exc_expected, $exc_ok, $no_exc, $exc_cond, $exc_ok_cond);
|
||||
$exc_expected = "\U$exc\E_EXCEPTION";
|
||||
$exc_ok = "\U$exc\E_EXCEPTION_OK";
|
||||
$no_exc = "0";
|
||||
if ($exc eq "inexact") {
|
||||
$exc_ok = "0";
|
||||
$no_exc = "NO_INEXACT_EXCEPTION";
|
||||
}
|
||||
if (defined ($flag_cond{$exc})) {
|
||||
$exc_cond = $flag_cond{$exc};
|
||||
} else {
|
||||
$exc_cond = "0";
|
||||
}
|
||||
if (defined ($flag_cond{"$exc-ok"})) {
|
||||
$exc_ok_cond = $flag_cond{"$exc-ok"};
|
||||
} else {
|
||||
$exc_ok_cond = "0";
|
||||
}
|
||||
$flags_conv .= or_cond_value ($exc_cond,
|
||||
cond_value ($exc_ok_cond,
|
||||
$exc_ok, $exc_expected),
|
||||
cond_value ($exc_ok_cond,
|
||||
$exc_ok, $no_exc));
|
||||
}
|
||||
my ($errno_expected, $errno_unknown_cond);
|
||||
if (defined ($flag_cond{"errno-edom"})) {
|
||||
if ($flag_cond{"errno-edom"} ne "1") {
|
||||
die ("unexpected condition for errno-edom");
|
||||
}
|
||||
if (defined ($flag_cond{"errno-erange"})) {
|
||||
die ("multiple errno values expected");
|
||||
}
|
||||
$errno_expected = "ERRNO_EDOM";
|
||||
} elsif (defined ($flag_cond{"errno-erange"})) {
|
||||
if ($flag_cond{"errno-erange"} ne "1") {
|
||||
die ("unexpected condition for errno-erange");
|
||||
}
|
||||
$errno_expected = "ERRNO_ERANGE";
|
||||
} else {
|
||||
$errno_expected = "ERRNO_UNCHANGED";
|
||||
}
|
||||
if (defined ($flag_cond{"errno-edom-ok"})) {
|
||||
if (defined ($flag_cond{"errno-erange-ok"})
|
||||
&& ($flag_cond{"errno-erange-ok"}
|
||||
ne $flag_cond{"errno-edom-ok"})) {
|
||||
$errno_unknown_cond = "($flag_cond{\"errno-edom-ok\"} || $flag_cond{\"errno-erange-ok\"})";
|
||||
} else {
|
||||
$errno_unknown_cond = $flag_cond{"errno-edom-ok"};
|
||||
}
|
||||
} elsif (defined ($flag_cond{"errno-erange-ok"})) {
|
||||
$errno_unknown_cond = $flag_cond{"errno-erange-ok"};
|
||||
} else {
|
||||
$errno_unknown_cond = "0";
|
||||
}
|
||||
$flags_conv .= or_cond_value ($errno_unknown_cond,
|
||||
"0", $errno_expected);
|
||||
if ($flags_conv eq "") {
|
||||
$flags_conv = ", NO_EXCEPTION";
|
||||
} else {
|
||||
$flags_conv =~ s/^ \|/,/;
|
||||
}
|
||||
$args_str .= ", $outputs$flags_conv";
|
||||
}
|
||||
&parse_args (\*OUTPUT, $descr, $args_str);
|
||||
print OUTPUT "#endif\n";
|
||||
}
|
||||
next;
|
||||
}
|
||||
@ -686,8 +708,8 @@ sub parse_auto_input {
|
||||
chop;
|
||||
next if !/^= /;
|
||||
s/^= //;
|
||||
if (/^(\S+) (\S+) (.*)$/) {
|
||||
$auto_tests{$1}{$2}{$3} = 1;
|
||||
if (/^(\S+) (\S+) ([^:]*) : (.*)$/) {
|
||||
$auto_tests{$1}{$2}{$3} = $4;
|
||||
} else {
|
||||
die ("bad automatic test line: $_\n");
|
||||
}
|
||||
|
1005
math/libm-test.inc
1005
math/libm-test.inc
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user