summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* argmatch: put all the docs member last.Akim Demaille2019-06-221-1/+1
| | | | | | | Reported by Bruno Haible. * lib/argmatch.h (argmatch_##Name##_group_type): Put the args member before the docs done. * doc/argmatch.texi, tests/test-argmatch.c: Adjust.
* argmatch: add support to generate the usage messageAkim Demaille2019-06-211-19/+75
| | | | | | | | | | | | | | * lib/argmatch.c: Move some #includes and gettext support to... * lib/argmatch.h: here. (ARGMATCH_DEFINE_GROUP): New macro. * tests/test-argmatch.c (argmatch_backup_docs, argmatch_backup_args) (argmatch_backup_group): New. (CHECK): New. (main): Check argmatch_backup_value, argmatch_backup_xvalue, argmatch_backup_argument and argmatch_backup_usage. * modules/argmatch: We depend on c99. * doc/argmatch.texi (Recognizing Option Arguments): New. * doc/gnulib.texi: Use it.
* threads-h: Define 'thread_local' if and only it actually works.Bruno Haible2019-06-212-4/+198
| | | | | | | | | | | | | | | | | | | * m4/threads.m4 (gl_THREAD_LOCAL_DEFINITION): New macro. (gl_THREADS_H): Define _Thread_local to __thread also for ARM C, IBM C, Oracle Solaris Studio C. Compile a simple program, to see whether _Thread_local basically works. Set HAVE_THREAD_LOCAL and LIBTHREADLOCAL. (gl_THREADS_H_DEFAULTS): Initialize HAVE_THREAD_LOCAL. * lib/threads.in.h (thread_local): Undefine if it does not work. * modules/threads-h (Makefile.am): Substitute HAVE_THREAD_LOCAL. (Link): Mention LIBTHREADLOCAL. * tests/test-threads.c: Don't check that thread_local is defined. * tests/test-thread_local.c: New file. * modules/threads-h-tests (Files): Add it and macros.h. (Depends-on): Add thrd and stdint. (configure.ac): Test whether 'alarm' is declared. (Makefile.am): Arrange to build and link test-thread_local. * doc/posix-headers/threads.texi: Mention the platforms that don't support 'thread_local'.
* tss tests: Small improvement.Bruno Haible2019-06-201-1/+2
| | | | * tests/test-tss.c (test_tss): Pass a different id to each thread.
* tss: Add tests.Bruno Haible2019-06-201-0/+203
| | | | | * tests/test-tss.c: New file, based on tests/test-tls.c. * modules/tss-tests: New file.
* cnd: Add tests.Bruno Haible2019-06-201-0/+209
| | | | | * tests/test-cnd.c: New file, based on tests/test-cond.c. * modules/cnd-tests: New file.
* mtx: Add tests.Bruno Haible2019-06-202-0/+692
| | | | | | * tests/test-mtx.c: New file, based on tests/test-lock.c. * tests/test-call_once.c: New file, based on tests/test-once.c. * modules/mtx-tests: New file.
* thrd: Add tests.Bruno Haible2019-06-202-0/+104
| | | | | | | | * tests/test-thrd_create.c: New file, based on tests/test-thread_create.c. * tests/test-thrd_current.c: New file, based on tests/test-thread_self.c. * modules/thrd-tests: New file.
* threads-h: Add tests.Bruno Haible2019-06-202-0/+138
| | | | | | | * tests/test-threads.c: New file. * modules/threads-h-tests: New file. * tests/test-threads-c++.cc: New file. * modules/threads-h-c++-tests: New file.
* tls tests: Small improvements.Bruno Haible2019-06-201-2/+3
| | | | | | | * tests/test-tls.c: Include <stdint.h>. (worker_thread): Avoid gcc warning on 64-bit mingw. (test_tls): Pass a different id to each thread. * modules/tls-tests (Depends-on): Add stdint.
* cond tests: Simplify.Bruno Haible2019-06-201-2/+0
| | | | * tests/test-cond.c (test_timedcond): Remove redundant assignment.
* lock tests: Avoid reference to undefined variable if !ENABLE_LOCKING.Bruno Haible2019-06-201-0/+2
| | | | | * tests/test-lock.c (test_once): Don't reference fire_signal if !ENABLE_LOCKING.
* verify-tests: work around xlc bugPaul Eggert2019-06-181-1/+1
| | | | | | | Problem reported by Bruno Haible in: https://lists.gnu.org/r/bug-gnulib/2019-06/msg00049.html * tests/test-verify.c (item): Move the arithmetic inside the verify_expr, to avoid tickling a bug in IBM AIX xlc V12.1.
* Fix comments in last commit.Bruno Haible2019-06-151-6/+6
| | | | | | | | | | | Reported by Paul Eggert. * build-aux/useless-if-before-free: Fix comment regarding the second line. * build-aux/announce-gen: Likewise. * build-aux/gitlog-to-changelog: Likewise. * build-aux/prefix-gnulib-mk: Likewise. * build-aux/update-copyright: Likewise. * tests/test-update-copyright.sh: Update test program accordingly.
* Fix scripts to have valid executable format on Alpine Linux.Bruno Haible2019-06-151-3/+17
| | | | | | | | | | | | | Reported by Tim Rühsen <tim.ruehsen@gmx.de>. Idea by Paul Eggert. * build-aux/useless-if-before-free: Use a prologue that starts with '#!/bin/sh'. * build-aux/announce-gen: Likewise. * build-aux/gitlog-to-changelog: Likewise. * build-aux/prefix-gnulib-mk: Likewise. * build-aux/update-copyright: Likewise. * tests/test-update-copyright.sh: Update test program accordingly.
* posix_spawn_file_actions_addfchdir: Add tests.Bruno Haible2019-06-102-0/+192
| | | | | | * tests/test-posix_spawn_file_actions_addfchdir.c: New file. * tests/test-posix_spawn5.c: New file. * modules/posix_spawn_file_actions_addfchdir-tests: New file.
* posix_spawn_file_actions_addfchdir: New module.Bruno Haible2019-06-101-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/spawn.in.h (posix_spawn_file_actions_addfchdir): New declaration. * lib/spawn_int.h (struct __spawn_action): Add tag 'spawn_do_fchdir' and union member 'fchdir_action'. * lib/spawn_faction_addfchdir.c: New file. * lib/spawni.c (__spawni): Implement the spawn_do_fchdir action. * m4/posix_spawn_faction_addfchdir.m4: New file. * m4/posix_spawn.m4 (gl_POSIX_SPAWN_BODY): Test whether module 'posix_spawn_file_actions_addfchdir' is present and whether posix_spawn_file_actions_addfchdir_np exists. Set REPLACE_POSIX_SPAWN. * m4/spawn_h.m4 (gl_SPAWN_H): Test whether posix_spawn_file_actions_addfchdir is declared. (gl_SPAWN_H_DEFAULTS): Initialize GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDFCHDIR, HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDFCHDIR, REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDFCHDIR. * modules/spawn (Makefile.am): Substitute GNULIB_POSIX_SPAWN_FILE_ACTIONS_ADDFCHDIR, HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDFCHDIR, REPLACE_POSIX_SPAWN_FILE_ACTIONS_ADDFCHDIR. * modules/posix_spawn_file_actions_addfchdir: New file. * tests/test-spawn-c++.cc (posix_spawn_file_actions_addfchdir): Check signature. * doc/posix-functions/posix_spawn.texi: Mention the new module. * doc/posix-functions/posix_spawnp.texi: Likewise. * doc/glibc-functions/posix_spawn_file_actions_addfchdir_np.texi: Likewise.
* verify: remove verify_truePaul Eggert2019-05-091-1/+1
| | | | | | * NEWS: Mention this. * lib/verify.h (verify_true): Remove. * tests/test-verify.c (item): Test verify_expr, not verify_true.
* wcwidth: Ensure width 1, not 2, for ambiguous characters.Bruno Haible2019-05-051-0/+16
| | | | | | | | | | | Reported by Kiyoshi KANAZAWA <yoi_no_myoujou@yahoo.co.jp> via Akim Demaille <akim.demaille@gmail.com>. * m4/wcwidth.m4 (gl_FUNC_WCWIDTH): Check the width of U+2202. Use an en_US.UTF-8 locale, since that is more likely to be present than an fr_FR.UTF-8 locale. * tests/test-wcwidth.c (main): Check the width of U+2202. * doc/posix-functions/wcwidth.texi: Mention the issue.
* tls tests: Prevent that the test takes too long.Bruno Haible2019-04-281-0/+13
| | | | | | * tests/test-tls.c: Include <signal.h>, <unistd.h>. (main): Let the test fail if it takes more than 10 minutes. * modules/tls-tests (configure.ac): Test whether 'alarm' is declared.
* lock tests: Prevent that the test takes too long.Bruno Haible2019-04-281-0/+13
| | | | | | * tests/test-lock.c: Include <signal.h>, <unistd.h>. (main): Let the test fail if it takes more than 10 minutes. * modules/lock-tests (configure.ac): Test whether 'alarm' is declared.
* Fix gcc warnings on 64-bit mode mingw.Bruno Haible2019-04-271-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/clean-temp.c: Include <stdint.h> instead of defining uintptr_t. * lib/gl_array_list.c: Likewise. * lib/gl_array_map.c: Likewise. * lib/gl_array_set.c: Likewise. * lib/gl_carray_list.c: Likewise. * lib/gl_sublist.c: Likewise. * lib/gl_avltreehash_list.c (uintptr_t): Remove definition. * lib/gl_rbtreehash_list.c (uintptr_t): Likewise. * lib/gl_hash_map.c (uintptr_t): Likewise. * lib/gl_hash_set.c (uintptr_t): Likewise. * lib/gl_linkedhash_list.c (uintptr_t): Likewise. * lib/gl_linkedhash_map.c (uintptr_t): Likewise. * lib/gl_linkedhash_set.c (uintptr_t): Likewise. * lib/iconv.c (uintptr_t): Likewise. * lib/iconv_close.c (uintptr_t): Likewise. * tests/test-lock.c: Include <stdint.h>. (once_contender_thread, test_once): Cast through 'intptr_t' instead of 'long'. * modules/clean-temp (Depends-on): Add stdint. * modules/array-list (Depends-on): Likewise. * modules/array-map (Depends-on): Likewise. * modules/array-set (Depends-on): Likewise. * modules/carray-list (Depends-on): Likewise. * modules/sublist (Depends-on): Likewise. * modules/lock-tests (Depends-on): Likewise.
* di-set: allow free with 'ino_map' being NULLBernhard Voelker2019-04-181-0/+3
| | | | | | | * lib/di-set.c (di_set_free): Avoid ino_map_free() when dis->ino_map is NULL. Bug introduced in commit 3703dbbe88dd. * tests/test-di-set.c: Add di_set_free() right after di_set_alloc() as a test.
* term-style-control: Add tests.Bruno Haible2019-03-242-0/+298
| | | | | | * tests/test-term-style-control-hello.c: New file. * tests/test-term-style-control-yes.c: New file. * modules/term-style-control-tests: New file.
* bitset: expose bitset_resizeAkim Demaille2019-03-211-6/+19
| | | | | | * lib/bitset.h (bitset_resize): Bounce on the polymorphic implementation. * tests/test-bitset.c (check_attributes): Check bitset_resize. (main): Use a variable bitset as reference, since fixed does not support resize.
* libtextstyle-optional: Add tests.Bruno Haible2019-03-202-0/+108
| | | | | | | | * tests/test-libtextstyle.c: New file, based on libtextstyle's adhoc-tests/hello.c. * tests/test-libtextstyle-default.css: New file, copied from libtextstyle's adhoc-tests/hello-default.css. * modules/libtextstyle-optional-tests: New file.
* bitset: a bit (...) more testsAkim Demaille2019-03-171-0/+29
| | | | * tests/test-bitset.c (check_attributes): Check zero and ones.
* all: Update URLs to msdn.microsoft.com.Bruno Haible2019-03-142-2/+2
| | | | | * lib/stat-w32.c et al.: Update URLs after most of msdn.microsoft.com was moved to docs.microsoft.com.
* tests: Avoid havoc with "gcc -fcheck-pointer-bounds".Bruno Haible2019-03-102-2/+8
| | | | | | * tests/test-fprintf-posix2.c: Skip the test when -fcheck-pointer-bounds is in use. * tests/test-printf-posix2.c: Likewise.
* uninorm tests: Free allocated memory.Bruno Haible2019-03-106-1/+39
| | | | | | | | | | | | | | * tests/uninorm/test-u32-normalize-big.h (struct normalization_test_file): Remove 'const' from allocated member. (free_normalization_test_file): New declaration. * tests/uninorm/test-u32-normalize-big.c (test_other): Free allocated memory. (free_normalization_test_file): New function. * tests/uninorm/test-u32-nfc-big.c (main): Free allocated 'struct normalization_test_file' contents. * tests/uninorm/test-u32-nfd-big.c (main): Likewise. * tests/uninorm/test-u32-nfkc-big.c (main): Likewise. * tests/uninorm/test-u32-nfkd-big.c (main): Likewise.
* tests: Free allocated memory.Bruno Haible2019-03-1024-3/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reported by <deltatau@protonmail.com> via Assaf Gordon. * tests/test-astrxfrm.c (main): Free allocated memory. * tests/test-bitset.c (compare, check_attributes): Free allocated bitsets. * tests/test-filenamecat.c (main): Free allocated memory. * tests/test-freadahead.c (main): Free allocated memory and close stdin. * tests/test-freadptr.c (main): Likewise. * tests/test-freadptr2.c (main): Free allocated memory. * tests/test-freadseek.c (main): Likewise. * tests/test-gc-arcfour.c (main): Close allocated context. * tests/test-gc-arctwo.c (main): Likewise. * tests/test-gc-des.c (main): Close all allocated contexts. * tests/test-pipe-filter-gi1.c (main): Free allocated memory. * tests/test-pipe-filter-ii1.c (main): Likewise. * tests/test-posix_spawn_file_actions_addchdir.c (main): Destroy the allocated file actions. * tests/test-posix_spawn_file_actions_addclose.c (main): Likewise. * tests/test-posix_spawn_file_actions_adddup2.c (main): Likewise. * tests/test-posix_spawn_file_actions_addopen.c (main): Likewise. * tests/test-sameacls.c (main): Free allocated memory and ACLs. * tests/test-strfmon_l.c (main): Free allocated locales. * tests/test-striconveh.c (main): Free allocated iconv_t objects. * tests/uniconv/test-u8-conv-to-enc.c (main): Free allocated memory. * tests/uniconv/test-u16-conv-to-enc.c (main): Likewise. * tests/uniconv/test-u32-conv-to-enc.c (main): Likewise. * tests/unistr/test-chr.h (main): Free input32. * tests/unistr/test-strchr.h (test_strchr): Likewise.
* Fix another test failure introduced by the same commit.Bruno Haible2019-03-101-1/+1
|
* Fix test failure introduced by last commit.Bruno Haible2019-03-101-1/+1
|
* tests: Prepare for using valgrind.Bruno Haible2019-03-10174-331/+331
| | | | | tests/*.sh: Invoke all test programs through ${CHECKER}. tests/*/*.sh: Likewise.
* get-rusage-as, pthread_sigmask tests: Fix -fsanitize=thread findings.Bruno Haible2019-03-101-0/+4
| | | | | | | * lib/get-rusage-as.c (get_rusage_as): When compiled by "gcc -fsanitize=thread", don't try get_rusage_as_via_setrlimit. * tests/test-pthread_sigmask2.c (main): Clean up the killer_thread before exiting.
* test-userspec.c: don't print NULLJim Meyering2019-03-091-2/+4
| | | | | | | | * tests/test-userspec.c (main): A test release of gcc, 9.0.1 20190310, warned that this test would attempt to print a NULL pointer via a %s printf format. Fix that and remove the unnecessary preceding "!diag" conjunct. Also add a comment.
* alloca, tsearch-tests: Write NULL for the null pointer.Michal Privoznik2019-03-101-1/+1
| | | | | * lib/alloca.c (i00afunc): Write NULL instead of 0. * tests/test-tsearch.c (mangle_tree): Likewise.
* Fix undefined behaviour.Bruno Haible2019-03-094-52/+84
| | | | | | | | | | | | | * lib/bitrotate.h (rotl16, rotr16, rotl8, rotr8): Case x to 'unsigned int', to avoid shift operations on 'int'. * lib/xmemdup0.c (xmemdup0): Don't invoke memcpy with a zero size. * tests/test-count-leading-zeros.c (main): Use a random number that has as many bits as TYPE, not only 2*15 or 2*31 bits. * tests/test-count-trailing-zeros.c (main): Likewise. * tests/test-count-one-bits.c (main): Likewise. * tests/test-memmem.c: Don't include "null-ptr.h". (main): Use zerosize_ptr() instead of null_ptr(). * modules/memmem-tests (Files): Remove tests/null-ptr.h.
* *-map tests: Fix compilation error.Colin Watson2019-02-023-0/+3
| | | | | | * tests/test-array_map.c: Include <limits.h>, for CHAR_BIT. * tests/test-hash_map.c: Likewise. * tests/test-linkedhash_map.c: Likewise.
* strtod, strtold: Use the locale's decimal point.Bruno Haible2019-02-014-0/+240
| | | | | | | | | | | | | | | | | | | | | | | * lib/strtod.c: Include <locale.h>, <stdio.h>, <langinfo.h>. (decimal_point_char): New function, copied from lib/vasnprintf.c. (parse_number): Add a radixchar argument. Use it instead of '.'. (STRTOD): Invoke decimal_point_char and pass the result to parse_number. * m4/strtod.m4 (gl_PREREQ_STRTOD): Test whether nl_langinfo exists. * m4/strtold.m4 (gl_PREREQ_STRTOLD): Likewise. * tests/test-strtod1.c: New file. * tests/test-strtod1.sh: New file. * modules/strtod-tests (Files): Add test-strtod1.{sh,c}. Add locale-fr.m4 and its dependencies. (configure.ac): Invoke gt_LOCALE_FR, gt_LOCALE_FR_UTF8. (Makefile.am): Arrange to compile test-strtod1.c and run test-strtod1.sh. * tests/test-strtold1.c: New file. * tests/test-strtold1.sh: New file. * modules/strtold-tests (Files): Add test-strtold1.{sh,c}. Add locale-fr.m4 and its dependencies. (configure.ac): Invoke gt_LOCALE_FR, gt_LOCALE_FR_UTF8. (Makefile.am): Arrange to compile test-strtold1.c and run test-strtold1.sh.
* strtod, strtold tests: Simplify tests.Bruno Haible2019-02-012-16/+4
| | | | | * tests/test-strtod.c (main): Assume no rounding errors for 0.5. * tests/test-strtold.c (main): Likewise.
* strtold: Add tests.Bruno Haible2019-01-301-0/+986
| | | | | * tests/test-strtold.c: New file, based on tests/test-strtod.c. * modules/strtold-tests: New file.
* Fix build error when building a shared libunistring on Android.Bruno Haible2019-01-284-8/+8
| | | | | | | | | | | | | | | * tests/uninorm/test-nfc.c (n): Don't define on Android. (main): Add 'volatile', to defeat a GCC optimization that would eliminate the reference. * tests/uninorm/test-nfd.c (n): Don't define on Android. (main): Add 'volatile', to defeat a GCC optimization that would eliminate the reference. * tests/uninorm/test-nfkc.c (n): Don't define on Android. (main): Add 'volatile', to defeat a GCC optimization that would eliminate the reference. * tests/uninorm/test-nfkd.c (n): Don't define on Android. (main): Add 'volatile', to defeat a GCC optimization that would eliminate the reference.
* test-framework-sh: Improve maintainability.Bruno Haible2019-01-271-241/+281
| | | | * tests/init.sh: Clarify what belongs together. Reorder definitions.
* tests: Don't assume that /tmp exists.Bruno Haible2019-01-274-0/+4
| | | | | | | * tests/test-set-mode-acl-1.sh: Skip the test if /tmp does not exist. * tests/test-copy-acl-1.sh: Likewise. * tests/test-file-has-acl-1.sh: Likewise. * tests/test-copy-file-1.sh: Likewise.
* tests: Accommodate a shell that is not in /bin/sh.Bruno Haible2019-01-2715-22/+87
| | | | | | | | | | | | | | | | | | | | | | | | | * tests/init.sh (setup_): Set srcdir and builddir. (BOURNE_SHELL): New variable. * modules/acl-tests (Depends-on): Add 'test-framework-sh'. * modules/file-has-acl-tests (Depends-on): Likewise. * modules/copy-file-tests (Depends-on): Likewise. * tests/test-set-mode-acl-1.sh: Use the test framework. Invoke shell scripts through $BOURNE_SHELL. * tests/test-set-mode-acl-2.sh: Likewise. * tests/test-copy-acl-1.sh: Likewise. * tests/test-copy-acl-2.sh: Likewise. * tests/test-file-has-acl-1.sh: Likewise. * tests/test-file-has-acl-2.sh: Likewise. * tests/test-copy-file-1.sh: Likewise. * tests/test-copy-file-2.sh: Likewise. * tests/test-set-mode-acl.sh (builddir): Consider value set by the invoker. * tests/test-copy-acl.sh (builddir): Likewise. * tests/test-file-has-acl.sh (builddir): Likewise. * tests/test-copy-file.sh (builddir): Likewise. * tests/test-vc-list-files-cvs.sh: Don't create shims for executables in build-aux/. Instead, invoke shell scripts through $BOURNE_SHELL. * tests/test-vc-list-files-git.sh: Likewise.
* tests: Fix some "unused variable" warnings.Bruno Haible2019-01-2717-18/+16
| | | | | | | | | | | | | | | | | | | | | | * tests/test-fts.c (fts_dealloc): Remove unused variable. * tests/unigbrk/test-uc-grapheme-breaks.c (main): Likewise. * tests/test-striconveh.c (main): Move some variable into the '#if HAVE_ICONV'. * tests/test-striconveha.c (main): Likewise. * tests/uniconv/test-u8-conv-from-enc.c (main): Likewise. * tests/uniconv/test-u16-conv-from-enc.c (main): Likewise. * tests/uniconv/test-u32-conv-from-enc.c (main): Likewise. * tests/uniconv/test-u8-conv-to-enc.c (main): Likewise. * tests/uniconv/test-u16-conv-to-enc.c (main): Likewise. * tests/uniconv/test-u32-conv-to-enc.c (main): Likewise. * tests/uniconv/test-u8-strconv-from-enc.c (main): Likewise. * tests/uniconv/test-u16-strconv-from-enc.c (main): Likewise. * tests/uniconv/test-u32-strconv-from-enc.c (main): Likewise. * tests/uniconv/test-u8-strconv-to-enc.c (main): Likewise. * tests/uniconv/test-u16-strconv-to-enc.c (main): Likewise. * tests/uniconv/test-u32-strconv-to-enc.c (main): Likewise. * tests/test-tsearch.c (main): Move some variable into the '#if HAVE_INITSTATE'.
* tests: Enable Linux specific tests on Android.Bruno Haible2019-01-272-2/+2
| | | | | * tests/test-flock.c (main): Treat Android like Linux. * tests/test-openat-safer.c (main): Likewise.
* fts: Add support for Android.Bruno Haible2019-01-271-2/+4
| | | | | | * m4/fts.m4 (gl_FUNC_FTS_CORE): Avoid conflicts between the symbols defined by this module and the ones in libc. * tests/test-fts.c (main): Treat mkdir error EMLINK like EMFILE.
* nonblocking-socket-tests: Fix test failure on Android 4.3.Bruno Haible2019-01-261-1/+2
| | | | | * tests/test-nonblocking-socket.h (SOCKET_HAS_LARGE_BUFFER): Define to 1 also on Android.