summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* sigsegv, sigsegv-tests: Assign my contributions to the FSF.Eric Blake2021-06-213-3/+0
| | | | | | | | | | Following Bruno's lead, I'm also happy with this change. * m4/sigaltstack.m4: Change copyright notice: Write "Copyright (C) FSF" instead of "Copyright (C) Eric Blake". * tests/altstack-util.h: Likewise. * tests/test-sigsegv-catch-stackoverflow1.c: Likewise. * tests/test-sigsegv-catch-stackoverflow2.c: Likewise.
* sigsegv, sigsegv-tests: Assign my contributions to the FSF.Bruno Haible2021-06-196-6/+18
| | | | | | | | | | | | | | | | * lib/sigsegv.in.h: Change copyright notice: Write "Copyright (C) FSF" instead of "Copyright (C) Bruno Haible". * lib/sigsegv.c: Likewise. * lib/stackvma.h: Likewise. * lib/stackvma.c: Likewise. * m4/sigaltstack.m4: Likewise. * m4/stack-direction.m4: Likewise. * tests/altstack-util.h: Likewise. * tests/mmap-anon-util.h: Likewise. * tests/test-sigsegv-catch-segv1.c: Likewise. * tests/test-sigsegv-catch-segv2.c: Likewise. * tests/test-sigsegv-catch-stackoverflow1.c: Likewise. * tests/test-sigsegv-catch-stackoverflow2.c: Likewise.
* pipe-filter-ii tests: Fix long-standing failure on native Windows.Bruno Haible2021-06-152-0/+8
| | | | | | | * tests/test-pipe-filter-ii2-main.c: Include binary-io.h. (main): Avoid NL to CRLF conversion on standard output. * tests/test-pipe-filter-ii2-child.c: Include <unistd.h>, binary-io.h. (main): Avoid NL to CRLF conversion on standard output.
* sigsegv tests: Hide a null pointer from the compiler's optimizations.Bruno Haible2021-06-091-1/+2
| | | | | | | | Patch by Paul Eggert. * tests/test-sigsegv-catch-stackoverflow2.c (null_pointer_to_volatile_int): New variable. (main): Use it.
* ptsname_r: Add support for DragonFly BSD 6.0.Bruno Haible2021-06-081-2/+3
| | | | | * lib/ptsname_r.c (__ptsname_r): Add implementation for DragonFly BSD. * tests/test-ptsname_r.c (main): Treat Dragonfly BSD like Solaris.
* Avoid some test failures on DragonFly BSD 6.0.Bruno Haible2021-06-085-11/+26
| | | | | | | | | * tests/test-c32isalnum.c (main): On Dragonfly BSD, disable tests that fail. * tests/test-c32isalpha.c (main): Likewise. * tests/test-c32islower.c (main): Likewise. * tests/test-c32isupper.c (main): Likewise. * tests/test-ptsname.c (main): Treat Dragonfly BSD like Solaris.
* regex-tests: test for regressions fixed by the previous commitDmitry V. Levin2021-06-061-0/+4
| | | | | | | * tests/test-regex.c (tests): Add test cases for *+ and ** regressions fixed by the previous commit. Link: https://lists.gnu.org/archive/html/bug-gnulib/2021-04/msg00134.html
* regex-tests: remove incorrect commentDmitry V. Levin2021-06-061-1/+0
| | | | | | | | * tests/test-regex.c (tests): Remove the comment saying that some tests are not used. That comment was copied along with tests from glibc where some of these tests are commented out. Fixes: 70b673eb7 ("regex: fix longstanding backref match bug")
* Generate correct license notices in libunistring files.Bruno Haible2021-06-045-0/+80
| | | | | | | | | | | | | | | | | | | * lib/gen-uni-tables.c (output_library_license, output_tests_license): New functions. (output_predicate, output_category, output_combclass, output_bidi_category, output_decimal_digit, output_digit, output_numeric, output_mirror, output_joining_type, output_joining_group, output_scripts, output_scripts_byname, output_blocks, output_ident_category, output_lbrk_tables, output_wbrk_tables, output_gbp_table, output_decomposition_tables, output_composition_tables, output_simple_mapping, output_casing_rules): Invoke output_library_license. (output_predicate_test, output_decimal_digit_test, output_digit_test, output_numeric_test, output_joining_type_test, output_joining_group_test, output_gbp_test, output_simple_mapping_test): Invoke output_tests_license. * lib/uni*/*.h, lib/uni*/*.gperf: Regenerated. * tests/uni*/*.h: Likewise.
* reallocarray-tests: port to weird platformsPaul Eggert2021-05-301-3/+6
| | | | | | * tests/test-reallocarray.c (main): Don’t assume that PTRDIFF_MAX / 2 + 1 <= SIZE_MAX. POSIX allows platforms where this isn’t true, though I don’t know of any examples.
* dfa, etc.: prefer xreallocarray to older namePaul Eggert2021-05-301-4/+4
| | | | | | | | | * lib/dfa.c (addtok_mb, realloc_trans_if_necessary, enlist): * lib/readtokens.c (readtokens): * tests/uninorm/test-u32-normalize-big.c: (read_normalization_test_file): Prefer xreallocarray to the equivalent xnrealloc. The newer name follows the glibc lead of ‘reallocarray’.
* sigsegv: don’t assume SIGSTKSZ is a constantPaul Eggert2021-05-213-9/+15
| | | | | | | | | | | | * m4/sigaltstack.m4 (SV_SIGALTSTACK): Don’t attempt to override SIGSTKSZ. Instead, use an array that is plenty large, while checking that it’s large enough. Also, be consistent about putting that array in static storage rather than on the stack. * tests/altstack-util.h (SIGSTKSZ): Don’t define. (MYSTACK_SIZE): New macro, used consistently instead of SIGSTKSZ. (mystack_storage, mystack): Now static. (prepare_alternate_stack) [defined SIGSTKSZ]: Check that MYSTACK_SIZE is large enough.
* sigsegv: Add tests.Bruno Haible2021-05-166-0/+792
| | | | | | | | | | | * tests/test-sigsegv-catch-segv1.c: New file, from GNU libsigsegv with modifications. * tests/test-sigsegv-catch-segv2.c: Likewise. * tests/test-sigsegv-catch-stackoverflow1.c: Likewise. * tests/test-sigsegv-catch-stackoverflow2.c: Likewise. * tests/altstack-util.h: Likewise. * tests/mmap-anon-util.h: Likewise. * modules/sigsegv-tests: New file.
* realloc-gnu: avoid glibc MALLOC_CHECK_ issuePádraig Brady2021-05-151-1/+4
| | | | | | | | * tests/test-realloc-gnu.c (main): if MALLOC_CHECK_ env var is set then don't check ENOMEM is returned from realloc(). See https://sourceware.org/bugzilla/show_bug.cgi?id=27870 Note it doesn't suffice to unsetenv() this var within the program, as the hooks have already been set up at that stage.
* fcntl tests: Avoid failure in MacPorts.Bruno Haible2021-05-142-1/+12
| | | | | | | | | Reported by Nicholas Gaya <nicholasgaya@gmail.com> in <https://lists.gnu.org/archive/html/bug-gnulib/2021-05/msg00014.html>. * tests/test-fcntl.c (main): Close fd 10 before assuming that it is closed. * tests/test-execute-main.c: Update comment.
* *alloc-gnu tests: Use ASSERT macro.Bruno Haible2021-05-144-24/+31
| | | | | | | | | | | | | | | * tests/test-malloc-gnu.c: Include "macros.h". (main): Use ASSERT. * tests/test-calloc-gnu.c: Include "macros.h". (main): Use ASSERT. * tests/test-realloc-gnu.c: Include "macros.h". (main): Use ASSERT. * tests/test-reallocarray.c: Include "macros.h". (main): Use ASSERT. * modules/malloc-gnu-tests (Files): Add tests/macros.h. * modules/calloc-gnu-tests (Files): Likewise. * modules/realloc-gnu-tests (Files): Likewise. * modules/reallocarray-tests (Files): Likewise.
* reallocarray tests: Avoid test failure on NetBSD.Bruno Haible2021-05-131-1/+2
| | | | * tests/test-reallocarray.c (main): Accept EOVERFLOW error code.
* malloc-gnu, realloc-gnu, calloc-gnu tests: Verify errno is set.Bruno Haible2021-05-093-4/+10
| | | | | | | | * tests/test-malloc-gnu.c: Include <errno.h>. (main): Verify that, when an allocation larger than PTRDIFF_MAX failed, errno is ENOMEM. * tests/test-realloc-gnu.c: Likewise. * tests/test-calloc-gnu.c: Likewise.
* free tests: Avoid test failure on glibc < 2.15.Bruno Haible2021-05-091-1/+3
| | | | * tests/test-free.c (main): Skip the hairy test on glibc < 2.15.
* reallocarray: don’t crash if item size is 0Paul Eggert2021-04-251-2/+7
| | | | | | | | | This problem affects only platforms where xalloc_oversized divides a number by the size arg. Fix this by defining xalloc_oversized (n, s) to work even if s == 0. * lib/malloca.h, lib/xalloc-oversized.h: Document new behavior. * lib/xalloc-oversized.h (__xalloc_oversized): Do not crash if S==0. * tests/test-reallocarray.c (main): Test for the bug.
* reallocarray: check for ptrdiff_t overflowPaul Eggert2021-04-241-16/+21
| | | | | | | | | | | | | | | | * doc/glibc-functions/reallocarray.texi (reallocarray): Mention ptrdiff_t overflow. * lib/reallocarray.c (reallocarray): Reindent as per usual GNU. * lib/stdlib.in.h (reallocarray): Allow reallocarray to be replaced. * m4/reallocarray.m4 (gl_FUNC_REALLOCARRAY): Check for ptrdiff_t overflow. * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Set up REPLACE_REALLOCARRAY. * modules/reallocarray (Files): Add malloc.m4. (configure.ac): Also test REPLACE_REALLOCARRAY. * modules/reallocarray-tests (Depends-on): Add stdint. * modules/stdlib (stdlib.h): Substitute REPLACE_REALLOCARRAY. * tests/test-reallocarray.c: Include stdint.h. (main): Check for ptrdiff_t overflow.
* calloc-gnu-tests: add overflow testsPaul Eggert2021-04-241-21/+16
| | | | | | * tests/test-calloc-gnu.c (identity): New function, replacing ‘eight’. (main): Do 2 * log2(SIZE_MAX) tests instead of just two tests. Don’t bother to free on failure.
* execute-tests: pacify compilerPaul Eggert2021-04-211-3/+3
| | | | | | * tests/test-execute-main.c (main): Use 0x7DEADBEE rather than 0xDEADBEEF for nonces, to avoid provoking AIX XLC compiler warning that the latter is out of int range.
* malloc-gnu-tests, etc.: use volatile for clangPaul Eggert2021-04-207-17/+20
| | | | | | | | | | | | | | | In some more test locations, store the result of malloc etc. into a volatile pointer so that clang doesn’t optimize away the malloc and thus bypass the test. This fixes a malloc-gnu test failure on macOS 11.2.3 with clang 12.0.0 on ARM. * tests/test-alloca-opt.c (do_allocation): * tests/test-malloc-gnu.c (main): * tests/test-malloca.c (do_allocation): * tests/test-realloc-gnu.c (main): * tests/test-reallocarray.c (main): * tests/test-aligned-malloc.c (main): * tests/test-aligned_alloc.c (main): Store malloc etc. results into a volatile pointer.
* malloc-gnu-tests: pacify -Walloc-size-larger-thanPaul Eggert2021-04-182-6/+6
| | | | | | | | * tests/test-malloc-gnu.c (main): * tests/test-realloc-gnu.c (main): Hide true intentions from GCC, to prevent diagnostics like “warning: argument 1 value ‘9223372036854775808’ exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]”.
* malloc-gnu-tests, etc.: test ptrdiff_t overflowPaul Eggert2021-04-183-2/+33
| | | | | | | | | * modules/calloc-gnu-tests (Depends-on): * modules/malloc-gnu-tests (Depends-on): * modules/realloc-gnu-tests (Depends-on): Add stdint. * tests/test-calloc-gnu.c (main): * tests/test-malloc-gnu.c (main):, * tests/test-realloc-gnu.c (main): Test for ptrdiff_t overflow.
* execute tests: Avoid test failure in certain environments.Bruno Haible2021-04-082-8/+30
| | | | | | | | | Reported by Dmitry V. Levin <ldv@altlinux.org> in <https://lists.gnu.org/archive/html/bug-gnulib/2021-04/msg00082.html>. * tests/test-execute-main.c (main): Close file descriptors 3..19. * tests/test-execute-child.c (main): Remove NetBSD workaround. * modules/execute-tests (configure.ac): Test for close_range function.
* hamt: Fix coding errors.Marc Nieper-Wißkirchen2021-04-051-2/+2
| | | | | | | | | | | Reported by Bruno Haible in <https://lists.gnu.org/archive/html/bug-gnulib/2021-04/msg00047.html> after a Coverity run. * lib/hamt.c (bucket_do_while, hamt_iterator): Add missing derefencing operator and silence a bogus warning on uninitialized variables. * tests/test-hamt.c (test_general): Replace two errorneous assignment operators with comparison operators.
* *-list tests: Add more tests.Bruno Haible2021-04-038-0/+270
| | | | | | | | | | | | | * tests/test-array_list.c (check_equals_by_forward_iteration, check_equals_by_backward_iteration): New functions. (main): Invoke them. * tests/test-carray_list.c: Likewise. * tests/test-linked_list.c: Likewise. * tests/test-linkedhash_list.c: Likewise. * tests/test-avltree_list.c: Likewise. * tests/test-avltreehash_list.c: Likewise. * tests/test-rbtree_list.c: Likewise. * tests/test-rbtreehash_list.c: Likewise.
* hamt: New module.Marc Nieper-Wißkirchen2021-04-031-0/+378
| | | | | | | | | | This module provides (persistent) hash array mapped tries. * MODULES.html.sh: Add hamt. * lib/hamt.c: New file. * lib/hamt.h: New file. * modules/hamt: New file. * modules/hamt-tests: New file. * tests/test-hamt.c: New file.
* strtoll: Work around a bug on native Windows and Minix.Bruno Haible2021-04-021-0/+62
| | | | | | | | | | | * lib/stdlib.in.h (strtoll): Override if REPLACE_STRTOLL is 1. * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize REPLACE_STRTOLL. * m4/strtoll.m4 (gl_FUNC_STRTOLL): Test whether strtoll works. Set REPLACE_STRTOLL. * modules/stdlib (Makefile.am): Substitute REPLACE_STRTOLL. * modules/strtoll (configure.ac): Test REPLACE_STRTOLL. * tests/test-strtoll.c (main): Add tests of hexadecimal integer syntax. * doc/posix-functions/strtoll.texi: Mention the bug.
* strtol: Work around a bug on native Windows and Minix.Bruno Haible2021-04-021-0/+62
| | | | | | | | | | | | | | | | | * lib/stdlib.in.h (strtol): New declaration. * m4/stdlib_h.m4 (gl_STDLIB_H): Test whether strtol is declared. (gl_STDLIB_H_DEFAULTS): Initialize GNULIB_STRTOL, HAVE_STRTOL, REPLACE_STRTOL. * m4/strtol.m4 (gl_FUNC_STRTOL): Require gl_STDLIB_H_DEFAULTS. Test whether strtol works. Set REPLACE_STRTOL. * modules/stdlib (Makefile.am): Substitute GNULIB_STRTOL, HAVE_STRTOL, REPLACE_STRTOL. * modules/strtol (Status, Notice): Remove. (Depends-on): Add stdlib. (configure.ac): Test HAVE_STRTOL and REPLACE_STRTOL. Invoke gl_STDLIB_MODULE_INDICATOR. * tests/test-strtol.c (main): Add tests of hexadecimal integer syntax. * doc/posix-functions/strtol.texi: Mention the bug.
* strtoull: Work around a bug on native Windows and Minix.Bruno Haible2021-04-021-0/+62
| | | | | | | | | | | * lib/stdlib.in.h (strtoull): Override if REPLACE_STRTOULL is 1. * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize REPLACE_STRTOULL. * m4/strtoull.m4 (gl_FUNC_STRTOULL): Test whether strtoull works. Set REPLACE_STRTOULL. * modules/stdlib (Makefile.am): Substitute REPLACE_STRTOULL. * modules/strtoull (configure.ac): Test REPLACE_STRTOULL. * tests/test-strtoull.c (main): Add tests of hexadecimal integer syntax. * doc/posix-functions/strtoull.texi: Mention the bug.
* strtoul: Work around a bug on native Windows and Minix.Bruno Haible2021-04-021-0/+62
| | | | | | | | | | | | | | | | | | | | Reported by Eric Blake <eblake@redhat.com> in <https://lists.gnu.org/archive/html/bug-gnulib/2021-03/msg00082.html>. * lib/stdlib.in.h (strtoul): New declaration. * m4/stdlib_h.m4 (gl_STDLIB_H): Test whether strtoul is declared. (gl_STDLIB_H_DEFAULTS): Initialize GNULIB_STRTOUL, HAVE_STRTOUL, REPLACE_STRTOUL. * m4/strtoul.m4 (gl_FUNC_STRTOUL): Require gl_STDLIB_H_DEFAULTS. Test whether strtoul works. Set REPLACE_STRTOUL. * modules/stdlib (Makefile.am): Substitute GNULIB_STRTOUL, HAVE_STRTOUL, REPLACE_STRTOUL. * modules/strtoul (Status, Notice): Remove. (Depends-on): Add stdlib. (configure.ac): Test HAVE_STRTOUL and REPLACE_STRTOUL. Invoke gl_STDLIB_MODULE_INDICATOR. * tests/test-strtoul.c (main): Add tests of hexadecimal integer syntax. * doc/posix-functions/strtoul.texi: Mention the bug.
* linked-list tests: Add another test for SIGNAL_SAFE_LIST.Bruno Haible2021-03-284-41/+675
| | | | | | | | | | | | | | | | | | * tests/test-asyncsafe-linked_list-strong.c: Renamed from tests/test-asyncsafe-linked_list.c. * tests/test-asyncsafe-linked_list-strong.sh: Renamed from tests/test-asyncsafe-linked_list.sh. * tests/test-asyncsafe-linked_list-weak.c: New file, based on tests/test-asyncsafe-linked_list.c. * tests/test-asyncsafe-linked_list-weak.sh: New file, based on tests/test-asyncsafe-linked_list.sh. * modules/linked-list-tests (Files): Add tests/test-asyncsafe-linked_list-weak.*, tests/test-asyncsafe-linked_list-strong.*. (Makefile.am): Arrange to test also tests/test-asyncsafe-linked_list-weak.sh. Mark test-asyncsafe-linked_list-weak.sh and test-asyncsafe-linked_list-strong.sh as expected failures.
* renameatu tests: Add unit test for bug found on macOS.Bruno Haible2021-03-271-0/+10
| | | | | * tests/test-renameatu.c (main): Add test for identical rename with RENAME_NOREPLACE.
* tests: fix signed overflow issuesPaul Eggert2021-03-212-2/+2
| | | | | | | * tests/test-dynarray.c (value_at): Avoid undefined behavior in signed integer multiplication. * tests/test-scratch-buffer.c (byte_at): Likewise, for the theoretically-possible case where size_t is narrower than int.
* simple-atomic tests: Fix compilation error on Solaris 10.Bruno Haible2021-03-191-5/+5
| | | | | | | Reported by Tom G. Christensen <tgc@jupiterrise.com> in <https://lists.gnu.org/archive/html/bug-gnulib/2021-03/msg00085.html>. * tests/test-simple-atomic.c (yield): Define only after all #includes.
* parse-datetime tests: Avoid a test failure on NetBSD.Bruno Haible2021-03-141-0/+4
| | | | | | | Reported by Thomas Klausner <tk@giga.or.at> in <https://lists.gnu.org/archive/html/bug-gnulib/2021-03/msg00069.html>. * tests/test-parse-datetime.c (main): Skip two tests on NetBSD.
* Rename GNULIB_WCHAR_SINGLE to GNULIB_WCHAR_SINGLE_LOCALE.Bruno Haible2021-03-071-1/+1
| | | | | | | | | | * lib/lc-charset-dispatch.c: Test GNULIB_WCHAR_SINGLE_LOCALE instead of GNULIB_WCHAR_SINGLE. * lib/wcwidth.c: Likewise. * tests/test-wcwidth.c: Likewise. * doc/multithread.texi: Document GNULIB_WCHAR_SINGLE_LOCALE instead of GNULIB_WCHAR_SINGLE. * NEWS: Document the change.
* dynarray: Add tests.Bruno Haible2021-03-071-0/+53
| | | | | * tests/test-dynarray.c: New file. * modules/dynarray-tests: New file.
* string-buffer: Fixes.Bruno Haible2021-02-271-1/+8
| | | | | | * modules/string-buffer (License): Change to LGPL. * tests/test-string-buffer.c (main): Add another sb_appendf call, that is more likely to fail.
* string-buffer: Add tests.Bruno Haible2021-02-211-0/+108
| | | | | * tests/test-string-buffer.c: New file. * modules/string-buffer-tests: New file.
* linked-list test: Add test for SIGNAL_SAFE_LIST. (It currently fails.)Bruno Haible2021-02-162-0/+338
| | | | | | | | | * tests/test-asyncsafe-linked_list.sh: New file. * tests/test-asyncsafe-linked_list.c: New file. * modules/linked-list-tests (Files): Add them. (Depends-on): Add thread, yield, nanosleep, sigaction, sigprocmask. (Makefile.am): Arrange to compile test-asyncsafe-linked_list.c and run test-asyncsafe-linked_list.sh.
* simple-atomic: Add tests.Bruno Haible2021-02-151-0/+234
| | | | | * tests/test-simple-atomic.c: New file. * modules/simple-atomic-tests: New file.
* posixtm tests: Fix warnings seen on MidnightBSD/x86.Bruno Haible2021-02-081-1/+1
| | | | | * tests/test-posixtm.c (main): Convert two 'time_t' values to 'long' for printing.
* immutable: Avoid test failures on MidnightBSD.Bruno Haible2021-02-071-1/+1
| | | | | * tests/test-immutable.c (install_segv_handler): On FreeBSD, install the handler also for SIGBUS.
* c32is*: Avoid test failures on MidnightBSD.Bruno Haible2021-02-075-11/+11
| | | | | | | | | * tests/test-c32isalnum.c (main): On FreeBSD, disable tests that fail on MidnightBSD 1.1. * tests/test-c32isalpha.c (main): Likewise. * tests/test-c32isblank.c (main): Likewise. * tests/test-c32islower.c (main): Likewise. * tests/test-c32isupper.c (main): Likewise.
* regex-tests: add bug 11053 testPaul Eggert2021-02-051-0/+29
| | | | * tests/test-regex.c (main): New test case for glibc bug 11053.
* regex: fix longstanding backref match bugPaul Eggert2021-02-051-2/+111
| | | | | | | | | | | | | | This fixes a longstanding glibc bug concerning backreferences <https://sourceware.org/11053> (2009-12-04). * lib/regexec.c (proceed_next_node, push_fail_stack) (pop_fail_stack): Push and pop the previous registers as well as the current ones. All callers changed. (set_regs): Also pop if CUR_NODE has already been checked, so that it does not get added as a duplicate set entry. (update_regs): Fix comment location. * tests/test-regex.c (tests): New constant. (bug_regex11): New test function. (main): Bump alarm value. Call new test function.