Commit graph

107 commits

Author SHA1 Message Date
Zack Weinberg ea1bd74def New string function explicit_bzero (from OpenBSD).
explicit_bzero(s, n) is the same as memset(s, 0, n), except that the
compiler is not allowed to delete a call to explicit_bzero even if the
memory pointed to by 's' is dead after the call.  Right now, this effect
is achieved externally by having explicit_bzero be a function whose
semantics are unknown to the compiler, and internally, with a no-op
asm statement that clobbers memory.  This does mean that small
explicit_bzero operations cannot be expanded inline as small memset
operations can, but on the other hand, small memset operations do get
deleted by the compiler.  Hopefully full compiler support for
explicit_bzero will happen relatively soon.

There are two new tests: test-explicit_bzero.c verifies the
visible semantics in the same way as the existing test-bzero.c,
and tst-xbzero-opt.c verifies the not-being-optimized-out property.
The latter is conceptually based on a test written by Matthew Dempsky
for the OpenBSD regression suite.

The crypt() implementation has an immediate use for this new feature.
We avoid having to add a GLIBC_PRIVATE alias for explicit_bzero
by running all of libcrypt's calls through the fortified variant,
__explicit_bzero_chk, which is in the impl namespace anyway.  Currently
I'm not aware of anything in libc proper that needs this, but the
glue is all in place if it does become necessary.  The legacy DES
implementation wasn't bothering to clear its buffers, so I added that,
mostly for consistency's sake.

	* string/explicit_bzero.c: New routine.
	* string/test-explicit_bzero.c, string/tst-xbzero-opt.c: New tests.
	* string/Makefile (routines, strop-tests, tests): Add them.
	* string/test-memset.c: Add ifdeffage for testing explicit_bzero.
	* string/string.h [__USE_MISC]: Declare explicit_bzero.

	* debug/explicit_bzero_chk.c: New routine.
	* debug/Makefile (routines): Add it.
	* debug/tst-chk1.c: Test fortification of explicit_bzero.
	* string/bits/string3.h: Fortify explicit_bzero.

	* manual/string.texi: Document explicit_bzero.
	* NEWS: Mention addition of explicit_bzero.

	* crypt/crypt-entry.c (__crypt_r): Clear key-dependent intermediate
	data before returning, using explicit_bzero.
	* crypt/md5-crypt.c (__md5_crypt_r): Likewise.
	* crypt/sha256-crypt.c (__sha256_crypt_r): Likewise.
	* crypt/sha512-crypt.c (__sha512_crypt_r): Likewise.

	* include/string.h: Redirect internal uses of explicit_bzero
	to __explicit_bzero_chk[_internal].
	* string/Versions [GLIBC_2.25]: Add explicit_bzero.
	* debug/Versions [GLIBC_2.25]: Add __explicit_bzero_chk.
	* sysdeps/arm/nacl/libc.abilist
	* sysdeps/unix/sysv/linux/aarch64/libc.abilist
	* sysdeps/unix/sysv/linux/alpha/libc.abilist
	* sysdeps/unix/sysv/linux/arm/libc.abilist
	* sysdeps/unix/sysv/linux/hppa/libc.abilist
	* sysdeps/unix/sysv/linux/i386/libc.abilist
	* sysdeps/unix/sysv/linux/ia64/libc.abilist
	* sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist
	* sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist
	* sysdeps/unix/sysv/linux/microblaze/libc.abilist
	* sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist
	* sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist
	* sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist
	* sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist
	* sysdeps/unix/sysv/linux/nios2/libc.abilist
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist
	* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist
	* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist
	* sysdeps/unix/sysv/linux/sh/libc.abilist
	* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist
	* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist
	* sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist
	* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist
	* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist:
	Add entries for explicit_bzero and __explicit_bzero_chk.
2016-12-16 16:21:54 -05:00
Florian Weimer 6e263a27c4 string: More tests for strcmp, strcasecmp, strncmp, strncasecmp 2016-08-26 14:28:46 +02:00
Joseph Myers f7a9f785e5 Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Carlos O'Donell facdd9ea29 Fix typo in bug-strcoll2 (Bug 18589)
Fix the copyright year and remove contributed by in the
bug-strcoll2 test. In addition add the correct dependency
on $(gen-locales) to ensure all the test locales are generated.
2015-10-09 16:38:04 -04:00
Carlos O'Donell 02018629a1 strcoll: Add bug-strcoll2 to testsuite (Bug 18589).
Adds bug-strcoll2 to the string tests, along with the
generation of required locales.
2015-10-08 17:02:50 -04:00
Martin Sebor 60cf80f09d Let 'make check subdirs=string' succeed even when it's invoked
immediately after glibc has been built and before 'make check'
(or after 'make clean').
2015-09-28 16:55:57 -04:00
Joseph Myers b168057aaa Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
Joseph Myers 686554bff6 Remove redundant C locale settings.
Various glibc build / install / test code has C locale settings that
are redundant with LC_ALL=C.

LC_ALL takes precedence over LANG, so anywhere that sets LC_ALL=C
(explicitly, or through it being in the default environment for
running tests) does not need to set LANG=C.  LC_ALL=C also takes
precedence over LANGUAGE, since

2001-01-02  Ulrich Drepper  <drepper@redhat.com>

	* intl/dcigettext.c (guess_category_value): Rewrite so that LANGUAGE
	value is ignored if the selected locale is the C locale.
	* intl/tst-gettext.c: Set locale for above change.
	* intl/tst-translit.c: Likewise.

and so settings of LANGUAGE=C are also redundant when LC_ALL=C is
set.  One test also had LC_ALL=C in its -ENV setting, although it's
part of the default environment used for tests.

This patch removes the redundant settings.  It removes a suggestion in
install.texi of setting LANGUAGE=C LC_ALL=C for "make install"; the
Makefile.in target "install" already sets LC_ALL_C so there's no need
for the user to set it (and nor should there be any need for the user
to set it).

If some build machine tool used by "make install" uses a version of
libintl predating that 2001 change, and the user has LANGUAGE set, the
removal of LANGUAGE=C from the Makefile.in "install" rule could in
principle affect the user's installation.  However, I don't think we
need to be concerned about pre-2001 build tools.

Tested x86_64.

	* Makefile (install): Don't set LANGUAGE.
	* Makefile.in (install): Likewise.
	* assert/Makefile (test-assert-ENV): Remove variable.
	(test-assert-perr-ENV): Likewise.
	* elf/Makefile (neededtest4-ENV): Likewise.
	* iconvdata/Makefile ($(inst_gconvdir)/gconv-modules)
	[$(cross-compiling) = no]: Don't set LANGUAGE.
	* io/ftwtest-sh (LANG): Remove variable.
	* libio/Makefile (tst-widetext-ENV): Likewise.
	* manual/install.texi (Running make install): Don't refer to
	environment settings for make install.
	* INSTALL: Regenerated.
	* nptl/tst-tls6.sh: Don't set LANG.
	* posix/globtest.sh (LANG): Remove variable.
	* string/Makefile (tester-ENV): Likewise.
	(inl-tester-ENV): Likewise.
	(noinl-tester-ENV): Likewise.
	* sysdeps/s390/s390-64/Makefile ($(inst_gconvdir)/gconv-modules)
	[$(cross-compiling) = no]: Don't set LANGUAGE.
	* timezone/Makefile (build-testdata): Use $(built-program-cmd)
	without explicit environment settings.

localedata/ChangeLog:
	* tst-fmon.sh: Don't set LANGUAGE.
	* tst-locale.sh: Likewise.
2014-06-07 19:58:36 +00:00
Joseph Myers 2bf1804182 Include LOCPATH in default test environment.
Tests run using the default $(make-test-out) automatically get
GCONV_PATH and LC_ALL set, whether or not those environment variables
are actually needed for the individual test.  However, they do not get
LOCPATH set, meaning that a large number of tests have -ENV settings
just to set LOCPATH.

This patch moves LOCPATH into the default environment used for all
tests, on the principle that like GCONV_PATH any settings needed to
use files associated with the newly built library, rather than any old
installed files, are appropriate to use by default.

A further motivation is that various tests using .sh files also set
some combination of LC_ALL, GCONV_PATH and LOCPATH.  Preferably .sh
files should also use the default environment with any additions
required for the individual test.  Now, it was suggested in
<https://sourceware.org/ml/libc-alpha/2014-05/msg00715.html> that
various Makefile variables used in testing should be derived by
composing the -before-env and -after-env variables used when explicit
environment settings are required.  With such a change, it's also
natural for those variables to include the default settings (via some
intermediate makefile variable also used in make-test-out).

Because some .sh files only set variables that correspond to the
default settings, or a subset thereof, and this applies to more of the
.sh files once LOCPATH is in the default settings, doing so reduces
the size of a revised version of
<https://sourceware.org/ml/libc-alpha/2014-05/msg00596.html>: scripts
only needing the (expanded) default settings will not need to receive
the separate -before-env and -after-env variables, only the single
variable they do at present.  So moving LOCPATH into the default
settings can reduce churn caused by subsequent patches.

Tested x86_64 and x86.

	* Rules (make-test-out): Include
	LOCPATH=$(common-objpfx)localedata in default environment.
	* debug/Makefile (tst-chk1-ENV): Remove variable.
	(tst-chk2-ENV): Likewise.
	(tst-chk3-ENV): Likewise.
	(tst-chk4-ENV): Likewise.
	(tst-chk5-ENV): Likewise.
	(tst-chk6-ENV): Likewise.
	(tst-lfschk1-ENV): Likewise.
	(tst-lfschk2-ENV): Likewise.
	(tst-lfschk3-ENV): Likewise.
	(tst-lfschk4-ENV): Likewise.
	(tst-lfschk5-ENV): Likewise.
	(tst-lfschk6-ENV): Likewise.
	* iconvdata/Makefile (bug-iconv6-ENV): Likewise.
	(tst-iconv7-ENV): Likewise.
	* intl/Makefile (LOCPATH-ENV): Likewise.
	(tst-codeset-ENV): Likewise.
	(tst-gettext3-ENV): Likewise.
	(tst-gettext5-ENV): Likewise.
	* libio/Makefile (tst-widetext-ENV): Don't set LOCPATH.
	(tst-fopenloc-ENV): Likewise.
	(tst-fgetws-ENV): Remove variable.
	(tst-ungetwc1-ENV): Likewise.
	(tst-ungetwc2-ENV): Likewise.
	(bug-ungetwc2-ENV): Likewise.
	(tst-swscanf-ENV): Likewise.
	(bug-ftell-ENV): Likewise.
	(tst-fgetwc-ENV): Likewise.
	(tst-fseek-ENV): Likewise.
	(tst-ftell-partial-wide-ENV): Likewise.
	(tst-ftell-active-handler-ENV): Likewise.
	(tst-ftell-append-ENV): Likewise.
	* posix/Makefile (tst-fnmatch-ENV): Likewise.
	(tst-regexloc-ENV): Likewise.
	(bug-regex1-ENV): Likewise.
	(tst-regex-ENV): Likewise.
	(tst-regex2-ENV): Likewise.
	(bug-regex5-ENV): Likewise.
	(bug-regex6-ENV): Likewise.
	(bug-regex17-ENV): Likewise.
	(bug-regex18-ENV): Likewise.
	(bug-regex19-ENV): Likewise.
	(bug-regex20-ENV): Likewise.
	(bug-regex22-ENV): Likewise.
	(bug-regex23-ENV): Likewise.
	(bug-regex25-ENV): Likewise.
	(bug-regex26-ENV): Likewise.
	(bug-regex30-ENV): Likewise.
	(bug-regex32-ENV): Likewise.
	(bug-regex33-ENV): Likewise.
	(bug-regex34-ENV): Likewise.
	(bug-regex35-ENV): Likewise.
	(tst-rxspencer-ENV): Likewise.
	(tst-rxspencer-no-utf8-ENV): Likewise.
	* stdio-common/Makefile (tst-sprintf-ENV): Likewise.
	(tst-sscanf-ENV): Likewise.
	(tst-swprintf-ENV): Likewise.
	(tst-swscanf-ENV): Likewise.
	(test-vfprintf-ENV): Likewise.
	(scanf13-ENV): Likewise.
	(bug14-ENV): Likewise.
	(tst-grouping-ENV): Likewise.
	* stdlib/Makefile (tst-strtod-ENV): Likewise.
	(tst-strtod3-ENV): Likewise.
	(tst-strtod4-ENV): Likewise.
	(tst-strtod5-ENV): Likewise.
	(testmb2-ENV): Likewise./
	* string/Makefile (tst-strxfrm-ENV): Likewise.
	(tst-strxfrm2-ENV): Likewise.
	(bug-strcoll1-ENV): Likewise.
	(test-strcasecmp-ENV): Likewise.
	(test-strncasecmp-ENV): Likewise.
	* time/Makefile (tst-strptime-ENV): Likewise.
	(tst-ftime_l-ENV): Likewise.
	* wcsmbs/Makefile (tst-btowc-ENV): Likewise.
	(tst-mbrtowc-ENV): Likewise.
	(tst-wcrtomb-ENV): Likewise.
	(tst-mbrtowc2-ENV): Likewise.
	(tst-c16c32-1-ENV): Likewise.
	(tst-mbsnrtowcs-ENV): Likewise.

localedata/ChangeLog:
	* Makefile (TEST_MBWC_ENV): Remove variable.
	(tst_iswalnum-ENV): Likewise.
	(tst_iswalpha-ENV): Likewise.
	(tst_iswcntrl-ENV): Likewise.
	(tst_iswctype-ENV): Likewise.
	(tst_iswdigit-ENV): Likewise.
	(tst_iswgraph-ENV): Likewise.
	(tst_iswlower-ENV): Likewise.
	(tst_iswprint-ENV): Likewise.
	(tst_iswpunct-ENV): Likewise.
	(tst_iswspace-ENV): Likewise.
	(tst_iswupper-ENV): Likewise.
	(tst_iswxdigit-ENV): Likewise.
	(tst_mblen-ENV): Likewise.
	(tst_mbrlen-ENV): Likewise.
	(tst_mbrtowc-ENV): Likewise.
	(tst_mbsrtowcs-ENV): Likewise.
	(tst_mbstowcs-ENV): Likewise.
	(tst_mbtowc-ENV): Likewise.
	(tst_strcoll-ENV): Likewise.
	(tst_strfmon-ENV): Likewise.
	(tst_strxfrm-ENV): Likewise.
	(tst_swscanf-ENV): Likewise.
	(tst_towctrans-ENV): Likewise.
	(tst_towlower-ENV): Likewise.
	(tst_towupper-ENV): Likewise.
	(tst_wcrtomb-ENV): Likewise.
	(tst_wcscat-ENV): Likewise.
	(tst_wcschr-ENV): Likewise.
	(tst_wcscmp-ENV): Likewise.
	(tst_wcscoll-ENV): Likewise.
	(tst_wcscpy-ENV): Likewise.
	(tst_wcscspn-ENV): Likewise.
	(tst_wcslen-ENV): Likewise.
	(tst_wcsncat-ENV): Likewise.
	(tst_wcsncmp-ENV): Likewise.
	(tst_wcsncpy-ENV): Likewise.
	(tst_wcspbrk-ENV): Likewise.
	(tst_wcsrtombs-ENV): Likewise.
	(tst_wcsspn-ENV): Likewise.
	(tst_wcsstr-ENV): Likewise.
	(tst_wcstod-ENV): Likewise.
	(tst_wcstok-ENV): Likewise.
	(tst_wcstombs-ENV): Likewise.
	(tst_wcswidth-ENV): Likewise.
	(tst_wcsxfrm-ENV): Likewise.
	(tst_wctob-ENV): Likewise.
	(tst_wctomb-ENV): Likewise.
	(tst_wctrans-ENV): Likewise.
	(tst_wctype-ENV): Likewise.
	(tst_wcwidth-ENV): Likewise.
	(tst-digits-ENV): Likewise.
	(tst-mbswcs6-ENV): Likewise.
	(tst-xlocale1-ENV): Likewise.
	(tst-xlocale2-ENV): Likewise.
	(tst-strfmon1-ENV): Likewise.
	(tst-strptime-ENV): Likewise.
	(tst-setlocale-ENV): Don't set LOCPATH.
	(bug-iconv-trans-ENV): Remove variable.
	(tst-sscanf-ENV): Likewise.
	(tst-leaks-ENV): Don't set LOCPATH.
	(bug-setlocale1-ENV): Remove variable.
	(bug-setlocale1-static-ENV): Likewise.
	(tst-setlocale2-ENV): Likewise.
2014-06-04 23:37:25 +00:00
Joseph Myers f214606a0e 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.
2014-03-06 22:35:33 +00:00
Joseph Myers a5f891ac8d 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

ifneq   "$(findstring env,$(origin headers))" ""
headers :=
endif

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.

	* argp/Makefile: Include Makeconfig immediately after defining
	subdir.
	* assert/Makefile: Likewise.
	* benchtests/Makefile: Likewise.
	* catgets/Makefile: Likewise.
	* conform/Makefile: Likewise.
	* crypt/Makefile: Likewise.
	* csu/Makefile: Likewise.
	(all): Remove target.
	* ctype/Makefile: Include Makeconfig immediately after defining
	subdir.
	* debug/Makefile: Likewise.
	* dirent/Makefile: Likewise.
	* dlfcn/Makefile: Likewise.
	* gmon/Makefile: Likewise.
	* gnulib/Makefile: Likewise.
	* grp/Makefile: Likewise.
	* gshadow/Makefile: Likewise.
	* hesiod/Makefile: Likewise.
	* hurd/Makefile: Likewise.
	(all): Remove target.
	* iconvdata/Makefile: Include Makeconfig immediately after
	defining subdir.
	* inet/Makefile: Likewise.
	* intl/Makefile: Likewise.
	* io/Makefile: Likewise.
	* libio/Makefile: Likewise.
	(all): Remove target.
	* locale/Makefile: Include Makeconfig immediately after defining
	subdir.
	* login/Makefile: Likewise.
	* mach/Makefile: Likewise.
	(all): Remove target.
	* malloc/Makefile: Include Makeconfig immediately after defining
	subdir.
	(all): Remove target.
	* manual/Makefile: Include Makeconfig immediately after defining
	subdir.
	* math/Makefile: Likewise.
	* misc/Makefile: Likewise.
	* nis/Makefile: Likewise.
	* nss/Makefile: Likewise.
	* po/Makefile: Likewise.
	(all): Remove target.
	* posix/Makefile: Include Makeconfig immediately after defining
	subdir.
	* pwd/Makefile: Likewise.
	* resolv/Makefile: Likewise.
	* resource/Makefile: Likewise.
	* rt/Makefile: Likewise.
	* setjmp/Makefile: Likewise.
	* shadow/Makefile: Likewise.
	* signal/Makefile: Likewise.
	* socket/Makefile: Likewise.
	* soft-fp/Makefile: Likewise.
	* stdio-common/Makefile: Likewise.
	* stdlib/Makefile: Likewise.
	* streams/Makefile: Likewise.
	* string/Makefile: Likewise.
	* sunrpc/Makefile: Likewise.
	(all): Remove target.
	* sysvipc/Makefile: Include Makeconfig immediately after defining
	subdir.
	* termios/Makefile: Likewise.
	* time/Makefile: Likewise.
	* timezone/Makefile: Likewise.
	(all): Remove target.
	* wcsmbs/Makefile: Include Makeconfig immediately after defining
	subdir.
	* wctype/Makefile: Likewise.

libidn/ChangeLog:
	* Makefile: Include Makeconfig immediately after defining subdir.

localedata/ChangeLog:
	* Makefile: Include Makeconfig immediately after defining subdir.
	(all): Remove target.

nptl/ChangeLog:
	* Makefile: Include Makeconfig immediately after defining subdir.

nptl_db/ChangeLog:
	* Makefile: Include Makeconfig immediately after defining subdir.
2014-02-26 23:12:03 +00:00
Joseph Myers f0881698bf 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.

Tested x86_64.

	* Makefile ($(objpfx)c++-types-check.out): Use $(evaluate-test).
	($(objpfx)check-local-headers.out): Likewise.
	($(objpfx)begin-end-check.out): Likewise.
	* Makerules (check-abi-%.out): Likewise.
	* catgets/Makefile ($(objpfx)test1.cat): Likewise.
	($(objpfx)test2.cat): Likewise.
	($(objpfx)de/libc.cat): Likewise.
	($(objpfx)test-gencat.out): Likewise.
	* conform/Makefile ($(objpfx)run-conformtest.out): Likewise.
	* elf/Makefile ($(objpfx)order-cmp.out): Likewise.
	($(objpfx)noload-mem): Likewise.
	($(objpfx)tst-pathopt.out): Likewise.
	($(objpfx)tst-rtld-load-self.out): Likewise.
	($(objpfx)tst-array1-cmp.out): Likewise.
	($(objpfx)tst-array1-static-cmp.out): Likewise.
	($(objpfx)tst-array2-cmp.out): Likewise.
	($(objpfx)tst-array3-cmp.out): Likewise.
	($(objpfx)tst-array4-cmp.out): Likewise.
	($(objpfx)tst-array5-cmp.out): Likewise.
	($(objpfx)tst-array5-static-cmp.out): Likewise.
	($(objpfx)check-textrel.out): Likewise.
	($(objpfx)check-execstack.out): Likewise.
	($(objpfx)check-localplt.out): Likewise.
	($(objpfx)order2-cmp.out): Likewise.
	($(objpfx)tst-leaks1-mem): Likewise.
	($(objpfx)tst-leaks1-static-mem): Likewise.
	($(objpfx)tst-initorder-cmp.out): Likewise.
	($(objpfx)tst-initorder2-cmp.out): Likewise.
	($(objpfx)tst-unused-dep.out): Likewise.
	($(objpfx)tst-unused-dep-cmp.out): Likewise.
	* grp/Makefile ($(objpfx)tst_fgetgrent.out): Likewise.
	* iconv/Makefile (test-iconvconfig): Likewise.
	* iconvdata/Makefile ($(objpfx)mtrace-tst-loading): Likewise.
	($(objpfx)iconv-test.out): Likewise.
	($(objpfx)tst-tables.out): Likewise.
	* intl/Makefile ($(objpfx)mtrace-tst-gettext): Likewise.
	($(objpfx)tst-gettext.out): Likewise.
	($(objpfx)tst-translit.out): Likewise.
	($(objpfx)tst-gettext2.out): Likewise.
	($(objpfx)tst-gettext4.out): Likewise.
	($(objpfx)tst-gettext6.out): Likewise.
	* io/Makefile ($(objpfx)ftwtest.out): Likewise.
	* libio/Makefile ($(objpfx)test-freopen.out): Likewise.
	($(objpfx)tst-fopenloc-cmp.out): Likewise.
	($(objpfx)tst-fopenloc-mem.out): Likewise.
	* malloc/Makefile ($(objpfx)tst-mtrace.out): Likewise.
	* misc/Makefile ($(objpfx)tst-error1-mem): Likewise.
	* posix/Makefile ($(objpfx)globtest.out): Likewise.
	($(objpfx)wordexp-tst.out): Likewise.
	($(objpfx)annexc.out): 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)tst-getconf.out): Likewise.
	($(objpfx)bug-ga2-mem): Likewise.
	($(objpfx)bug-glob2-mem): Likewise.
	* resolv/Makefile ($(objpfx)mtrace-tst-leaks): Likewise.
	($(objpfx)mtrace-tst-leaks2): Likewise.
	* stdio-common/Makefile ($(objpfx)tst-unbputc.out): Likewise.
	($(objpfx)tst-printf.out): Likewise.
	($(objpfx)tst-setvbuf1.out): Likewise.
	($(objpfx)tst-setvbuf1-cmp.out): Likewise.
	* stdlib/Makefile ($(objpfx)isomac.out): Likewise.
	($(objpfx)tst-fmtmsg.out): Likewise.
	* string/Makefile ($(objpfx)tst-svc-cmp.out): Likewise.
	* sysdeps/x86/Makefile ($(objpfx)tst-xmmymm.out): Likewise.

localedata:
	* Makefile ($(objpfx)sort-test.out): Use $(evaluate-test).
	($(objpfx)tst-fmon.out): Likewise.
	($(objpfx)tst-numeric.out): Likewise.
	($(objpfx)tst-locale.out): Likewise.
	($(objpfx)tst-rpmatch.out): Likewise.
	($(objpfx)tst-trans.out): Likewise.
	($(objpfx)tst-mbswcs.out): Likewise.
	($(objpfx)tst-ctype.out): Likewise.
	($(objpfx)tst-wctype.out): Likewise.
	($(objpfx)tst-langinfo.out): Likewise.
	($(objpfx)mtrace-tst-leaks): Likewise.

nptl:
	* Makefile ($(objpfx)tst-stack3-mem): Use $(evaluate-test).
	($(objpfx)tst-tls6.out): Likewise.
	($(objpfx)tst-cleanup0.out): Likewise.
	($(objpfx)tst-cleanup0-cmp.out): Likewise.
	($(objpfx)tst-cancel-wrappers.out): Likewise.
	($(objpfx)tst-oddstacklimit.out): Likewise.

nptl_db:
	* Makefile ($(objpfx)db-symbols.out): Use
	$(evaluate-test).
2014-02-21 21:48:08 +00:00
Joseph Myers 6e89caf118 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.
2014-02-14 13:42:44 +00:00
Allan McRae d4697bc93d Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
Ondřej Bílka 52bb65431f Remove duplicate ifunc tests. 2013-11-26 12:58:28 +01:00
Siddhesh Poyarekar 303e567a80 Check for integer overflow in cache size computation in strcoll
strcoll is implemented using a cache for indices and weights of
collation sequences in the strings so that subsequent passes do not
have to search through collation data again.  For very large string
inputs, the cache size computation could overflow.  In such a case,
use the fallback function that does not cache indices and weights of
collation sequences.

Fixes CVE-2012-4412.
2013-09-23 11:29:53 +05:30
Adhemerval Zanella 4660856c6f Add memrchr testcase 2013-09-05 09:52:08 -03:00
Andreas Schwab 45b8acccaf Fix missing declaration of LC_CTYPE nonascii-case element 2013-08-27 12:21:12 +02:00
Joseph Myers daaa7713e9 Remove bounded-pointers build system support. 2013-02-15 15:07:54 +00:00
Tom de Vries fe77fe6d51 Remove dead CFLAGS lines from string/Makefile 2013-02-11 23:10:26 +01:00
H.J. Lu 740b3dbee8 Add --enable-hardcoded-path-in-tests configure option 2013-01-11 07:14:18 -08:00
Joseph Myers 568035b787 Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
Joseph Myers 03ac099f6b Define and use $(run-built-tests). 2012-10-24 00:08:46 +00:00
H.J. Lu 69f07e5fd1 Add string IFUNC tests 2012-10-19 22:10:16 -07:00
H.J. Lu 9a387d1f78 Use IFUNC memmove/memset in x86-64 bcopy/bzero
Also add separate tests for bcopy and bzero.
2012-10-11 13:58:16 -07:00
H.J. Lu 03759f47db Test strcasestr/strchr/strstr under all implementations 2012-10-05 13:32:07 -07:00
Maxim Kuvyrkov 400726deef Detect EOL on-the-fly in strstr, strcasestr and memmem. 2012-08-21 18:07:47 -07:00
H.J. Lu 49bdf4c19d Use RAX_LP/RDX_LP on SAVE_PTR in x86_64 strtok.S 2012-06-14 10:00:28 -07:00
H.J. Lu f8887d0a5f Add byteswap-16.h for __bswap_16 2012-04-06 15:14:52 -07:00
Ulrich Drepper a4300c7a4d Remove distribute variable from Makefiles 2012-03-07 05:17:13 -05:00
Paul Eggert 59ba27a63a Replace FSF snail mail address with URLs. 2012-02-09 23:18:22 +00:00
Ulrich Drepper 51d91b1895 Add strchrnul performance test 2011-10-29 11:54:15 -04:00
Ulrich Drepper 855d156018 Optimize x86-64 rawmemchr and add test 2011-10-19 22:22:29 -04:00
Ulrich Drepper 762011fe9f Move wide char tests to wcsmbs directory 2011-09-08 18:01:07 -04:00
Liubov Dmitrieva 4badf7e8d7 New comprehensive test for wmemcmp 2011-09-08 17:51:50 -04:00
Liubov Dmitrieva cff8293390 New comprehensive test for wcscmp 2011-08-04 16:04:15 -04:00
Ulrich Drepper 6f0eec6710 Add string/test-strncat.c 2011-07-06 21:44:29 -04:00
Andreas Krebbel f09677388a Fix concurrency problem between dl_open and dl_iterate_phdr 2010-10-26 00:23:14 -04:00
Ulrich Drepper 67a67b950b Add test case for strstr problem. 2010-10-06 13:48:51 -04:00
Ulrich Drepper e9f82e0d1d Add optimized strncasecmp versions for x86-64. 2010-08-14 22:04:01 -07:00
Ulrich Drepper 42e08a5438 Implement optimized strcaecmp for x86-64. 2010-07-30 00:14:04 -07:00
Ulrich Drepper 24fb0f88ed Add optimized x86-64 implementation of strnlen.
While at it, beef up the test suite for strnlen and add performance
tests for it, too.
2010-07-26 08:37:08 -07:00
Ulrich Drepper dbc676d4ff Add performance tests for strstr and strcasestr. 2010-07-23 22:27:53 -07:00
Ulrich Drepper 4bcb2658ff * string/strverscmp.c (__strverscmp): Fix last cleanups.
* string/tst-svc.input: Add new test case.
	* string/tst-svc.expect: Adjust.
	* string/Makefile: Don't ignore tst-svc error.
2009-04-07 06:51:59 +00:00
Ulrich Drepper 4546646233 [BZ #9913]
* string/strverscmp.c (__strverscmp): Fix case of different digits
	in fractional part of string.
	Patch by Jingyu Liu <jyliu@fortinet.com>.
	* string/Makefile (tests): Add tst-svc2.
	* string/tst-svc2.c: New file.

	* string/strverscmp.c (__strverscmp): Optimize size of tables.
2009-03-14 20:15:21 +00:00
Ulrich Drepper f63abf584c * string/Makefile (strop-tests): Add memmem.
* string/test-memmem.c: New file.
	* string/test-string.h (BUF1PAGES): Define to 1 if undefined.
	(test_init): Size buf1 according to BUF1PAGES.

	* stdio-common/scanf16.c: New file.
	* stdio-common/scanf17.c: New file.
	* scripts/data/localplt-sparc64-linux-gnu.data: New file.
2008-05-25 00:17:34 +00:00
Ulrich Drepper 0caca71ac9 * string/Makefile (distribute): Add str-two-way.h.
2008-03-29  Eric Blake	<ebb9@byu.net>

	Rewrite string searches to O(n) rather than O(n^2).
	* string/str-two-way.h: New file.  For linear fixed-allocation
	string searching.
	* string/memmem.c: New implementation.
	* string/strstr.c: New implementation.
	* string/strcasestr.c: New implementation.

	* sysdeps/posix/getaddrinfo.c (getaddrinfo): Call _res_hconf_init
2008-05-15 04:42:20 +00:00
Ulrich Drepper 2f9a1be867 [BZ #6442]
* string/endian.h: Add macros for fixed-size endian conversion.
	* bits/byteswap.h: Allow inclusion from <endian.h>.
	* sysdeps/i386/bits/byteswap.h: Likewise.
	* sysdeps/ia64/bits/byteswap.h: Likewise.
	* sysdeps/s390/bits/byteswap.h: Likewise.
	* sysdeps/x86_64/bits/byteswap.h: Likewise.
	* string/Makefile (tests): Add tst-endian.
	* string/tst-endian.c: New file.
2008-05-15 02:54:33 +00:00
Ulrich Drepper 4a44ce79c6 * sysdeps/unix/sysv/linux/i386/sysdep.h (PTR_MANGLE): Roll value before
returning.
	(PTR_DEMANGLE): Real definition now that it's not the same as
	PRT_MANGLE anymore.
	* sysdeps/unix/sysv/linux/x86_64/sysdep.h: Likewise.

	* string/strerror_l.c: New file.
	* string/Makefile (routines): Add strerror_l.
	* string/string.h: Declare strerror_l.
	* string/Versions: Export strerror_l for GLIBC_2.6.

	* nscd/connections.c (nscd_run): Don't define MAXKEYLEN here.
2007-02-01 16:14:15 +00:00
Ulrich Drepper df859a0c15 * posix/execvp.c: Include alloca.h.
(allocate_scripts_argv): Renamed to...
	(scripts_argv): ... this.  Don't allocate buffer here nor count
	arguments.
	(execvp): Use alloca if possible.
	* posix/Makefile: Add rules to build and run tst-vfork3 test.
	* posix/tst-vfork3.c: New test.

2007-01-03  Ulrich Drepper  <drepper@redhat.com>

	* string/Makefile (tst-strxfrm2-ENV): Define.
	* stdlib/Makefile (tst-strtod3-ENV): Define.
2007-01-03 23:02:17 +00:00