about summary refs log tree commit diff
path: root/string/test-strncmp.c
Commit message (Collapse)AuthorAgeFilesLines
* string: Hook up the default implementation on test-strncmpAdhemerval Zanella2023-02-061-0/+16
| | | | Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
* Update copyright dates with scripts/update-copyrightsJoseph Myers2023-01-061-1/+1
|
* tests/string: Drop simple/stupid/builtin testsSiddhesh Poyarekar2022-04-061-1/+0
| | | | | | | | | | | | | | | In most cases the simple/stupid/builtin functions were in there to benchmark optimized implementations against. Only in some cases the functions are used to check expected results. Remove these tests from IMPL() and only keep them in wherever they're used for a specific purpose, e.g. to generate expected results. This improves timing of `make subdirs=string` by over a minute and a half (over 15%) on a Whiskey Lake laptop. Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Reviewed-by: Noah Goldstein <libc-alpha@sourceware.org>
* Increase the test timeout of some string testsSzabolcs Nagy2022-04-011-0/+1
| | | | | | Recent changes in test-strncasecmp and test-strncmp pushed the run time of the tests above the 4 minute limit specified in test-string.h on an arm tester machine.
* string: Expand page cross test cases in test-strncmp.cNoah Goldstein2022-03-251-1/+26
| | | | | | Test cases for when both `s1` and `s2` are near the end of a page where previously missing. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
* string: Add a testcase for wcsncmp with SIZE_MAX [BZ #28755]H.J. Lu2022-02-171-0/+13
| | | | | | | | | | | | | | | | | | | | | | | Verify that wcsncmp (L("abc"), L("abd"), SIZE_MAX) == 0. The new test fails without commit ddf0992cf57a93200e0c782e2a94d0733a5a0b87 Author: Noah Goldstein <goldstein.w.n@gmail.com> Date: Sun Jan 9 16:02:21 2022 -0600 x86: Fix __wcsncmp_avx2 in strcmp-avx2.S [BZ# 28755] and commit 7e08db3359c86c94918feb33a1182cd0ff3bb10b Author: Noah Goldstein <goldstein.w.n@gmail.com> Date: Sun Jan 9 16:02:28 2022 -0600 x86: Fix __wcsncmp_evex in strcmp-evex.S [BZ# 28755] This is for BZ #28755. Reviewed-by: Sunil K Pandey <skpgkp2@gmail.com>
* x86: Fix bug in strncmp-evex and strncmp-avx2 [BZ #28895]Noah Goldstein2022-02-161-0/+23
| | | | | | | | | | | | | Logic can read before the start of `s1` / `s2` if both `s1` and `s2` are near the start of a page. To avoid having the result contimated by these comparisons the `strcmp` variants would mask off these comparisons. This was missing in the `strncmp` variants causing the bug. This commit adds the masking to `strncmp` so that out of range comparisons don't affect the result. test-strcmp, test-strncmp, test-wcscmp, and test-wcsncmp all pass as well a full xcheck on x86_64 linux. Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
* String: Ensure 'MIN_PAGE_SIZE' is multiple of 'getpagesize'Noah Goldstein2022-02-111-9/+9
| | | | | When 'TEST_LEN' was defined as (4096 * 3) the allocation size Would not be a multiple of system page size if system page size > 4096.
* string: Improve coverage in test-strcmp.c and test-strncmp.cNoah Goldstein2022-02-031-14/+243
| | | | | | | | | Add additional test cases for small / medium sizes. Add tests in test-strncmp.c where `n` is near ULONG_MAX or LONG_MIN to test for overflow bugs in length handling. Signed-off-by: Noah Goldstein <goldstein.w.n@gmail.com>
* string/test-str*cmp: remove stupid_[strcmp, strncmp, wcscmp, wcsncmp].Noah Goldstein2022-02-031-34/+0
| | | | | | | | These implementations just add to test duration. Since we have simple_* implementations we already have a safe reference implementation. Signed-off-by: Noah Goldstein <goldstein.w.n@gmail.com>
* Update copyright dates with scripts/update-copyrightsPaul Eggert2022-01-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | I used these shell commands: ../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright (cd ../glibc && git commit -am"[this commit message]") and then ignored the output, which consisted lines saying "FOO: warning: copyright statement not found" for each of 7061 files FOO. I then removed trailing white space from math/tgmath.h, support/tst-support-open-dev-null-range.c, and sysdeps/x86_64/multiarch/strlen-vec.S, to work around the following obscure pre-commit check failure diagnostics from Savannah. I don't know why I run into these diagnostics whereas others evidently do not. remote: *** 912-#endif remote: *** 913: remote: *** 914- remote: *** error: lines with trailing whitespace found ... remote: *** error: sysdeps/unix/sysv/linux/statx_cp.c: trailing lines
* Remove "Contributed by" linesSiddhesh Poyarekar2021-09-031-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | We stopped adding "Contributed by" or similar lines in sources in 2012 in favour of git logs and keeping the Contributors section of the glibc manual up to date. Removing these lines makes the license header a bit more consistent across files and also removes the possibility of error in attribution when license blocks or files are copied across since the contributed-by lines don't actually reflect reality in those cases. Move all "Contributed by" and similar lines (Written by, Test by, etc.) into a new file CONTRIBUTED-BY to retain record of these contributions. These contributors are also mentioned in manual/contrib.texi, so we just maintain this additional record as a courtesy to the earlier developers. The following scripts were used to filter a list of files to edit in place and to clean up the CONTRIBUTED-BY file respectively. These were not added to the glibc sources because they're not expected to be of any use in future given that this is a one time task: https://gist.github.com/siddhesh/b5ecac94eabfd72ed2916d6d8157e7dc https://gist.github.com/siddhesh/15ea1f5e435ace9774f485030695ee02 Reviewed-by: Carlos O'Donell <carlos@redhat.com>
* Update copyright dates with scripts/update-copyrightsPaul Eggert2021-01-021-1/+1
| | | | | | | | | | | | | | | | I used these shell commands: ../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright (cd ../glibc && git commit -am"[this commit message]") and then ignored the output, which consisted lines saying "FOO: warning: copyright statement not found" for each of 6694 files FOO. I then removed trailing white space from benchtests/bench-pthread-locks.c and iconvdata/tst-iconv-big5-hkscs-to-2ucs4.c, to work around this diagnostic from Savannah: remote: *** pre-commit check failed ... remote: *** error: lines with trailing whitespace found remote: error: hook declined to update refs/heads/master
* strncmp: Add a testcase for page boundary [BZ #25933]H.J. Lu2020-09-241-0/+33
| | | | | | | | | | | | | | Add a strncmp testcase to cover cases where one of strings ends on the page boundary with the maximum string length less than the number bytes of each AVX2 loop iteration and different offsets from page boundary. The updated string/test-strncmp fails on Intel Core i7-8559U without ommit 1c6432316bc434a72108d7b0c7cfbfdde64c3124 Author: Sunil K Pandey <skpgkp1@gmail.com> Date: Fri Jun 12 08:57:16 2020 -0700 Fix avx2 strncmp offset compare condition check [BZ #25933]
* Update copyright dates with scripts/update-copyrights.Joseph Myers2020-01-011-1/+1
|
* Prefer https to http for gnu.org and fsf.org URLsPaul Eggert2019-09-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also, change sources.redhat.com to sourceware.org. This patch was automatically generated by running the following shell script, which uses GNU sed, and which avoids modifying files imported from upstream: sed -ri ' s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g ' \ $(find $(git ls-files) -prune -type f \ ! -name '*.po' \ ! -name 'ChangeLog*' \ ! -path COPYING ! -path COPYING.LIB \ ! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \ ! -path manual/texinfo.tex ! -path scripts/config.guess \ ! -path scripts/config.sub ! -path scripts/install-sh \ ! -path scripts/mkinstalldirs ! -path scripts/move-if-change \ ! -path INSTALL ! -path locale/programs/charmap-kw.h \ ! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \ ! '(' -name configure \ -execdir test -f configure.ac -o -f configure.in ';' ')' \ ! '(' -name preconfigure \ -execdir test -f preconfigure.ac ';' ')' \ -print) and then by running 'make dist-prepare' to regenerate files built from the altered files, and then executing the following to cleanup: chmod a+x sysdeps/unix/sysv/linux/riscv/configure # Omit irrelevant whitespace and comment-only changes, # perhaps from a slightly-different Autoconf version. git checkout -f \ sysdeps/csky/configure \ sysdeps/hppa/configure \ sysdeps/riscv/configure \ sysdeps/unix/sysv/linux/csky/configure # Omit changes that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines git checkout -f \ sysdeps/powerpc/powerpc64/ppc-mcount.S \ sysdeps/unix/sysv/linux/s390/s390-64/syscall.S # Omit change that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
* Update copyright dates with scripts/update-copyrights.Joseph Myers2019-01-011-1/+1
| | | | | | | * All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2018-01-011-1/+1
| | | | | | | * All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
* Update string tests to use the support test driver.Wainer dos Santos Moschetta2017-03-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replaced all imports of test-skeleton.c with support/test-driver.c. In some cases it was needed to adjust do_test to return int instead of static int since that is the method's signature expected by test-driver.c. Checked on x86_64. * string/test-string.h (TEST_FUNCTION): Use test_main instead of test_main (). (CMDLINE_PROCESS): Use function instead of defined macro. * debug/test-strcpy_chk.c: Import support/test-driver.c and also <suppport/support.h> to use set_fortify_handler(). * string/bug-envz1.c: Import support/test-driver.c instead of test-skeleton.c. * string/bug-strcoll2.c: Likewise. * string/bug-strtok1.c: Likewise. * string/stratcliff.c: Likewise. * string/test-ffs.c: Likewise. * string/test-memccpy.c: Likewise. * string/test-memchr.c: Likewise. * string/test-memcmp.c: Likewise. * string/test-memcpy.c: Likewise. * string/test-memmem.c: Likewise. * string/test-memmove.c: Likewise. * string/test-memrchr.c: Likewise. * string/test-memset.c: Likewise. * string/test-rawmemchr.c: Likewise. * string/test-strcasecmp.c: Likewise. * string/test-strcasestr.c: Likewise. * string/test-strcat.c: Likewise. * string/test-strchr.c: Likewise. * string/test-strcmp.c: Likewise. * string/test-strcpy.c: Likewise. * string/test-string.h: Likewise. * string/test-strlen.c: Likewise. * string/test-strncasecmp.c: Likewise. * string/test-strncat.c: Likewise. * string/test-strncmp.c: Likewise. * string/test-strncpy.c: Likewise. * string/test-strnlen.c: Likewise. * string/test-strpbrk.c: Likewise. * string/test-strrchr.c: Likewise. * string/test-strspn.c: Likewise. * string/test-strstr.c: Likewise. * string/tst-bswap.c: Likewise. * string/tst-cmp.c: Likewise. * string/tst-endian.c: Likewise. * string/tst-inlcall.c: Likewise. * string/tst-strcoll-overflow.c: Likewise. * string/tst-strfry.c: Likewise. * string/tst-strlen.c: Likewise. * string/tst-strtok.c: Likewise. * string/tst-strtok_r.c: Likewise. * string/tst-strxfrm.c: Likewise. * string/tst-strxfrm2.c: Likewise. * string/tst-svc.c: Likewise. * string/tst-svc2.c: Likewise.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2017-01-011-1/+1
|
* Fix wide-char testsuite SIGBUS on platforms such as Sparc.David S. Miller2016-08-021-0/+6
| | | | | | * string/test-strncmp.c (do_test_limit): Make sure the test data stream is aligned as required for the type "CHAR". (do_test): Likewise.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2016-01-041-1/+1
|
* Use correct signedness in wcsncmpStefan Liebler2015-04-131-49/+129
| | | | | | | | | | | | | | [BZ #18206] * wcsmbs/wcsncmp.c (wcsncmp): Compare as wchar_t, not wint_t. Use signed comparision instead of substraction to avoid overflow bug. * localedata/tests-mbwc/tst_wcsncmp.c (tst_wcsncmp): Take the sign of ret. * localedata/tests-mbwc/dat_wcsncmp.c (tst_wcsncmp_loc): Do not expect precise return values. Only the sign matters. * wcsmbs/Makefile (strop-tests): Add wcsncmp. * wcsmbs/test-wcsncmp.c: New File. * string/test-strncmp.c: Add wcsncmp support.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2015-01-021-1/+1
|
* Update copyright notices with scripts/update-copyrightsAllan McRae2014-01-011-1/+1
|
* Remove performance-related bits from string testsSiddhesh Poyarekar2013-06-111-35/+0
|
* Update copyright notices with scripts/update-copyrights.Joseph Myers2013-01-021-1/+1
|
* Add string IFUNC testsH.J. Lu2012-10-191-1/+2
|
* Replace FSF snail mail address with URLs.Paul Eggert2012-02-091-3/+2
|
* Revert "Fix strncmp page test to limit length to size of object"Andreas Schwab2011-04-071-4/+3
| | | | This reverts commit e513f34605747f43eed259519b6fb847591861d2.
* Fix strncmp page test to limit length to size of objectAndreas Schwab2011-04-051-3/+4
|
* Fix whitespace issue.Ulrich Drepper2011-03-211-8/+8
|
* Handle page boundaries in x86 SSE4.2 strncmp.H.J. Lu2011-03-211-0/+41
|
* Fix bugs in x86-32 strcmp-sse4.S and strcmp-ssse3.SH.J. Lu2010-04-151-4/+35
|
* [BZ #1877]Ulrich Drepper2005-11-181-8/+33
| | | | | | | | | | | | | | | | | | | | 2005-11-17 Steven Munroe <sjmunroe@us.ibm.com> [BZ #1877] * string/test-strncmp.c (do_test_limit): Handle zero length and non-zero align values. (test_main): Correct do_test_limit tests for 64-bit. 2005-11-15 Steven Munroe <sjmunroe@us.ibm.com> * sysdeps/powerpc/sysdep.h (PPC_FEATURE_HAS_SPE, PPC_FEATURE_HAS_EFP_SINGLE, PPC_FEATURE_HAS_EFP_DOUBLE, PPC_FEATURE_NO_TB, PPC_FEATURE_POWER4, PPC_FEATURE_POWER5, PPC_FEATURE_POWER5_PLUS, PPC_FEATURE_CELL, PPC_FEATURE_970): Define to match 2.6.15 kernel. * sysdeps/powerpc/fpu/e_sqrt.c: Remove dl-procinfo.h include. * sysdeps/powerpc/fpu/e_sqrtf.c: Likewise. * sysdeps/powerpc/fpu/w_sqrtf.c: Likewise.
* [BZ #1877]Ulrich Drepper2005-11-171-4/+56
| | | | | | | | | | | | 2005-11-17 Steven Munroe <sjmunroe@us.ibm.com> [BZ #1877] * string/test-strncmp.c (do_test_limit): New function. (do_test) Add cast to eliminate compiler warnings. (do_random_tests) Add cast to eliminate compiler warnings. (test_main) Add do_test_limit tests. * sysdeps/powerpc/powerpc32/strncmp.S: Test length before unaligned load. * sysdeps/powerpc/powerpc64/strncmp.S: Likewise.
* (CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.Ulrich Drepper2004-12-221-81/+4
|
* 2.5-18.1Jakub Jelinek2007-07-121-4/+81
|
* Update.Ulrich Drepper2003-04-171-1/+3
| | | | | | | | | | | | | | | | | * string/test-memchr.c: Likewise. * string/test-memcmp.c: Likewise. * string/test-memcpy.c: Likewise. * string/test-memmove.c: Likewise. * string/test-memset.c: Likewise. * string/test-strcat.c: Likewise. * string/test-strchr.c: Likewise. * string/test-strcmp.c: Likewise. * string/test-strcpy.c: Likewise. * string/test-strlen.c: Likewise. * string/test-strncmp.c: Likewise. * string/test-strpbrk.c: Likewise. * string/test-strrchr.c: Likewise. * string/test-strspn.c: Likewise.
* * string/test-strcmp.c (do_random_tests): Test whether return valueRoland McGrath2003-04-111-3/+7
| | | | | | | | | has been promoted to wordsize if the ABI requires caller to do so. * string/test-strncmp.c (do_random_tests): Likewise. * string/test-memcmp.c (do_random_tests): Likewise. * sysdeps/powerpc/powerpc64/strcmp.S (strcmp): Sign extend rRTN before returning.
* * string/test-strspn.c (do_test): Ensure zero termination.Roland McGrath2002-11-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | * string/test-strpbrk.c (do_test): Likewise. * string/test-strncmp.c (stupid_strncmp): Use strnlen, not strlen. * string/test-strncpy.c (stupid_strncpy): Likewise. * string/test-stpncpy.c (stupid_stpncpy): Likewise. 2002-10-08 Roland McGrath <roland@redhat.com> * string/test-string.h (test_init): Fill BUF1 and BUF2 with nonzero characters. 2002-09-22 H.J. Lu <hjl@gnu.org> * sysdeps/unix/sysv/linux/mmap64.c (MMAP2_PAGE_SHIFT): Renamed from PAGE_SHIFT. Define if not defined. Check MMAP2_PAGE_SHIFT only if __NR_mmap2 is defined. * sysdeps/unix/sysv/linux/powerpc/mmap64.c: Moved to ... * sysdeps/unix/sysv/linux/mmap64.c: ... here. * sysdeps/unix/sysv/linux/hppa/mmap64.c: File removed. * sysdeps/unix/sysv/linux/sparc/sparc32/mmap64.c: FIle removed,
* * string/test-strchr.c (stupid_strchr): New function.Roland McGrath2002-11-081-21/+35
| | | | | | | | | | | | | | | | | | (do_random_tests): Make sure the string is zero terminated. * string/test-strpbrk.c (stupid_strpbrk): New function. (do_random_tests): Make sure the string is zero terminated. * string/test-strcmp.c (stupid_strcmp): New function. (do_random_tests): Make sure the strings are zero terminated. * string/test-strspn.c (stupid_strspn): New function. (simple_strspn): Rename rej argument to acc. (do_random_tests): Make sure the string is zero terminated. * string/test-strcspn.c (stupid_strcspn): New function. * string/test-strncpy.c (stupid_strncpy): New function. * string/test-stpncpy.c (stupid_stpncpy): New function. * string/test-strncmp.c (stupid_strncmp): New function. (do_random_tests): Make sure the strings are zero terminated. * string/test-string.h (impl_t): Change test into long. (IMPL): Add __attribute__((aligned (sizeof (void *)))).
* * string/test-string.h: New file.Roland McGrath2002-11-071-0/+259
* string/test-strlen.c: New file. * string/test-string.h: New file. * string/test-strcmp.c: New file. * string/test-strchr.c: New file. * string/test-strrchr.c: New file. * string/test-strcpy.c: New file. * string/test-stpcpy.c: New file. * string/test-strncpy.c: New file. * string/test-stpncpy.c: New file. * string/test-strpbrk.c: New file. * string/test-strcspn.c: New file. * string/test-strspn.c: New file. * string/test-strcat.c: New file. * string/test-strncmp.c: New file. * string/test-memchr.c: New file. * string/test-memcmp.c: New file. * string/test-memset.c: New file. * string/test-memcpy.c: New file. * string/test-mempcpy.c: New file. * string/test-memmove.c: New file. * string/Makefile (strop-tests): New variable. (tests): Add strop-tests. (distribute): Add test-string.h.