Joseph Myers [Tue, 11 Mar 2014 22:30:40 +0000 (22:30 +0000)]
Fix MIPS libc_feresetround*_ctx to preserve exceptions.
Testing on mips64 showed missing underflow exceptions (from exp, for
example) in non-default rounding modes, caused by
libc_feresetround*_ctx wrongly restoring a saved environment without
preserving exceptions, when that's only valid for the _noex variants.
(I don't know why Steve didn't see this in his testing.) This patch
fixes this by using libc_feupdateenv_mips_ctx for the relevant macros
and removing the problem definitions.
The problem definitions aren't suitable for the _noex macros either
because they only discard exceptions in non-default rounding modes,
and while for some uses of *_noex/*_NOEX it doesn't matter whether
exceptions are discarded, dbl-64/e_remainder.c requires
SET_RESTORE_ROUND_NOEX to cause exceptions to be discarded. I think
the accumulated set of macros / functions for optimized exception /
rounding mode handling could do with a careful review by now, and
possible refactoring, and at least one new feature (extracting the
saved rounding mode from an environment / context variable - see
dbl-64/e_sqrt.c for a case where this could be used).
Tested mips64.
* sysdeps/mips/math_private.h [__mips_hard_float]
(libc_feresetround_ctx): Define to libc_feupdateenv_mips_ctx not
libc_feresetround_mips_ctx.
[__mips_hard_float] (libc_feresetroundf_ctx): Likewise.
[__mips_hard_float] (libc_feresetroundl_ctx): Likewise.
[__mips_hard_float] (libc_feresetround_mips_ctx): Remove.
Joseph Myers [Tue, 11 Mar 2014 22:24:00 +0000 (22:24 +0000)]
Fix nextafter overflow in non-default rounding modes (bug 16677).
ISO C requires the result of nextafter to be independent of the
rounding mode, even when underflow or overflow occurs. This patch
fixes the bug in various nextafter implementations that, having done
an overflowing computation to force an overflow exception (correct),
they then return the result of that computation rather than an
infinity computed some other way (incorrect, when the overflowing
result of arithmetic with that sign and rounding mode is finite but
the correct result is infinite) - generally by falling through to
existing code to return a value that in fact is correct for this case
(but was computed by an integer increment and so without generating
the exceptions required). Having fixed the bug, the previously
deferred conversion of nextafter testing in libm-test.inc to
ALL_RM_TEST is also included.
Tested x86_64 and x86; also spot-checked results of nextafter tests
for powerpc32 and mips64 to test the ldbl-128ibm and ldbl-128
changes. (The m68k change is untested.)
[BZ #16677]
* math/s_nextafter.c (__nextafter): Do not return value from
overflowing computation.
* sysdeps/i386/fpu/s_nextafterl.c (__nextafterl): Likewise.
* sysdeps/ieee754/flt-32/s_nextafterf.c (__nextafterf): Likewise.
* sysdeps/ieee754/ldbl-128/s_nextafterl.c (__nextafterl):
Likewise.
* sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c (__nextafterl):
Likewise.
* sysdeps/m68k/m680x0/fpu/s_nextafterl.c (__nextafterl): Likewise.
* math/libm-test.inc (nextafter_test): Use ALL_RM_TEST.
PowerPC: Fix bzero definition for static libc for PPC64
This patch fixes an issue for powerpc64[le] static build where __bzero
is definied in multiple places (memset-ppc64.o and bzero.o). It is now
defined only in bzero.o and memset-ppc64.o only defined __bzero_ppc for
both dynamic and static library.
The optimization is achieved by following techniques:
> hashing of needle.
> hashing avoids scanning of duplicate entries in needle across the string.
> initializing the hash table with Vector instructions (VSX) by quadword access.
> unrolling when scanning for character in string across hash table.
The optimization is achieved by following techniques:
1. Doubleword aligned memory access and compares using
cmpb instruction.
2. Loop unrolling for byte load/store.
3. CPU pre-fetch to avoid cache miss.
Mark nscd service as forking in systemd service file (BZ #16639)
Currently the nscd service is installed in systemd as a simple
service, which means that it is able to handle its own errors and does
not quit. Since nscd does not fit that description, i.e. it can exit
on errors like, say, failing to parse nscd.conf, it should be declared
as forking instead.
This patch fix the optimized powerpc-fpu modf/modff implementation
when using in non-default rounding mode where the zero sign is not
as expected. It fixes the libm testsuite tests
Joseph Myers [Sat, 8 Mar 2014 14:08:38 +0000 (14:08 +0000)]
Add libm-test.inc macro for all-rounding-modes testing.
This patch adds support in libm-test.inc for automatically running
tests of a function in all rounding modes, in the form of a macro
ALL_RM_TEST to loop over all rounding modes when running tests of a
function, and uses it for functions whose results should always be
independent of the rounding mode.
Conversion of tests of nextafter to ALL_RM_TEST was deferred because
trying that conversion showed up bug 16677. (Finding such a bug of
course illustrates the point of testing more systematically in all
rounding modes rather than only reactively when bugs get reported in a
particular function in a non-default mode.) Conversion of tests where
results can depend on the rounding mode will follow once I add
gen-libm-test.pl support for using different initializers for the
expected results for different rounding modes (again, some conversions
may need deferring until bugs are fixed, depending on how
straightforward they are to XFAIL in a particular context).
Some existing tests get run five times rather than four, with
round-to-nearest tests both run in that as default rounding mode and
also with it explicitly set with fesetround (FE_TONEAREST). This
duplication doesn't seem particularly useful, so ALL_RM_TEST only runs
tests four times.
Joseph Myers [Fri, 7 Mar 2014 23:57:56 +0000 (23:57 +0000)]
Fix POSIX namespace for <bits/siginfo.h> (bug 16674).
<bits/siginfo.h> causes symbols ILL_*, FPE_*, SEGV_* BUS_*, CLD_*,
POLL_* and TRAP_* to be exposed in <signal.h> (and <sys/wait.h>), even
though those symbols are not in non-XSI POSIX before POSIX.1-2008 and
even in POSIX.1-2008 the TRAP_* symbols are XSI-only. This patch
conditions the symbols appropriately in the various <bits/siginfo.h>
implementations (various <signal.h> and <sys/wait.h> conformtest
issues remain for standards other than POSIX (1995/6)). Tested
x86_64.
Joseph Myers [Fri, 7 Mar 2014 20:54:03 +0000 (20:54 +0000)]
Include all of <time.h> from <sched.h> for older standards (bug 16670).
This patch fixes one of the header namespace issues shown up by
conformtest, <sched.h> failing to expose all symbols from <time.h> as
required by older standards. The patch keeps the existing behavior if
__USE_XOPEN2K is defined (the default; POSIX.1-2001 was the version
that made it optional to expose these symbols), but ensures that all
the symbols from <time.h> are exposed if an older standard is
selected. Tested x86_64.
Trapping exceptions in AArch64 are optional. The relevant exception
control bits in FPCR are are defined as RES0 hence the absence of
support can be detected by reading back the FPCR and comparing with
the desired value.
Joseph Myers [Fri, 7 Mar 2014 03:31:41 +0000 (03:31 +0000)]
Count miscellaneous files built on host for testing as tests.
In <https://sourceware.org/ml/libc-alpha/2014-01/msg00198.html> I
raised the question of counting miscellaneous dependencies of tests,
built on the host rather than the build system, as tests, so that when
test failures don't stop "make check" neither do those other builds on
the host, so that a flaky host doesn't stop "make check" from
producing a complete summary of test results. Brooks supported that
idea in <https://sourceware.org/ml/libc-alpha/2014-02/msg00301.html>.
This patch implements that change for all the examples I could find:
one message catalog in catgets/, locales in localedata/ and timezone
files in timezone/.
Tested x86_64.
* catgets/Makefile (tests-special): Add $(objpfx)sample.SJIS.cat.
($(objpfx)sample.SJIS.cat): Use $(evaluate-test).
* timezone/Makefile (testdata): Move definition above include of
Rules.
(test-zones): New variable.
(tests-special): Add zone files.
(build-testdata): Use $(evaluate-test).
localedata/ChangeLog:
* Makefile (LOCALES): Move definition above include of Rules.
(LOCALE_SRCS): Likewise.
(CHARMAPS): Likewise.
(CTYPE_FILES): Likewise.
(tests-special): Add locale files.
($(addprefix $(objpfx),$(CTYPE_FILES))): Use $(evaluate-test).
Joseph Myers [Fri, 7 Mar 2014 03:29:23 +0000 (03:29 +0000)]
Make tests consistently use *.out output files.
This patch systematically renames miscellaneous tests so their outputs
use a *.out name (unless the test is just running some glibc program
with its conventional output file name, rather than a special program
at all, as in catgets tests generating *.cat). In the case of the
iconv test test-iconvconfig, output is redirected where it wasn't
before.
In various places the "generated" variable is updated to reflect the
revised test names; in iconvdata/Makefile a typo (mmtrace-tst-loading)
is also fixed. resolv/Makefile sets both "generate" (which appears
unused) and "generated". Bitrot in the settings of these variables
could no doubt be fixed so that "make clean" after build and testing
leaves results the same as after configure (and indeed the
tests-special / xtests-special variables could be used to simplify
things, by removing those files automatically rather than listing them
manually in these variables), and "make distclean" leaves an empty
build directory, but right now it appears various files don't get
deleted. I think they are liable to continue to bitrot in the absence
of routine testing that these targets actually work, given that
building in the source directory isn't supported and that was the main
use of such makefile targets.
Tested x86_64.
* elf/Makefile (tests-special): Rename tests to end with .out.
($(objpfx)noload-mem): Likewise.
($(objpfx)tst-leaks1-mem): Likewise.
($(objpfx)tst-leaks1-static-mem.out): Likewise.
* iconv/Makefile (xtests-special): Change test-iconvconfig to
$(objpfx)test-iconvconfig.out.
(test-iconvconfig): Change to $(objpfx)test-iconvconfig.out. Use
set -e inside subshell and redirect output to file.
* iconvdata/Makefile (generated): Rename tests to end with .out.
Correct type.
(tests-special): Rename tests to end with .out.
($(objpfx)mtrace-tst-loading): Likewise.
* intl/Makefile (generated): Likewise.
(tests-special): Likewise.
($(objpfx)mtrace-tst-gettext): Likewise.
* misc/Makefile (generated): Likewise.
(tests-special): Likewise.
($(objpfx)tst-error1-mem): Likewise.
* nptl/Makefile (tests-special): Likewise.
($(objpfx)tst-stack3-mem): Likewise.
(generated): Likewise.
* posix/Makefile (generated): Likewise.
(tests-special): Likewise.
(xtests-special): Likewise.
($(objpfx)tst-fnmatch-mem): Likewise.
($(objpfx)bug-regex2-mem): Likewise.
($(objpfx)bug-regex14-mem): Likewise.
($(objpfx)bug-regex21-mem): Likewise.
($(objpfx)bug-regex31-mem): Likewise.
($(objpfx)tst-vfork3-mem): Likewise.
($(objpfx)tst-rxspencer-no-utf8-mem): Likewise.
($(objpfx)tst-pcre-mem): Likewise.
($(objpfx)tst-boost-mem): Likewise.
($(objpfx)bug-ga2-mem): Likewise.
($(objpfx)bug-glob2-mem): Likewise.
* resolv/Makefile (generate): Likewise.
(tests-special): Likewise.
(xtests-special): Likewise.
(generated): Likewise.
($(objpfx)mtrace-tst-leaks): Likewise.
($(objpfx)mtrace-tst-leaks2): Likewise.
localedata:
* Makefile (generated): Rename tests to end with .out.
(tests-special): Likewise.
($(objpfx)mtrace-tst-leaks): Likewise.
Joseph Myers [Fri, 7 Mar 2014 03:25:57 +0000 (03:25 +0000)]
Generate overall summary of test results.
This patch, an updated version of
<https://sourceware.org/ml/libc-alpha/2014-01/msg00197.html>, makes
testsuite runs generate an overall summary of test results.
A new script merge-test-results.sh deals both with collecting results
within a directory to a file with all the results from that directory,
and collecting the results from subdirectories into a single overall
file (there's not much in common between the two modes of operation of
the script, but it seemed silly to have two separate scripts for
this). Within a directory, missing results produce UNRESOLVED lines;
at top level, missing results for a whole directory produce an ERROR
line (since toplevel can't identify what the specific missing tests
are in this case).
Note that this does not change the rules for when "make" considers
there has been an error, or terminates, so unexpected failures will
still cause make to terminate, or, with -k, mean the commands for
"tests" don't get run because of failure of a dependency.
Tested x86_64, including that the summary does in fact reflect all the
tests with .test-result files.
* scripts/merge-test-results.sh: New file.
* Makefile (tests-special-notdir): New variable.
(tests): Run merge-test-results.sh.
(xtests): Likewise.
* Rules (tests-special-notdir): New variable.
(xtests-special-notdir): Likewise.
(tests): Run merge-test-results.sh
(xtests): Likewise.
Joseph Myers [Fri, 7 Mar 2014 03:23:34 +0000 (03:23 +0000)]
conformtest: split up running of tests from makefile.
This patch changes the logic by which header conformance tests are run
so that the makefiles run the tests for each (standard, header) pair
separately rather than as a single test (there are 518 such pairs
being tested at present).
Since these tests are slow and previously couldn't be run in parallel,
this obviously speeds up the whole test run significantly when using
parallel testing. There are other benefits. These tests can now be
marked as expected to fail at the level of (standard, header) pairs,
meaning that regressions introduced by a header change are much more
likely to be spotted (of course, such a regression could be a bug in
the header or in the expectations, most of which have not been
properly checked against the relevant standards).
The patch introduces lists in conform/Makefile of the headers to test
for each standard, with a new (quick) test for each standard that the
list agrees with the set of headers for which there are in fact
nonempty expectations for that standard. This means that each of the
518 pairs being tested is actually something meaningful to test rather
than a null test. I also hope to use these lists of headers in
various standards in future tests for namespace violations where a
function in a standard is implemented to call a non-reserved name for
a function outside that standard.
Although there are a lot of tests now marked as expected to fail, I
expect most of those to be easy to fix (whether with fixes to the
expectations, the headers or both - if fixing a header bug, of course
file it in Bugzilla first); only a limited number are likely to
reflect actual missing features in glibc.
Tested x86_64 (GCC 4.7 branch). It's quite possible some failures
vary from platform to platform, in which case either additional XFAILs
can be added here, or platform-specific header bugs (if applicable)
the failures show up can be fixed. I made XFAILs unconditional for
tests that should only fail for GCC 4.6 and earlier; we could make the
GCC version available in the makefiles and condition these, but simply
moving the XFAILing to a finer granularity seems a clear improvement
on the previous state of the whole of conformtest being XFAILed.
Joseph Myers [Fri, 7 Mar 2014 03:21:04 +0000 (03:21 +0000)]
conformtest: clean up POSIX expectations for semaphore.h, signal.h, tar.h.
Continuing the series of patches to clean up conformtest expectations
for "POSIX" (1995/6) based on review of the expectations against the
standard, this patch cleans up those for semaphore.h, signal.h and
tar.h (including various corrections for other standards for the
expectations affected by this patch). Tested x86_64.
(Some of the failures for signal.h shown up by this patch correcting
expectations for that header are among the reasons for posix/annexc
being expected to fail. The goal is for conformtest eventually to
replace posix/annexc and stdlib/isomac once it has all relevant
functionality, and for the loop over standards and headers in
conformtest to convert to separate makefile targets for each
combination, so they can be run in parallel and so that xfails can be
more specific than the present xfailing of the whole of conformtest.)
Joseph Myers [Thu, 6 Mar 2014 22:35:33 +0000 (22:35 +0000)]
Enumerate tests with special rules in tests-special variable.
This patch is a revised and updated version of
<https://sourceware.org/ml/libc-alpha/2014-01/msg00196.html>.
In order to generate overall summaries of the results of all tests in
the glibc testsuite, we need to identify and concatenate the files
with the results of individual tests.
Tomas Dohnalek's patch used $(common-objpfx)*/*.test-result for this.
However, the normal glibc approach is explicit enumeration of the
expected set of files with a given property, rather than all files
matching some pattern like that. Furthermore, we would like to be
able to mark tests as UNRESOLVED if the file with their results is for
some reason missing, and in future we would like to be able to mark
tests as UNSUPPORTED if they are disabled for a particular
configuration (rather than simply having them missing from the list of
tests as at present). Such handling of tests that were not run or did
not record results requires an explicit enumeration of tests.
For the tests following the default makefile rules, $(tests) (and
$(xtests)) provides such an enumeration. Others, however, are added
directly as dependencies of the "tests" and "xtests" makefile
targets. This patch changes the makefiles to put them in variables
tests-special and xtests-special, with appropriate dependencies on the
tests listed there then being added centrally.
Those variables are used in Rules and so need to be set before Rules
is included in a subdirectory makefile, which is often earlier in the
makefile than the dependencies were present before. We previously
discussed the question of where to include Rules; see the question at
<https://sourceware.org/ml/libc-alpha/2012-11/msg00798.html>, and a
discussion in
<https://sourceware.org/ml/libc-alpha/2013-01/msg00337.html> of why
Rules is included early rather than late in subdirectory makefiles.
It was necessary to avoid an indirection through the check-abi target
and get the check-abi-* targets for individual libraries into the
tests-special variable. The intl/ test $(objpfx)tst-gettext.out,
previously built only because of dependencies from other tests, was
also added to tests-special for the same reason.
The entries in tests-special are the full makefile targets, complete
with $(objpfx) and .out. If a future change causes tests to be named
consistently with a .out suffix, this can be changed to include just
the path relative to $(objpfx), without .out.
Tested x86_64, including that the same set of files is generated in
the build directory by a build and testsuite run both before and after
the patch (except for changes to the
elf/tst-null-argv.debug.out.<number> file name), and a build with
run-built-tests=no to verify there aren't any more obvious instances
of the issue Marcus Shawcroft reported with a previous version in
<https://sourceware.org/ml/libc-alpha/2014-01/msg00462.html>.
* Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
(tests): Depend on $(tests-special).
* Makerules (check-abi-list): New variable.
(check-abi): Depend on $(check-abi-list).
[$(subdir) = elf] (tests-special): Add
$(objpfx)check-abi-libc.out.
[$(build-shared) = yes && subdir] (tests-special): Add
$(check-abi-list).
[$(build-shared) = yes && subdir] (tests): Do not depend on
check-abi.
* Rules (tests): Depend on $(tests-special).
(xtests): Depend on $(xtests-special).
* catgets/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* conform/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* elf/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* grp/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* iconv/Makefile (xtests): Change dependencies to ....
(xtests-special): ... additions to this variable.
* iconvdata/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* intl/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable. Also add
$(objpfx)tst-gettext.out.
* io/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* libio/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* malloc/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* misc/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* nptl/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* nptl_db/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* posix/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
(xtests): Change dependencies to ....
(xtests-special): ... additions to this variable.
* resolv/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
(xtests): Change dependencies to ....
(xtests-special): ... additions to this variable.
* stdio-common/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
(do-tst-unbputc): Remove target.
(do-tst-printf): Likewise.
* stdlib/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* string/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
* sysdeps/x86/Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
localedata:
* Makefile (tests): Change dependencies to ....
(tests-special): ... additions to this variable.
Joseph Myers [Thu, 6 Mar 2014 17:43:46 +0000 (17:43 +0000)]
conformtest: correct set of standards for which more headers are tested.
Continuing the corrections to which headers conformtest tests for
which standards, this patch corrects conformtest mistakes regarding
which headers to test for the remaining standards (XOPEN2K POSIX2008
XOPEN2K8). Tested x86_64.
Joseph Myers [Thu, 6 Mar 2014 17:42:03 +0000 (17:42 +0000)]
conformtest: correct set of standards for which some headers are tested.
Reviewing the sets of headers for which conformtest has expectations
for various standards showed up cases where headers had expectations
for standards not including those headers, or were missing
expectations for a standard that did include the header. This patch
fixes easy cases of this (largely disabling tests for standards for
which they are inapplicable). Tested x86_64.
Joseph Myers [Thu, 6 Mar 2014 14:15:00 +0000 (14:15 +0000)]
Prepare libm-test.inc structures for multi-rounding-mode testing.
At present, libm-test.inc tests are run in multiple rounding modes by
having a separate array for each rounding mode (which might or might
not have the same test inputs as the other such arrays), a separate
function calling a RUN_TEST_LOOP_* macro over that array, and a
separate call to that function in main. The number of functions
tested in multiple rounding modes has gradually increased as
rounding-mode-specific bugs have been found and fixed in different
functions.
It would be better to be able to use a single macro call, in a single
function, to run tests for a function over all rounding modes, with
this being done for all libm functions except in cases where it's
deferred until some bugs can be fixed because XFAILing all affected
tests would be painful (that's why the full set of pow tests isn't
currently run in all rounding modes). This patch helps prepare for
that by making the structures storing expected results for tests store
results for all four rounding modes. After this patch, the results
for all modes are just duplicates, but tests access the appropriate
field in the structure, so helping to pave the way for when the fields
stop being duplicates and multiple rounding modes can be tested from a
single array. Tests might in future specify a single set of results,
to be used in all rounding modes; separate results for each rounding
mode, specified manually; or use of auto-libm-tests-* to generate
results for each rounding mode.
Joseph Myers [Thu, 6 Mar 2014 14:13:18 +0000 (14:13 +0000)]
Don't define __ASSUME_UTIMES for linux-generic architectures.
The __ASSUME_UTIMES macro describes whether the utimes syscall is
present. For linux-generic architectures, it isn't (utimensat is
instead), so the macro should not be defined for them; this patch
removes the spurious definitions for such architectures. (Those
definitions don't actually cause any user-visible bug, because
futimes.c doesn't use __ASSUME_UTIMES if __ASSUME_UTIMENSAT is
defined, and futimesat.c and utimes.c are overridden for
linux-generic, but the definitions are still logically incorrect.)
Joseph Myers [Thu, 6 Mar 2014 14:11:19 +0000 (14:11 +0000)]
Adjust how gen-auto-libm-tests handles before-rounding/after-rounding cases.
This patch changes gen-auto-libm-tests so that, when generating test
results that depend on whether the architecture has before-rounding or
after-rounding tininess detection, the :before-rounding or
:after-rounding conditions go on the exception / errno flags
generated, rather than generating two separate lines in
auto-libm-test-out for e.g. flt-32:before-rounding and
flt-32:after-rounding.
The rationale for this is as follows. It would be desirable for
testing a libm function in all rounding modes to require just one
function and array in libm-test.inc, not four (or five), with the
array of test data including expected results for all rounding modes
rather than separate arrays for each rounding mode that also need to
repeat all the test inputs. For gen-libm-test.pl to generate data for
such an array from auto-libm-test-out, it would be helpful if each
(format, test input) pair has exactly four lines in
auto-libm-test-out, one for each rounding mode, rather than some
rounding modes having just one line and some having two because the
exceptions depend on tininess detection.
Tested x86_64 and x86.
* math/gen-auto-libm-tests.c: Update comment on output format.
(output_for_one_input_case): Generate before-rounding and
after-rounding information as conditions on output flags not
floating-point format.
* math/auto-libm-test-out: Regenerated.
* math/gen-libm-test.pl (cond_value): New function.
(or_cond_value): Use cond_value.
(generate_testfile): Handle conditional exceptions.
Joseph Myers [Wed, 5 Mar 2014 15:05:20 +0000 (15:05 +0000)]
Automatically check sanity of ulps from libm tests.
This patch makes libm-test.inc apply sanity checks to ulps values
resulting from tests, or found in libm-test-ulps files, to avoid the
need for manual checking/editing of new ulps for cases that are
excessively large or involve functions that should not have any ulps.
For IBM long double, errors must be at most 14ulp (the largest
currently checked-in value), or at most 3ulp (the documented error
bound for division) in the case of exactly-determined functions; for
other formats, the limits are 9ulp (also the largest currently
checked-in value) and 0ulp. Limits from ulps files are saturated to
those bounds, and regen-ulps will ignore any errors outside those
bounds. (Thus if, say, you have an architecture-specific problem with
fma, the tests can still be XFAILed in auto-libm-test-in, but errors
outside the permitted range can no longer be listed in
libm-test-ulps.)
Joseph Myers [Wed, 5 Mar 2014 15:02:38 +0000 (15:02 +0000)]
Don't include individual test ulps in libm-test-ulps.
As recently discussed
<https://sourceware.org/ml/libc-alpha/2014-02/msg00670.html>, it
doesn't seem particularly useful for libm-test-ulps files to contain
huge amounts of data on ulps for individual tests; just the global
maximum observed ulps for each function, together with the
verification of exceptions, errno and special results such as
infinities and NaNs for each test, suffices to verify that a
function's behavior on the given test inputs is within the expected
accuracy. Removing this data reduces source tree churn caused by
updates to these files when libm tests are added, and reduces the
frequency with which testsuite additions actually need libm-test-ulps
changes at all.
Accordingly, this patch removes that data, so that individual tests
get checked against the global bounds for the given function and only
generate an error if those are exceeded. Tested x86_64 (including
verifying that if an ulps value is artificially reduced, the tests do
indeed fail as they should and "make regen-ulps" generates the
expected changes).
* math/libm-test.inc (struct ulp_data): Don't refer to ulps for
individual tests in comment.
(libm-test-ulps.h): Don't refer to test_ulps in #include comment.
(prev_max_error): New variable.
(prev_real_max_error): Likewise.
(prev_imag_max_error): Likewise.
(compare_ulp_data): Don't refer to test names in comment.
(find_test_ulps): Remove function.
(find_function_ulps): Likewise.
(find_complex_function_ulps): Likewise.
(init_max_error): Take function name as argument. Look up ulps
for that function.
(print_ulps): Remove function.
(print_max_error): Use prev_max_error instead of calling
find_function_ulps.
(print_complex_max_error): Use prev_real_max_error and
prev_imag_max_error instead of calling find_complex_function_ulps.
(check_float_internal): Take max_ulp parameter instead of calling
find_test_ulps. Don't call print_ulps.
(check_float): Update call to check_float_internal.
(check_complex): Update calls to check_float_internal.
(START): Pass argument to init_max_error.
* math/gen-libm-test.pl (%results): Don't include "kind"
information.
(parse_ulps): Don't handle ulps of individual tests.
(print_ulps_file): Likewise.
(output_ulps): Likewise.
* math/README.libm-test: Update.
* manual/libm-err-tab.pl (parse_ulps): Don't handle ulps of
individual tests.
* sysdeps/aarch64/libm-test-ulps: Remove individual test ulps.
* sysdeps/alpha/fpu/libm-test-ulps: Likewise.
* sysdeps/arm/libm-test-ulps: Likewise.
* sysdeps/i386/fpu/libm-test-ulps: Likewise.
* sysdeps/ia64/fpu/libm-test-ulps: Likewise.
* sysdeps/m68k/coldfire/fpu/libm-test-ulps: Likewise.
* sysdeps/m68k/m680x0/fpu/libm-test-ulps: Likewise.
* sysdeps/microblaze/libm-test-ulps: Likewise.
* sysdeps/mips/mips32/libm-test-ulps: Likewise.
* sysdeps/mips/mips64/libm-test-ulps: Likewise.
* sysdeps/powerpc/fpu/libm-test-ulps: Likewise.
* sysdeps/powerpc/nofpu/libm-test-ulps: Likewise.
* sysdeps/s390/fpu/libm-test-ulps: Likewise.
* sysdeps/sh/libm-test-ulps: Likewise.
* sysdeps/sparc/fpu/libm-test-ulps: Likewise.
* sysdeps/tile/libm-test-ulps: Likewise.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
* sysdeps/hppa/fpu/libm-test-ulps: Remove individual test ulps.
Joseph Myers [Tue, 4 Mar 2014 14:16:25 +0000 (14:16 +0000)]
Fix libm-test.inc:print_complex_max_error handling of some error cases.
When regenerating ulps incrementally with "make regen-ulps", the
resulting diffs should only increase existing ulps, never decrease
them. This allows successive uses of "make regen-ulps" on different
hardware or with different compiler configurations to accumulate ulps
that are sufficient for tests to pass in a variety of configurations.
However, sometimes changes that decrease ulps are wrongly generated;
thus, when applying
<https://sourceware.org/ml/libc-alpha/2014-02/msg00605.html> I had to
remove such changes manually. The problem is
print_complex_max_error. If the ulps for either the real or the
imaginary part of a function are out of range, this function prints
the maximum ulps seen for both parts, which then replace those
previously in libm-test-ulps. So if the ulps for one part are bigger
than recorded before, but those for the other part are smaller, the
diffs reduce existing ulps.
This patch fixes the logic so that only increased ulps get printed.
Tested x86_64 ("make math/tests", and "make regen-ulps" in a situation
with ulps manually modified so one part would go up and the other
down, to confirm the changes have the intended effect then).
* math/libm-test.inc (print_complex_max_error): Check separately
whether real and imaginary errors are within allowed range and
pass 0 to print_complex_function_ulps instead of value within
allowed range.
The cached offset is reliable to use in ftell when the stream handle
is active. We can consider a stream as being active when there is
unflushed data. However, even in this case, we can use the cached
offset only when the stream is not being written to in a+ mode,
because this case may have unflushed data and a stale offset; the
previous read could have sent it off somewhere other than the end of
the file.
There were a couple of adjustments necessary to get this to work.
Firstly, fdopen now ceases to use _IO_attach_fd because it sets the
offset cache to the current file position. This is not correct
because there could be changes to the file descriptor before the
stream handle is activated, which would not get reflected.
A similar offset caching action is done in _IO_fwide, claiming that
wide streams have 'problems' with the file offsets. There don't seem
to be any obvious problems with not having the offset cache available,
other than that it will have to be queried in a subsequent
read/write/seek. I have removed this as well.
The testsuite passes successfully with these changes on x86_64.
Separate ftell from fseek logic and avoid modifying FILE data (#16532)
ftell semantics are distinct from fseek(SEEK_CUR) especially when it
is called on a file handler that is not yet active. Due to this
caveat, much care needs to be taken while modifying the handler data
and hence, this first iteration on separating out ftell focusses on
maintaining handler data integrity at all times while it figures out
the current stream offset. The result is that it makes a syscall for
every offset request.
There is scope for optimizing this by caching offsets when we know
that the handler is active. A simple way to find out is when the
buffers have data. It is not so simple to find this out when the
buffer is empty without adding some kind of flag.
nscd: Improved support for tracking startup failure in nscd service (BZ #16639)
Currently, the nscd parent process parses commandline options and
configuration, forks on startup and immediately exits with a success.
If the child process encounters some error after this, it goes
undetected and any services started up after it may have to repeatedly
check to make sure that the nscd service did actually start up and is
serving requests.
To make this process more reliable, I have added a pipe between the
parent and child process, through which the child process sends a
notification to the parent informing it of its status. The parent
waits for this status and once it receives it, exits with the
corresponding exit code. So if the child service sends a success
status (0), the parent exits with a success status. Similarly for
error conditions, the child sends the non-zero status code, which the
parent passes on as the exit code.
This, along with setting the nscd service type to forking in its
systemd configuration file, allows systemd to be certain that the nscd
service is ready and is accepting connections.
Objections were raised surrounding the calloc simplification
and it is better to revert the patch, continue discussions
and then submit a new patch for inclusion with all issues
fully addressed.
This patch optimizes strrchr() for ppc64. It uses aligned memory
access along with cmpb instruction and CPU prefetch to avoid
cache misses for speed improvement.
Carlos O'Donell [Fri, 28 Feb 2014 23:30:22 +0000 (18:30 -0500)]
Add header and standard information to threads.texi.
The glibc manual uses special annotations to include functions
in the summary chapter. These annotations were missing from the
functions in the threads chapter. This patch adds those special
markers and in turn adds these functions to the summary chapter.
Carlos O'Donell [Fri, 28 Feb 2014 23:11:06 +0000 (18:11 -0500)]
Promote do_lookup_x:check_match to a full function.
While it may be argued that nested functions make the resulting
code easier to read, or worse to read the following two bugs
make it difficult to debug:
Bug 8300 - no local symbol information within nested or nesting
procedures
https://sourceware.org/bugzilla/show_bug.cgi?id=8300
Bug 53927 - wrong value for DW_AT_static_link
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53927
Until these are fixed I've made check_match a full function.
After they are fixed we can resume arguing about the merits
of nested functions on readability and maintenance.
This patch add a optimized llround/llroundf implementation for POWER8
using the new Move From VSR Doubleword instruction to gains some
cycles from FP to GRP register move.
This patch add a optimized llrint/llrintf implementation for POWER8
using the new Move From VSR Doubleword instruction to gains some
cycles from FP to GRP register move.
This patch add a optimized finite/finitef implementation for POWER8
using the new Move From VSR Doubleword instruction to gains some
cycles from FP to GRP register move.
This patch add a optimized isinf/isinff implementation for POWER8
using the new Move From VSR Doubleword instruction to gains some
cycles from FP to GRP register move.
This patch add a optimized isnan/isnanf implementation for POWER8
using the new Move From VSR Doubleword instruction to gains some
cycles from FP to GRP register move.
Joey Ye [Thu, 27 Feb 2014 17:44:43 +0000 (17:44 +0000)]
Fix ARM NAN fraction bits.
Current ARM soft-float implementation is violating the RTABI
(http://infocenter.arm.com/help/topic/com.arm.doc.ihi0043d/IHI0043D_rtabi.pdf)
Section 4.1.1.1:
When not otherwise specified by IEEE 754, the result on an invalid
operation should be the quiet NaN bit pattern with only the most
significant bit of the significand set, and all other significand bits
zero.
This patch fixes it by setting _FP_NANFRAC_* to zero.
Ran make check test with -mfloat-abi=soft. No regression.
* sysdeps/arm/soft-fp/sfp-machine.h (_FP_NANFRAC_S, _FP_NANFRAC_D)
(_FP_NANFRAC_Q): Set to zero.
In 84ba214c, I removed some redundant sign computations and in the
process, I incorrectly got rid of a temporary variable, thus passing
the absolute value of the input to bsloww1. This caused #16623.
Joseph Myers [Thu, 27 Feb 2014 03:25:27 +0000 (03:25 +0000)]
Support expected failures in .test-result files.
This patch, an updated version of
<https://sourceware.org/ml/libc-alpha/2014-01/msg00195.html>, makes it
possible for .test-result files for individual tests to contain XPASS
and XFAIL rather than PASS and FAIL in cases where failure is
expected. This replaces the marking of two individual tests with "-"
to cause them to be expected at makefile level to fail;
evaluate-test.sh will ensure it exits with status 0 for an expected
failure.
Tested x86_64.
* scripts/evaluate-test.sh: Take new argument indicating whether
failure is expected.
* Makeconfig (evaluate-test): Pass argument to evaluate-test.sh
indicating whether failure is expected.
* conform/Makefile (test-xfail-run-conformtest): New variable.
($(objpfx)run-conformtest.out): Don't expect to fail at makefile
level.
* posix/Makefile (test-xfail-annexc): New variable.
($(objpfx)annexc.out): Don't expect to fail at makefile level.
Joseph Myers [Wed, 26 Feb 2014 23:12:03 +0000 (23:12 +0000)]
Consistently include Makeconfig after defining subdir.
In <https://sourceware.org/ml/libc-alpha/2014-01/msg00196.html> I
noted it was necessary to add includes of Makeconfig early in various
subdirectory makefiles for the tests-special variable settings added
by that patch to be conditional on configuration information. No-one
commented on the general question there of whether Makeconfig should
always be included immediately after the definition of subdir.
This patch implements that early inclusion of Makeconfig in each
directory (which is a lot easier than consistent placement of includes
of Rules). Includes are added if needed, or moved up if already
present. Subdirectory "all:" targets are removed, since Makeconfig
provides one.
There is potential for further cleanups I haven't done. Rules and
Makerules have code such as
to override to empty any value of various variables that came from the
environment. I think there is a case for Makeconfig setting all the
subdirectory variables (other than subdir) to empty to ensure no
outside value is going to take effect if a subdirectory fails to
define a variable. (A list of such variables, possibly out of date
and incomplete, is in manual/maint.texi.) Rules and Makerules would
give errors if Makeconfig hadn't already been included, instead of
including it themselves. The special code to override values coming
from the environment would then be obsolete and could be removed.
Tested x86_64, including that installed binaries are identical before
and after the patch.
Steve Ellcey [Wed, 26 Feb 2014 22:19:20 +0000 (14:19 -0800)]
Add macros and inline functions to mips math_private.h file.
This is a patch to the MIPS math_private.h file to define HAVE_RM_CTX and
implement the ctx macros. I also defined a few other macros and inline
functions that I skipped the first time.
Carlos O'Donell [Wed, 26 Feb 2014 16:03:24 +0000 (11:03 -0500)]
Add a new "Inter-Process Communication" chapter.
This patch adds a new "Inter-Process Communication"
chapter to cover the sem*, msg*, and shm* functions.
Initially we document only the sem* function signatures
and their safety notes.
Ondřej Bílka [Wed, 26 Feb 2014 12:13:09 +0000 (13:13 +0100)]
Simplify calloc implementation.
To make future improvements of allocator simpler we could for now calloc
just call malloc and memset. With that we could omit a changes that
would duplicate malloc changes anyway.
Carlos O'Donell [Tue, 25 Feb 2014 18:23:25 +0000 (13:23 -0500)]
BZ #16632: Change [_BSD/_SVID]_SOURCE warning.
Source packages that need to support both 2.19 and
2.20 will need to decide to use _BSD_SOURCE and
_SVID_SOURCE vs. _DEFAULT_SOURCE.
The difficulty in making that decision is that
__GLIBC_MINOR__ is itself defined in features.h,
but you want to set the feature test macros before
including features.h.
Therefore to ease the transition we should disable
the warning if _DEFAULT_SOURCE is also defined.
Carlos O'Donell [Tue, 25 Feb 2014 18:00:36 +0000 (13:00 -0500)]
BZ #16613: Support TLS in audit libraries.
This commit fixes a bug where the dynamic loader would crash
when loading audit libraries, via LD_AUDIT, where those libraries
used TLS. The dynamic loader was not considering that the audit
libraries would use TLS and failed to bump the TLS generation
counter leaving TLS usage inconsistent after loading the audit
libraries.
Florian Weimer [Tue, 25 Feb 2014 13:56:10 +0000 (14:56 +0100)]
misc/sys/select.h (__FD_MASK): Avoid signed integer overflow.
Shifting into the sign position is currently supported as a GCC
extension, but explicitly subjected to future changes. Computation
in the unsigned type followed by a cast to the signed type is a GCC
extension that will be available forever.
Will Newton [Mon, 27 Jan 2014 09:01:03 +0000 (09:01 +0000)]
ARM: Add SystemTap probes to longjmp and setjmp.
Now the ARM port implements pointer encryption for jmpbufs, gdb needs
a SystemTap probe point in longjmp to determine the target PC of
a call to longjmp. This patch implements the probe point in longjmp
and a similar probe point in setjmp.
In order to have all the appropriate registers available to pass to the
probe this reorders the layout of jmpbuf, putting the sp and lr registers
at the start rather than the end, allowing them to be read and
written sequentially.
Tested on armv7, no new failures in the glibc testsuite and confirmed
that this fixes the gdb.base/longjmp.exp failures in the gdb testsuite.
ChangeLog:
2014-02-25 Will Newton <will.newton@linaro.org>
* sysdeps/arm/__longjmp.S: Include stap-probe.h.
(__longjmp): Restore sp and lr before restoring callee
saved registers. Add longjmp and longjmp_target
SystemTap probe point.
* sysdeps/arm/bits/setjmp.h (__jmp_buf): Update comment.
* sysdeps/arm/include/bits/setjmp.h (__JMP_BUF_SP):
Define to zero to match jmpbuf layout.
* sysdeps/arm/setjmp.S: Include stap-probe.h.
(__sigsetjmp): Save sp and lr before saving callee
saved registers. Add setjmp SystemTap probe point.
Joseph Myers [Fri, 21 Feb 2014 21:48:08 +0000 (21:48 +0000)]
Generate .test-result files for tests with special rules.
This patch, an updated version of
<https://sourceware.org/ml/libc-alpha/2014-01/msg00194.html> now
proposed for inclusion in glibc, extends the generation of PASS and
FAIL status in .test-result files for individual tests to cover tests
with their own custom makefile rules. This is just adding
$(evaluate-test) calls to all such rules, since tests with multiple
commands were previously split into separate tests.
Note that the tests the makefiles expect to fail (posix/annexc and
conformtest) currently get FAIL listed in the .test-result file,
rather than XFAIL; a subsequent patch will introduce a better XFAIL
mechanism.
This patch completes the headers cleanup consequent on removal of
_BSD_SOURCE and _SVID_SOURCE (apart from any subsequent deprecations):
* #endif conditionals that referred to BSD or SVID are updated.
* Redundant __USE_* tests in cases involving __USE_MISC are removed.
This includes cases such as __USE_MISC || __USE_ISOC99, where
__USE_MISC is redundant (because __USE_MISC is only ever defined in
the default / _DEFAULT_SOURCE / _GNU_SOURCE case, when __USE_ISOC99
is also defined; the same applies to the non-XSI-extended POSIX
versions), and cases involving __USE_GNU, where __USE_GNU is
redundant (because if __USE_GNU is defined, so are the other __USE_*
macros). There may well be other cases of __USE_FOO || __USE_BAR
tests that could be simplified because one macro implies the other;
this patch only addresses cases involving __USE_MISC.
Adam Conrad [Fri, 21 Feb 2014 07:24:03 +0000 (00:24 -0700)]
Allow sys/auxv.h to be used from the testsuite on powerpc and sparc.
elf/tst-auxv.c includes misc/sys/auxv.h, which ends up not actually
being included due to the guard overlap, and getauxval becomes an
implicit declaration and implicit pointer conversion which means, at
best, the test isn't actually testing what it thinks it is and, at
worst, it'll crash and burn on platforms where implict pointer
conversion is a Very Bad Thing.
* sysdeps/powerpc/bits/hwcap.h: Allow _SYSDEPS_SYSDEP_H guard as a
synonym for _SYS_AUXV_H to allow direct inclusion.
* sysdeps/sparc/bits/hwcap.h: Likewise.
* sysdeps/powerpc/sysdep.h: Define _SYSDEPS_SYSDEP_H instead of
_SYS_AUXV_H so we can include sysdep.h and sys/auxv.h together.
* sysdeps/sparc/sysdep.h: Likewise.
Joseph Myers [Thu, 20 Feb 2014 17:55:35 +0000 (17:55 +0000)]
Fix __ASSUME_SENDMMSG issues (bug 16611).
Similar to the issues for accept4 and recvmmsg, __ASSUME_SENDMMSG is
also confused about whether it relates to function availability or
socketcall operation availability, and the conditions for the
definition are always wrong (sendmmsg appeared in Linux kernel 3.0,
not 2.6.39); this is now bug 16611.
This patch splits the macro into separate macros like those for
accept4 and recvmmsg, defining them for appropriate kernel versions.
Tested x86_64, including that disassembly of the installed shared
libraries is unchanged by this patch.
Joseph Myers [Thu, 20 Feb 2014 17:53:08 +0000 (17:53 +0000)]
Fix __ASSUME_RECVMMSG issues (bug 16610).
Similar to the issues for accept4, __ASSUME_RECVMMSG is also confused
about whether it relates to function availability or socketcall
operation availability; this is now bug 16610.
Nothing actually tests __ASSUME_RECVMMSG for function availability,
but implicit in the definition in kernel-features.h is the idea that
it makes sense when the syscall is available and socketcall is not
being used. As with accept4, there are architectures where the
syscall was added later than the socketcall operation, meaning that
assuming glibc is built with recent enough kernel headers, it does not
attempt to use socketcall for these operations and __ASSUME_RECVMMSG
gets defined for kernels >= 2.6.33 even when the syscall was only
added later.
This patch splits the macro into separate macros like those used for
accept4; having similar macro structure in both cases (and for
sendmmsg once I've dealt with that) seems likely to be less confusing
than having a different structure on the basis of nothing actually
needing to assume the recvmmsg function works. Appropriate
definitions are added for all architectures.
Architecture-specific note: Tile's kernel-features.h says "TILE glibc
support starts with 2.6.36", which is accurate in that 2.6.36 was the
first kernel version with Tile support, and on that basis I've made
that header define __ASSUME_RECVMMSG_SYSCALL unconditionally.
However, Tile's configure.ac has arch_minimum_kernel=2.6.32. Since
arch_minimum_kernel is meant to reflect only kernel.org kernel
versions, I think that should change to 2.6.36. (If using glibc with
kernel versions from before a port went in kernel.org, it's your
responsibility to change arch_minimum_kernel in a local patch, and at
the same time to adjust any __ASSUME_* definitions that may not be
correct for your older kernel; for developing the official glibc it
should only ever be necessary to consider what official kernel.org
releases support.)
Tested x86_64, including that disassembly of the installed shared
libraries is unchanged by this patch.
Joseph Myers [Thu, 20 Feb 2014 17:50:31 +0000 (17:50 +0000)]
Fix __ASSUME_ACCEPT4 issues (bug 16609).
In <https://sourceware.org/ml/libc-alpha/2013-12/msg00008.html>,
Aurelien noted issues with the definition of __ASSUME_ACCEPT4, which I
discussed in more detail in
<https://sourceware.org/ml/libc-alpha/2013-12/msg00014.html>; these
are now bug 16609.
As previously noted, __ASSUME_ACCEPT4 is used in two ways:
* In OS-independent code, to mean "accept4 can be assumed to work
rather than fail with ENOSYS". It doesn't matter whether it's
implemented with socketcall or a separate syscall.
* In Linux-specific code, to mean "the socketcall multiplex syscall
can be assumed to handle the accept4 operation. When used in
Linux-specific code, it *never* refers to anything relating to the
accept4 syscall, only to the socketcall multiplexer.
This patch splits the macro into separate __ASSUME_ACCEPT4_SOCKETCALL,
__ASSUME_ACCEPT4_SYSCALL and __ASSUME_ACCEPT4 to clarify the different
cases involved. A macro __ASSUME_SOCKETCALL is added for convenience
in writing logic relating to all socketcall architectures. In
addition, to address the issue of architectures where socketcall
support for accept4 was added before a separate syscall was added (and
so the separate syscall should not be used unless known to be present
or fallback to socketcall is available), a fourth macro
__ASSUME_ACCEPT4_SYSCALL_WITH_SOCKETCALL is added to indicate that the
syscall became available at the same time as socketcall support. This
is then used in the relevant places in a conditional determining
whether to undefine __NR_accept4 (the simple approach to avoiding the
syscall's presence causing problems; I didn't try to implement runtime
fallback from the syscall to socketcall).
Architecture-specific note: alpha defined __ASSUME_ACCEPT4 for 2.6.33
and later, but actually the syscall was added for alpha in 3.2, so
this patch uses the correct condition for __ASSUME_ACCEPT4_SYSCALL
there.
Tested x86_64, including that disassembly of the installed shared
libraries is unchanged by this patch.
Joseph Myers [Wed, 19 Feb 2014 14:26:29 +0000 (14:26 +0000)]
Move tests of clog10 from libm-test.inc to auto-libm-test-in.
This patch moves tests of clog10 to auto-libm-test-in. Note that this
means gen-auto-libm-tests will now depend on the recent MPC 1.0.2
release which added a fix for a bug that made gen-auto-libm-tests hang
for clog10. (It still can't conveniently be used for cacos cacosh
casin casinh catan catanh csin csinh because of extreme slowness of
those functions for special cases in MPC; at least some slow cases of
csin / csinh are fixed in MPC trunk, but not in a release.)
Tested x86_64 and x86 and ulps updated accordingly.
* math/auto-libm-test-in: Add tests of clog10.
* math/auto-libm-test-out: Regenerated.
* math/libm-test.inc (clog10_test_data): Use AUTO_TESTS_c_c.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
Joseph Myers [Tue, 18 Feb 2014 21:48:51 +0000 (21:48 +0000)]
Move tests of fma from libm-test.inc to auto-libm-test-in.
This patch moves tests of fma to auto-libm-test-in, adding the
required support to gen-auto-libm-tests.
Because fma can have exact zero results depending on the rounding
mode, results of fma cannot always be determined from a single value
computed in higher precision with a sticky bit. Thus, this patch adds
support for recomputing results with the original MPFR/MPC function in
the case where an exact zero is involved. (This also affects some
results for cpow; when we start testing cpow in all rounding modes, I
think it will be most appropriate to make those tests use
IGNORE_ZERO_INF_SIGN, since ISO C does not attempt to determine signs
of zero results, or special caes in general, for cpow, and I think
signs of zero for cpow are beyond the scope of glibc's accuracy
goals.)
Simply treating the existing test inputs for fma like those for other
functions (i.e., as representing the given value rounded up or down to
any of the supported floating-point formats) increases the size of
auto-libm-test-out by about 16MB (i.e., about half the file is fma
test data). While rounded versions of tests are perfectly reasonable
test inputs for fma, in this case having them seems excessive, so this
patch allows functions to specify in gen-auto-libm-tests that the
given test inputs are only to be interpreted exactly, not as
corresponding to values rounded up and down. This reduces the size of
the generated test data for fma to a more reasonable 2MB.
A consequence of this patch is that fma is now tested for correct
presence or absence of "inexact" exceptions, where previously this
wasn't tested because I didn't want to try to add that test coverage
manually to all the existing tests. As far as I know, the existing
fma implementations are already correct in this regard.
This patch provides the first cases where the gen-auto-libm-tests
support for distinguishing before-rounding/after-rounding underflow
actually produces separate entries in auto-libm-test-out (for
functions without exactly determined results, the affected cases are
all considered underflow-optional, so this only affects functions like
fma with exactly determined results). I didn't see any signs of
problems with this logic in the output.
Tested x86_64 and x86.
* math/auto-libm-test-in: Add tests of fma.
* math/auto-libm-test-out: Regenerated.
* math/libm-test.inc (fma_test_data): Use AUTO_TESTS_fff_f.
(fma_towardzero_test_data): Likewise.
(fma_downward_test_data): Likewise.
(fma_upward_test_data): Likewise.
* math/gen-auto-libm-tests.c (rounding_mode_desc): Add field
mpc_mode.
(rounding_modes): Add values for new field.
(func_calc_method): Add value mpfr_fff_f.
(func_calc_desc): Add mpfr_fff_f union field.
(test_function): Add field exact_args.
(FUNC): Add macro argument EXACT_ARGS.
(FUNC_mpfr_f_f): Update call to FUNC.
(FUNC_mpfr_f_f): Likewise.
(FUNC_mpfr_ff_f): Likewise.
(FUNC_mpfr_if_f): Likewise.
(FUNC_mpc_c_f): Likewise.
(FUNC_mpc_c_c): Likewise.
(test_functions): Add fma. Update calls to FUNC.
(handle_input_arg): Add argument exact_args.
(add_test): Update call to handle_input_arg.
(calc_generic_results): Add argument mode. Handle mpfr_fff_f.
(output_for_one_input_case): Update call to calc_generic_results.
Recalculate exact zero results in each rounding mode.
Joseph Myers [Tue, 18 Feb 2014 14:45:41 +0000 (14:45 +0000)]
Fix gen-auto-libm-tests sticky bit setting for negative results.
gen-auto-libm-tests has a bug in the logic for setting a sticky bit
based on the ternary value from MPFR: it is correct for positive
results, but for negative results mpz_setbit acts as if a two's
complement representation is used, whereas the low bit needs setting
based on the sign-magnitude representation GMP actually uses. (This
showed up in converting fma tests to use auto-libm-test-in /
gen-auto-libm-tests.)
This patch fixes the problem by negating the mpz_t value to set its
low bit. There are lots of changes to auto-libm-test-out (mainly 1ulp
fixes to ldbl-128 expected results), but only a few ulps updates are
needed on x86 / x86_64. In one case, a corrected expectation showed
up a spurious underflow exception where the correct result is slightly
outside the underflowing range.
Tested x86_64 and x86 and ulps updated accordingly.
* math/gen-auto-libm-tests.c (adjust_real): Ensure integers are
non-negative before setting low bit.
* math/auto-libm-test-in: Mark one asin test possibly having
spurious underflow.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
Tomas Dohnalek [Sat, 15 Feb 2014 01:04:57 +0000 (01:04 +0000)]
Generate .test-result files for ordinary tests.
This patch, an updated version of
<https://sourceware.org/ml/libc-alpha/2014-01/msg00193.html>, starts
the process of generating explicit PASS or FAIL status for individual
glibc tests. It's based on Tomas Dohnalek's patch
<https://sourceware.org/ml/libc-alpha/2012-10/msg00278.html>, but is
deliberately more minimal: it doesn't try to cover any tests outside
of $(tests) / $(xtests) (that's for a later patch), nor does it put
the result together in an overall summary file (again, a later patch):
it just generates the .test-result files.
Thus, this patch keeps the overall logic for when a testsuite run
finishes completely unchanged: a test failing will terminate the run.
I think we *should* move to a more conventional approach where plain
"make check" does not terminate for an individual test failure, unless
e.g. you say "make stop-on-test-failure=y check", but that sort of
policy change is best done as a separate patch once the infrastructure
is in place to generate summary files for completed test runs (which
will entirely consist of PASS and XFAIL lines if the testsuite run
reaches the point of generating them, until such a policy change is
made).
Tested x86_64.
2014-02-14 Tomas Dohnalek <tdohnale@redhat.com>
Joseph Myers <joseph@codesourcery.com>
* Makeconfig (test-name): New variable.
(evaluate-test): Likewise.
* Makerules (do-test-clean): Remove .test-result files.
(common-mostlyclean): Likewise.
* Rules ($(objpfx)%.out): Use $(evaluate-test) in both rules.
* scripts/evaluate-test.sh: New file.
Joseph Myers [Fri, 14 Feb 2014 13:45:14 +0000 (13:45 +0000)]
Split up rules for tests using mtrace and something else.
Most glibc tests that use mtrace to verify that there were no memory
leaks from the glibc facilities used in a given test depend on the
.out file of the previous test so that the mtrace test runs mtrace and
nothing else.
Two, however, have a single target combining mtrace with something
else. In the case of libio/tst-fopenloc.check, the test both compares
the output with an expected baseline and runs mtrace. In the case of
posix/tst-rxspencer-mem, the test is run (with different command line
from the main run) and then mtrace is run, from the same makefile
target.
This patch splits both of these tests up to use separate makefile
targets for each thing tested; in the tst-rxspencer case, a file
tst-rxspencer-no-utf8.c is created that just includes tst-rxspencer.c,
as is usual for tests where the same code gets tested in different
compile-time or runtime configurations.
Adding $(evaluate-test) to test commands, as in
<https://sourceware.org/ml/libc-alpha/2014-01/msg00194.html>, will no
longer need to insert && between multiple commands, as all tests will
either have just a single command or already use &&.
Tested x86_64.
* libio/Makefile ($(objpfx)tst-fopenloc.check): Split into
separate $(objpfx)tst-fopenloc-cmp.out and
$(objpfx)tst-fopenloc-mem.out targets.
(tests): Update dependencies.
* posix/Makefile (tests variable): Add tst-rxspencer-no-utf8.
(generated): Change tst-rxspencer-mem and tst-rxspencer.mtrace to
tst-rxspencer-no-utf8-mem and tst-rxspencer-no-utf8.mtrace.
(tst-rxspencer-no-utf8-ARGS): New variable.
(tst-rxspencer-no-utf8-ENV): Likewise.
(tests target): Depend on $(objpfx)tst-rxspencer-no-utf8-mem
instead of $(objpfx)tst-rxspencer-mem.
($(objpfx)tst-rxspencer-mem): Change target to
$(objpfx)tst-rxspencer-no-utf8-mem. Depend on
$(objpfx)tst-rxspencer-no-utf8.out instead of running test program.
* posix/tst-rxspencer-no-utf8.c: New file.
Joseph Myers [Fri, 14 Feb 2014 13:42:44 +0000 (13:42 +0000)]
Split up rules for tests that compare output with baselines.
This patch splits makefile rules that generate a file then run cmp to
check the contents of that file into separate rules to generate and
compare the file. This simplifies making those tests generate PASS /
FAIL results, by removing the need to insert && between commands in
the test so that a $(evaluate-test) call is reached. It also avoids
the oddity of the .out file being an intermediate file rather than the
final result generated, as noted for some of these tests in
<https://sourceware.org/ml/libc-alpha/2012-10/msg00894.html>.
In many cases, the rule to run the program was no longer needed
because the default rules for running test programs on the host to
generate a .out file sufficed. (I'm not asserting the commands run
after this patch are *exactly* the same as before, simply that the
rules did nothing special that appeared deliberate or relevant to
anything about what the tests were testing. In cases where the rules
redirected stderr as well as stdout, I left the existing rule's
redirection in place to avoid changing what gets compared with the
expected results.)
It's clear there is a lot in common between the various -cmp.out rules
and it might be possible in future to refactor them into more generic
support for the case of comparing test output against a baseline.
(Some baselines are *.exp, some *.expect, some directly embedded in
the makefiles, and nptl/tst-cleanupx0.expect appears unused.)
Tested x86_64.
* elf/Makefile ($(objpfx)order.out): Remove rule.
[$(run-built-tests) = yes] (tests): Depend on
$(objpfx)order-cmp.out.
($(objpfx)order-cmp.out): New rule.
[$(run-built-tests) = yes] (tests): Depend on
$(objpfx)tst-array1-cmp.out, $(objpfx)tst-array1-static-cmp.out,
$(objpfx)tst-array2-cmp.out, $(objpfx)tst-array3-cmp.out,
$(objpfx)tst-array4-cmp.out, $(objpfx)tst-array5-cmp.out and
$(objpfx)tst-array5-static-cmp.out.
($(objpfx)tst-array1.out): Remove rule.
($(objpfx)tst-array1-cmp.out): New rule.
($(objpfx)tst-array1-static.out): Remove rule.
($(objpfx)tst-array1-static-cmp.out): New rule.
($(objpfx)tst-array2.out): Remove rule.
($(objpfx)tst-array2-cmp.out): New rule.
($(objpfx)tst-array3.out): Remove rule.
($(objpfx)tst-array3-cmp.out): New rule.
($(objpfx)tst-array4.out): Remove rule.
($(objpfx)tst-array4-cmp.out): New rule.
($(objpfx)tst-array5.out): Remove rule.
($(objpfx)tst-array5-cmp.out): New rule.
($(objpfx)tst-array5-static.out): Remove rule.
($(objpfx)tst-array5-static-cmp.out): New rule.
[$(run-built-tests) = yes] (tests): Depend on
$(objpfx)order2-cmp.out.
($(objpfx)order2.out): Remove rule.
($(objpfx)order2-cmp.out): New rule.
($(objpfx)tst-initorder.out): Remove rule.
[$(run-built-tests) = yes] (tests): Depend on
$(objpfx)tst-initorder-cmp.out.
($(objpfx)tst-initorder-cmp.out): New rule.
($(objpfx)tst-initorder2.out): Remove rule.
[$(run-built-tests) = yes] (tests): Depend on
$(objpfx)tst-initorder2-cmp.out.
($(objpfx)tst-initorder2-cmp.out): New rule.
[$(run-built-tests) = yes] (tests): Depend on
$(objpfx)tst-unused-dep-cmp.out.
($(objpfx)tst-unused-dep-cmp.out): Do not run cmp.
($(objpfx)tst-unused-dep-cmp.out): New rule.
* stdio-common/Makefile [$(run-built-tests) = yes] (tests): Depend
on $(objpfx)tst-setvbuf1-cmp.out.
($(objpfx)tst-setvbuf1.out): Do not run cmp.
($(objpfx)tst-setvbuf1-cmp.out): New rule.
* string/Makefile [$(run-built-tests) = yes] (tests): Depend
$(objpfx)tst-svc-cmp.out instead of $(objpfx)tst-svc.out.
($(objpfx)tst-svc.out): Remove rule.
($(objpfx)tst-svc-cmp.out): New rule.
nptl:
* Makefile ($(objpfx)tst-cleanup0.out): Do not run cmp.
[$(run-built-tests) = yes] (tests): Depend on
$(objpfx)tst-cleanup0-cmp.out.
($(objpfx)tst-cleanup0-cmp.out): New rule.
Joseph Myers [Thu, 13 Feb 2014 22:07:25 +0000 (22:07 +0000)]
Clean up trivially redundant __USE_MISC conditionals.
This patch cleans up cases of __USE_MISC that are trivially redundant
after the recent substitution of __USE_MISC for __USE_BSD and
__USE_SVID: either in constructs such as "defined __USE_MISC ||
defined __USE_MISC", or else (in the bits/mman.h case) a conditional
on __USE_MISC nested inside another __USE_MISC conditional. (The
cleanups remaining after this patch are still quite large, but it
seems a reasonable piece to separate out.)
Joseph Myers [Thu, 13 Feb 2014 00:46:45 +0000 (00:46 +0000)]
Update MIPS math-tests.h for GCC 4.9 using soft-fp.
GCC trunk now uses soft-fp for MIPS64 long double, so supporting
integration with hardware exceptions and rounding modes. This patch
updates MIPS math-tests.h accordingly not to disable exception and
rounding mode tests in this case.
Tested mips64 and ulps updated to reflect the newly run tests.
Joseph Myers [Wed, 12 Feb 2014 23:41:01 +0000 (23:41 +0000)]
Combine __USE_BSD and __USE_SVID into __USE_MISC.
This patch cleans up following the obsoletion of _BSD_SOURCE and
_SVID_SOURCE by combining __USE_BSD and __USE_SVID into __USE_MISC.
The only non-mechanical part of this patch is the changes to
features.h; everything else is simple substitution of __USE_MISC for
the old macros. Thus, this patch leaves obviously redundant
conditionals such as "defined __USE_MISC || defined __USE_MISC", and
does not update #endif comments where they referred to BSD or SVID in
words instead of the literal macro name. This is intended to
facilitate patch review by separating the less mechanical changes from
these purely mechanical changes into a separate patch. (I do intend
to integrate all the changes from
<https://sourceware.org/ml/libc-alpha/2013-12/msg00226.html>, which I
believe includes all the trailing comment updates, in subsequent
patches.)
Joseph Myers [Wed, 12 Feb 2014 23:37:13 +0000 (23:37 +0000)]
Remove reference to subdir_lint.out.
The toplevel Makefile's subdir_targets variable refers to
subdir_lint.out. As far as I can tell, this is not defined or
referenced anywhere else in the tree. Having .out makefile references
that don't refer to the output from testcases seems confusing; this
patch removes the reference to subdir_lint.out.
Joseph Myers [Wed, 12 Feb 2014 22:19:20 +0000 (22:19 +0000)]
Remove indirection in stdio-common tests dependencies.
stdio-common/Makefile has the tests target depend on two test output
files indirectly through rules do-tst-unbputc and do-tst-printf. I
see no reason for such an indirection, and everywhere else the tests
just depend on the output files directly, so this patch removes the
indirection.
Tested x86_64.
* stdio-common/Makefile (do-tst-unbputc): Remove target.
(do-tst-printf): Likewise.
(tests): Depend directly on $(objpfx)tst-unbputc.out and
$(objpfx)tst-printf.out.
Joseph Myers [Wed, 12 Feb 2014 20:52:19 +0000 (20:52 +0000)]
Stop io/ftwtest deleting its own output.
If you rerun "make check" in a tree where some tests have already been
run, it will rerun io/ftwtest-sh because that test uses ftwtest.out,
the same name to which output is redirected, as its internal temporary
file, and then removes it on exit.
Clearly tests should not be removing the files to which their output
is redirected like that. This patch changes the script to use a
different file as its internal temporary file, so the actual output
referenced in the makefile isn't removed.
Tested x86_64.
* io/ftwtest-sh (testout): Change to $tmp/ftwtest-tmp.out.
Joseph Myers [Wed, 12 Feb 2014 20:51:13 +0000 (20:51 +0000)]
Make ABI tests generate .out files.
If you rerun "make check" in a tree where some tests have already been
run, it will rerun ABI tests because those do not create an output
file.
This patch changes those tests to create .out files so they only get
rerun if the dependencies (on the ABI baselines and the generated
.symlist files) indicate they should be rerun.
Tested x86_64.
* Makerules (check-abi-%): Change target to
$(objpfx)check-abi-%.out.
(check-abi target): Update dependencies.
(check-abi-pattern variable): Redirect output of diff to $@.
(check-abi variable): Likewise.
* elf/Makefile (check-abi): Update dependencies.
Joseph Myers [Wed, 12 Feb 2014 18:27:12 +0000 (18:27 +0000)]
soft-fp: support after-rounding tininess detection.
IEEE 754-2008 defines two ways in which tiny results can be detected,
"before rounding" (based on the infinite-precision result) and "after
rounding" (based on the result when rounded to normal precision as if
the exponent range were unbounded). All binary operations on an
architecture must use the same choice of how tininess is detected.
soft-fp has so far implemented only before-rounding tininess
detection. This patch adds support for after-rounding tininess
detection. A new macro _FP_TININESS_AFTER_ROUNDING is added that
sfp-machine.h must define (soft-fp is meant to be self-contained so
the existing tininess.h files aren't used here, though the information
going in sfp-machine.h has been taken from them). The soft-fp macros
dealing with raising underflow exceptions then handle the cases where
the choice matters specially, rounding a copy of the input to the
appropriate precision to see if a value that's tiny before rounding
isn't tiny after rounding.
Tested for mips64 using GCC trunk (which now uses soft-fp on MIPS, so
supporting exceptions and rounding modes for long double where not
previously supported - this is the immediate motivation for doing this
patch now) together with (a) a patch to sysdeps/mips/math-tests.h to
enable exceptions / rounding modes tests for long double for GCC 4.9
and later, and (b) corresponding changes applied to libgcc's soft-fp
and sfp-machine.h files. In the libgcc context this is also tested on
x86_64 (also an after-rounding architecture) with testcases for
__float128 that I intend to add to the GCC testsuite when updating
soft-fp there.
(To be clear: this patch does not fix any glibc bugs that were
user-visible in past releases, since after-rounding architectures
didn't use soft-fp in any affected case with support for
floating-point exceptions - so there is no corresponding Bugzilla bug.
Rather, it works together with the GCC changes to use soft-fp on MIPS
to allow previously absent long double functionality to work properly,
and allows soft-fp to be used in glibc on after-rounding architectures
in cases where it couldn't previously be used.)
* soft-fp/op-common.h (_FP_DECL): Mark exponent as possibly
unused.
(_FP_PACK_SEMIRAW): Determine tininess based on rounding shifted
value if _FP_TININESS_AFTER_ROUNDING and unrounded value is in
subnormal range.
(_FP_PACK_CANONICAL): Determine tininess based on rounding to
normal precision if _FP_TININESS_AFTER_ROUNDING and unrounded
value has largest subnormal exponent.
* soft-fp/soft-fp.h [FP_NO_EXCEPTIONS]
(_FP_TININESS_AFTER_ROUNDING): Undefine and redefine to 0.
* sysdeps/aarch64/soft-fp/sfp-machine.h
(_FP_TININESS_AFTER_ROUNDING): New macro.
* sysdeps/alpha/soft-fp/sfp-machine.h
(_FP_TININESS_AFTER_ROUNDING): Likewise.
* sysdeps/arm/soft-fp/sfp-machine.h (_FP_TININESS_AFTER_ROUNDING):
Likewise.
* sysdeps/mips/mips64/soft-fp/sfp-machine.h
(_FP_TININESS_AFTER_ROUNDING): Likewise.
* sysdeps/mips/soft-fp/sfp-machine.h
(_FP_TININESS_AFTER_ROUNDING): Likewise.
* sysdeps/powerpc/soft-fp/sfp-machine.h
(_FP_TININESS_AFTER_ROUNDING): Likewise.
* sysdeps/sh/soft-fp/sfp-machine.h (_FP_TININESS_AFTER_ROUNDING):
Likewise.
* sysdeps/sparc/sparc32/soft-fp/sfp-machine.h
(_FP_TININESS_AFTER_ROUNDING): Likewise.
* sysdeps/sparc/sparc64/soft-fp/sfp-machine.h
(_FP_TININESS_AFTER_ROUNDING): Likewise.
* sysdeps/tile/sfp-machine.h (_FP_TININESS_AFTER_ROUNDING):
Likewise.