summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* * tests/test-getloadavg.c (main): Fix typo.Paul Eggert2020-06-271-1/+1
|
* c-dtoastr, c-ldtoastr: new modulesMarc Nieper-Wißkirchen2020-06-254-0/+146
| | | | | | | | | | | | | | | | | These modules provide the same functionality as the modules dtoastr and ldtoastr except for the formatting taking place in the C locale. * MODULES.html.sh: Add c-dtoastr and c-ldtoastr. * lib/c-dtoastr.c, lib/c-ldtoastr.c: New files. * lib/ftoastr.c: Prefix exported functions when the macro C_LOCALE is defined. Use c_snprintf and c_strtod/c_strtold instead of snprintf and strtod/strtold whhen the macro C_LOCALE is defined. * lib/ftoastr.h: Add prototypes for c_dtoastr and c_ldtoastr. * modules/c-dtoastr, modules/c-dtoastr-tests, modules/c-ldtoastr, modules/c-ldtoastr-tests: New files. * tests/test-c-dtoastr.c, tests/test-c-dtoastr.sh, tests-c-ldtoastr.c tests-c-ldtoastr.sh: New files.
* calloc-gnu tests: Avoid a test failure with clang.Bruno Haible2020-06-061-11/+17
| | | | | * tests/test-calloc-gnu.c (main): Mark the pointer variable as 'volatile', to defeat compiler optimizations.
* getrandom-tests: do not assume GRND_RANDOM yields short readPaul Eggert2020-05-311-18/+1
| | | | | | | | | | | | * tests/test-getrandom.c (main): Omit assertion that getrandom (b, sizeof b, GRND_RANDOM | GRND_NONBLOCK) < sizeof b when b’s size is 100000. This assertion fails with Linux kernel 5.6.13, as that kernel ignores the GRND_RANDOM flag. The separate blocking pool is going away in the Linux kernel, and they’ve added a flag GRND_INSECURE instead; see: https://lore.kernel.org/linux-api/705c5a091b63cc5da70c99304bb97e0109be0a26.1577088521.git.luto@kernel.org/ The assertion was iffy anyway; what’s to prevent a kernel from lazily filling a large buffer with random bytes?
* read-file-test: pacify --enable-gcc-warningsPaul Eggert2020-05-311-1/+1
| | | | * tests/test-read-file.c (test_read_file): Now static.
* getentropy: Enhance tests.Bruno Haible2020-05-312-0/+15
| | | | | * tests/test-getentropy.c (main): Add one more test. * tests/test-unistd-c++.cc: Check the signature of getentropy.
* getrandom: Doc and test tweaks.Bruno Haible2020-05-311-1/+26
| | | | | | | | | | | | * lib/getrandom.c (getrandom): Mention that it never returns 0, and that it sets errno when failing. * tests/test-getrandom.c (main): Disable the high-quality check on those platforms on which it fails. * doc/glibc-functions/getrandom.texi: Add Minix, AIX, HP-UX, IRIX, Cygwin to the list of platforms that don't have the function. Add a note about the quality of the result. * doc/glibc-headers/sys_random.texi: Don't mention the 'getrandom' declaration; this is fixed by module 'getrandom'.
* wmempcpy: New module.Bruno Haible2020-05-311-0/+5
| | | | | | | | | | | | | | | | | Reported by Paul Eggert in <https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00387.html>. * lib/wchar.in.h (wmempcpy): New declaration. * lib/wmempcpy.c: New file. * m4/wmempcpy.m4: New file. * m4/wchar_h.m4 (gl_WCHAR_H): Test whether wmempcpy is declared. (gl_WCHAR_H_DEFAULTS): Initialize GNULIB_WMEMPCPY, HAVE_WMEMPCPY. * modules/wchar (Makefile.am): Substitute GNULIB_WMEMPCPY, HAVE_WMEMPCPY. * modules/wmempcpy: New file. * tests/test-wchar-c++.cc: Check the signature of wmempcpy. * doc/glibc-functions/wmempcpy.texi: Mention the new module. * modules/mempcpy (Description): Fix typo.
* getrandom: Override incompatible system function on Solaris 11.Bruno Haible2020-05-301-1/+2
| | | | | | | | | | | | | | | | * lib/sys_random.in.h (getrandom): Override if REPLACE_GETRANDOM is 1. * lib/getrandom.c (getrandom): When the system has getrandom, just invoke it. * m4/getrandom.m4 (gl_FUNC_GETRANDOM): Set REPLACE_GETRANDOM if the system's getrandom function's prototype is not the expected one. * m4/sys_random_h.m4 (gl_SYS_RANDOM_H_DEFAULTS): Initialize REPLACE_GETRANDOM. * modules/sys_random (Makefile.am): Substitute REPLACE_GETRANDOM. * modules/getrandom (modules/getrandom): Consider REPLACE_GETRANDOM. * tests/test-getrandom.c (main): Allow error EINVAL as an alternative to EAGAIN. * doc/glibc-functions/getrandom.texi: Mention the new module and the Solaris problem.
* sys_random: Add C++ tests.Bruno Haible2020-05-301-0/+35
| | | | | | * tests/test-sys_random-c++.cc: New file. * modules/sys_random-c++-tests: New file. * modules/sys_random-tests (Depends-on): Depend on it.
* sys_random: Add tests.Bruno Haible2020-05-301-0/+32
| | | | | * tests/test-sys_random.c: New file. * modules/sys_random-tests: New file.
* getrandom: Add tests.Bruno Haible2020-05-301-0/+83
| | | | | * tests/test-getrandom.c: New file. * modules/getrandom-tests: New file.
* fopen-gnu-tests: fix "\x" escape usageDaiki Ueno2020-05-291-1/+1
| | | | * tests/test-fopen-gnu.c (DATA): Use safer escape sequence.
* explicit_bzero-tests: improve -Wmissing-declarations pacificationPaul Eggert2020-05-281-1/+1
| | | | | | * tests/test-explicit_bzero.c: Now noinline. Suggested by Bruno Haible in: https://lists.gnu.org/r/bug-gnulib/2020-05/msg00300.html
* Fix build errors due to read-file changes (regression from 2020-05-27).Bruno Haible2020-05-283-4/+4
| | | | | | | | | * lib/git-merge-changelog.c (read_changelog_file): Update read_file invocation. * tests/test-sameacls.c (main): Likewise. * tests/test-pipe-filter-gi1.c (main): Call read_file instead of read_binary_file. * tests/test-pipe-filter-ii1.c (main): Likewise.
* fopen-gnu: make 'b' flag can be used with 'e' on WindowsDaiki Ueno2020-05-281-0/+17
| | | | | | | * lib/fopen.c (rpl_fopen): Pass O_BINARY to open, if a 'b' flag is specified on Windows. * tests/test-fopen-gnu.c (DATA): New define. (main): Add test for reading binary files with an 'e' flag.
* read-file: add RF_SENSITIVE flagDaiki Ueno2020-05-271-0/+2
| | | | | | | | | | * lib/read-file.h (RF_SENSITIVE): New define. * lib/read-file.c (fread_file, read_file): Take into account of RF_SENSITIVE flag. * modules/read-file (Depends-on): Add explicit_bzero. This adds an alternative behavior of those functions to explicitly clear the internal memory block when it becomes unused. This is useful for reading sensitive information from a file.
* read-file: add flags to modify reading behaviorDaiki Ueno2020-05-271-3/+14
| | | | | | | | | | | * lib/read-file.h (RF_BINARY): New define. (fread_file, read_file): Take FLAGS argument. (read_binary_file): Remove. * lib/read-file.c (internal_read_file): Merge into ... (read_file): ... here. * modules/read-file-tests (Files): Add "tests/macros.h". * tests/test-read-file.c (main): Refactor using ASSERT macro. * NEWS: Mention this change.
* getentropy, getrandom: new modulesPaul Eggert2020-05-251-0/+43
| | | | | | | | | | | | | | | | | * MODULES.html.sh (func_all_modules): * lib/unistd.in.h (getentropy, getrandom): * m4/unistd_h.m4 (gl_UNISTD_H, gl_UNISTD_H_DEFAULTS): * modules/unistd (unistd.h): Add support for getentropy, getrandom. * doc/glibc-functions/getentropy.texi (getentropy): * doc/glibc-functions/getrandom.texi (getrandom): These are now fixed on some platforms. * lib/getentropy.c, lib/getrandom.c, lib/sys_random.in.h: * m4/getentropy.m4, m4/getrandom.m4: * modules/getentropy, modules/getentropy-tests: * modules/getrandom, modules/getrandom-tests: * tests/test-getentropy.c, tests/test-getrandom.c: New files.
* explicit_bzero-tests: pacify -Wmissing-declarationsPaul Eggert2020-05-241-2/+2
| | | | | * tests/test-explicit_bzero.c (do_secret_stuff, test_stack): Now static.
* fopen-gnu: Add tests.Bruno Haible2020-05-241-0/+71
| | | | | * tests/test-fopen-gnu.c: New file. * modules/fopen-gnu-tests: New file.
* open, openat: Really support O_CLOEXEC.Bruno Haible2020-05-241-0/+20
| | | | | | | | | | | * lib/open.c (open): When have_cloexec is still undecided, do pass a O_CLOEXEC flag to orig_open. * lib/openat.c (rpl_openat): When have_cloexec is still undecided, do pass a O_CLOEXEC flag to orig_openat. * tests/test-open.h (test_open): Verify that O_CLOEXEC is honoured. * modules/open-tests (Depends-on): Add fcntl. * modules/openat-tests (Depends-on): Likewise. * modules/fcntl-safer-tests (Depends-on): Likewise.
* fopen: Fix the trailing slash workaround.Bruno Haible2020-05-241-0/+16
| | | | | | * lib/fopen.c (rpl_fopen): Parse the mode string. Recognize "r+" as a write access. Pass the right flags to open(). * tests/test-fopen.h (test_fopen): Add a few more tests on directories.
* ignore-value tests: Use module 'attribute'.Bruno Haible2020-05-081-12/+6
| | | | | | | * m4/gnulib-common.m4 (gl_COMMON_BODY): Fix a typo. * tests/test-ignore-value.c: Include attribute.h. (_GL_ATTRIBUTE_RETURN_CHECK): Remove macro. Use NODISCARD instead. * modules/ignore-value-tests (Depends-on): Add attribute.
* list: Add remove_first and remove_last operations.Bruno Haible2020-05-028-40/+182
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Suggested by Marc Nieper-Wißkirchen <marc.nieper+gnu@gmail.com> in <https://lists.gnu.org/archive/html/bug-gnulib/2020-04/msg00092.html>. * lib/gl_list.h (struct gl_list_implementation): Add fields remove_first, remove_last. (gl_list_remove_first, gl_list_remove_last): New functions. * lib/gl_array_list.c (gl_array_remove_first, gl_array_remove_last): New functions, based on gl_array_remove_at. (gl_array_list_implementation): Implement the new operations. * lib/gl_carray_list.c (gl_carray_remove_first, gl_carray_remove_last): New functions, based on gl_carray_remove_at. (gl_carray_list_implementation): Implement the new operations. * lib/gl_anylinked_list2.h (gl_linked_remove_first, gl_linked_remove_last): New functions, based on gl_linked_remove_at. * lib/gl_linked_list.c (gl_linked_list_implementation): Implement the new operations. * lib/gl_linkedhash_list.c (gl_linkedhash_list_implementation): Likewise. * lib/gl_anytree_list2.h (gl_tree_remove_first, gl_tree_remove_last): New functions, based on gl_tree_remove_at. * lib/gl_avltree_list.c (gl_avltree_list_implementation): Implement the new operations. * lib/gl_avltreehash_list.c (gl_avltreehash_list_implementation): Likewise. * lib/gl_rbtree_list.c (gl_rbtree_list_implementation): Likewise. * lib/gl_rbtreehash_list.c (gl_rbtreehash_list_implementation): Likewise. * lib/gl_sublist.c (gl_sublist_remove_first, gl_sublist_remove_last): New functions, based on gl_sublist_remove_at. (gl_sublist_list_implementation): Implement the new operations. * lib/gl_list.hh (class gl_List): Add methods remove_first, remove_last. * tests/test-array_list.c (main): Test also gl_list_remove_first and gl_list_remove_last. * tests/test-avltree_list.c (main): Likewise. * tests/test-avltreehash_list.c (main): Likewise. * tests/test-carray_list.c (main): Likewise. * tests/test-linked_list.c (main): Likewise. * tests/test-linkedhash_list.c (main): Likewise. * tests/test-rbtree_list.c (main): Likewise. * tests/test-rbtreehash_list.c (main): Likewise.
* posix_spawn_file_actions_addfchdir tests: Enhance test.Bruno Haible2020-04-281-3/+24
| | | | | | | | | * tests/test-posix_spawn5.c: Include findprog.h. (test): New function, extracted from main. (main): Invoke it. Also, invoke it with a program name such as "bin/pwd". * modules/posix_spawn_file_actions_addfchdir-tests (Depends-on): Add findprog.
* posix_spawn_file_actions_addchdir tests: Enhance test.Bruno Haible2020-04-281-3/+24
| | | | | | | | | * tests/test-posix_spawn4.c: Include findprog.h. (test): New function, extracted from main. (main): Invoke it. Also, invoke it with a program name such as "bin/pwd". * modules/posix_spawn_file_actions_addchdir-tests (Depends-on): Add findprog.
* explicit_bzero tests: Fix test failure on OpenBSD 6.5.Bastien Roucariès2020-04-131-1/+3
| | | | | | | | | Some implementation could add canaries after free failling the test. * tests/test-explicit_bzero.c (test_heap): Handle implementations of free() that overwrite the memory with canaries. Signed-off-by: Bastien Roucariès <rouca@debian.org>
* explicit_bzero: Add tests.Bruno Haible2020-04-121-0/+175
| | | | | * tests/test-explicit_bzero.c: New file. * modules/explicit_bzero-tests: New file.
* maint: remove a stray inter-word space in a 6x-repeated commentJim Meyering2020-04-041-1/+1
| | | | | | | | | | | Induce the changes by running this: re='by perl'; g grep -l "$re"|xargs perl -pi -e "s/$re/by perl/" * build-aux/announce-gen: Change "by perl" to "by perl". * build-aux/gitlog-to-changelog: Likewise. * build-aux/prefix-gnulib-mk: Likewise. * build-aux/update-copyright: Likewise. * build-aux/useless-if-before-free: Likewise. * tests/test-update-copyright.sh: Likewise.
* chmodat, chownat: new modulesPaul Eggert2020-02-222-1/+38
| | | | | | | | | | | | | | | | | | | | | | | These are split from fchmodat, fchownat. GNU Emacs needs the POSIX-specified fchmodat, but not the gnulib-specified chmodat and lchmodat. Split the latter two into a new module chmodat. Similarly for fchownat. This the same basic idea for why statat was split from fstatat on 2013-01-23. * lib/chmodat.c, lib/openat.h (CHMODAT_INLINE): Rename from FCHMODAT_INLINE. All uses changed. * lib/chownat.c, lib/openat.h (CHOWNAT_INLINE): Rename from FCHOWNAT_INLINE. All uses changed. * lib/openat.h: (chownat, lchownat): Define if GNULIB_CHOWNAT, not GNULIB_FCHOWNAT. (chmodat, lchmodat): Define if GNULIB_CHMODAT, not GNULIB_FCHMODAT. * modules/chmodat, modules/chownat, tests/test-chownat.c: New files. * modules/fchmodat (Files:): Remove lib/fchmodat.c. (configure.ac): Remove fchmodat module indicator. (Makefile.am): Omit chmodat.c. (Maintainer): Add self. * modules/fchownat: Similarly, but for chown. * tests/test-fchownat.c (BASE): Don't define if already defined. (do_chown, do_lchown) [!TEST_CHOWNAT]: Test fchownat instead.
* wctype-h: Fix compilation errors in C++ (regression from 2020-01-25).Bruno Haible2020-02-141-0/+4
| | | | | | | | | | Reported by Christian Biesinger in <https://lists.gnu.org/archive/html/bug-gnulib/2020-02/msg00064.html>. * lib/wctype.in.h (iswdigit, iswxdigit): Don't declare if the corresponding module is not enabled. * tests/test-wctype-h-c++.cc (iswdigit, iswxdigit): Don't check the prototype if the corresponding module is not enabled.
* ptsname_r-tests: Avoid unused function warning.Bruno Haible2020-02-111-1/+4
| | | | * tests/test-ptsname_r.c: Don't include null-ptr.h if we don't need it.
* lchmod: Add tests.Bruno Haible2020-02-081-0/+67
| | | | | * tests/test-lchmod.c: New file. * modules/lchmod-tests: New file.
* fchmodat: Strengthen tests.Bruno Haible2020-02-081-3/+11
| | | | | | * tests/test-fchmodat.c (BASE): New macro. (main): Use it, to avoid conflicts with other unit tests. Verify that fchmodat changed the file permission bits.
* fchmodat: AT_SYMLINK_NOFOLLOW fix for non-symlinksPaul Eggert2020-02-071-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix lchmod, and fchmodat with AT_SYMLINK_NOFOLLOW, so that they act like chmod on non-symlinks. * NEWS: * doc/glibc-functions/lchmod.texi (lchmod): * doc/posix-functions/fchmodat.texi (fchmodat): Mention this. * lib/fchmodat.c: Define __need_system_sys_stat_h before including config.h, and undef it after including sys/stat.h the first time. Include fcntl.h, stdio.h, unistd.h, intprops.h, and include sys/stat.h a second time after defining orig_fchmodat. (orig_fchmodat) [HAVE_FCHMODAT]: New function. (fchmodat) [HAVE_FCHMODAT]: Work around the AT_SYMLINK_NOFOLLOW bug. * lib/lchmod.c: New file. * lib/sys_stat.in.h (fchmodat, lchmod): Support replacing these functions. * m4/fchmodat.m4 (gl_FUNC_FCHMODAT): If fchmodat exists, test that AT_SYMLINK_NOFOLLOW works on non-symlinks. * m4/lchmod.m4 (gl_FUNC_LCHMOD): Check for lstat. Test that lchmod works on non-symlinks. * m4/sys_stat_h.m4 (gl_SYS_STAT_H_DEFAULTS): Default REPLACE_FCHMODAT and REPLACE_LCHMOD to 0. * modules/fchmodat (Depends-on): Add fstatat, intprops, lchmod, unistd. (Depends-on, configure.ac): Check REPLACE_FCHMODAT too. * modules/lchmod (Files): Add lib/lchmod.c. (Depends-on): Add errno, fcntl-h, fchmodat, intprops, lstat, unistd. (configure.ac): Compile lchmod.c if needed. (lib_SOURCES): Add lchmod.c. * modules/sys_stat (sys/stat.h): Substitute REPLACE_FCHMODAT and REPLACE_LCHMOD. * tests/test-fchmodat.c: Include fcntl.h, sys/stat.h. (main): Test fchmodat with AT_SYMLINK_NOFOLLOW on non-symlinks.
* test-canonicalize: avoid an unused function warningPádraig Brady2020-02-042-2/+8
| | | | | | | | * tests/test-canonicalize.c: Protect the inclusion of null-ptr.h with the same guard as that used to protect usage of the null_ptr function, so that one doesn't get a -Wunused warning about the function being defined but unused. * tests/test-canonicalize-lgpl.c: Likewise.
* omap-c++: Add tests.Bruno Haible2020-02-021-0/+68
| | | | | * tests/test-omap-c++.cc: New file. * modules/omap-c++-tests: New file.
* map-c++: Add tests.Bruno Haible2020-02-021-0/+74
| | | | | * tests/test-map-c++.cc: New file. * modules/map-c++-tests: New file.
* oset-c++: Add tests.Bruno Haible2020-02-021-0/+59
| | | | | * tests/test-oset-c++.cc: New file. * modules/oset-c++-tests: New file.
* set-c++: Add tests.Bruno Haible2020-02-021-0/+56
| | | | | * tests/test-set-c++.cc: New file. * modules/set-c++-tests: New file.
* list-c++: Add tests.Bruno Haible2020-02-021-0/+79
| | | | | * tests/test-list-c++.cc: New file. * modules/list-c++-tests: New file.
* c32isxdigit: Add tests.Bruno Haible2020-01-262-0/+297
| | | | | | * tests/test-c32isxdigit.c: New file, based on tests/test-iswxdigit.c. * tests/test-c32isxdigit.sh: New file. * modules/c32isxdigit-tests: New file.
* c32isupper: Add tests.Bruno Haible2020-01-262-0/+371
| | | | | | * tests/test-c32isupper.c: New file. * tests/test-c32isupper.sh: New file. * modules/c32isupper-tests: New file.
* c32isspace: Add tests.Bruno Haible2020-01-262-0/+233
| | | | | | * tests/test-c32isspace.c: New file. * tests/test-c32isspace.sh: New file. * modules/c32isspace-tests: New file.
* c32ispunct: Add tests.Bruno Haible2020-01-262-0/+356
| | | | | | * tests/test-c32ispunct.c: New file. * tests/test-c32ispunct.sh: New file. * modules/c32ispunct-tests: New file.
* c32isprint: Add tests.Bruno Haible2020-01-262-0/+287
| | | | | | * tests/test-c32isprint.c: New file. * tests/test-c32isprint.sh: New file. * modules/c32isprint-tests: New file.
* c32islower: Add tests.Bruno Haible2020-01-252-0/+383
| | | | | | * tests/test-c32islower.c: New file. * tests/test-c32islower.sh: New file. * modules/c32islower-tests: New file.
* c32isgraph: Add tests.Bruno Haible2020-01-252-0/+282
| | | | | | * tests/test-c32isgraph.c: New file. * tests/test-c32isgraph.sh: New file. * modules/c32isgraph-tests: New file.
* c32isdigit: Add tests.Bruno Haible2020-01-252-0/+271
| | | | | | * tests/test-c32isdigit.c: New file, based on tests/test-iswdigit.c. * tests/test-c32isdigit.sh: New file. * modules/c32isdigit-tests: New file.