summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* fprintf-gnu: Add tests.Bruno Haible2023-03-242-0/+52
| | | | | | | | | * tests/test-fprintf-gnu.sh: New file, based on tests/test-fprintf-posix.sh. * tests/test-fprintf-gnu.c: New file, based on tests/test-fprintf-posix.c. * modules/fprintf-gnu-tests: New file, based on modules/fprintf-posix-tests.
* vfprintf-gnu: Add tests.Bruno Haible2023-03-244-0/+163
| | | | | | | | | | | | | * tests/test-vfprintf-gnu.sh: New file, based on tests/test-vfprintf-posix.sh. * tests/test-vfprintf-gnu.c: New file, based on tests/test-vfprintf-posix.c. * tests/test-fprintf-gnu.h: New file, based on tests/test-vasnprintf-gnu.c. * tests/test-printf-gnu.output: New file, based on tests/test-vasnprintf-gnu.c. * modules/vfprintf-gnu-tests: New file, based on modules/vfprintf-posix-tests.
* vasprintf-gnu: Add tests.Bruno Haible2023-03-241-0/+275
| | | | | | | * tests/test-vasprintf-gnu.c: New file, based on tests/test-vasprintf-posix.c and tests/test-vasnprintf-gnu.c. * modules/vasprintf-gnu-tests: New file, based on modules/vasprintf-posix-tests.
* sprintf-gnu: Add tests.Bruno Haible2023-03-241-0/+35
| | | | | | | * tests/test-sprintf-gnu.c: New file, based on tests/test-sprintf-posix.c. * modules/sprintf-gnu-tests: New file, based on modules/sprintf-posix-tests.
* vsprintf-gnu: Add tests.Bruno Haible2023-03-242-0/+223
| | | | | | | | | * tests/test-vsprintf-gnu.c: New file, based on tests/test-vsprintf-posix.c. * tests/test-sprintf-gnu.h: New file, based on tests/test-vasnprintf-gnu.c. * modules/vsprintf-gnu-tests: New file, based on modules/vsprintf-posix-tests.
* snprintf-gnu: Add tests.Bruno Haible2023-03-241-0/+35
| | | | | | | * tests/test-snprintf-gnu.c: New file, based on tests/test-snprintf-posix.c. * modules/snprintf-gnu-tests: New file, based on modules/snprintf-posix-tests.
* vsnprintf-gnu: Add tests.Bruno Haible2023-03-242-0/+223
| | | | | | | | | * tests/test-vsnprintf-gnu.c: New file, based on tests/test-vsnprintf-posix.c. * tests/test-snprintf-gnu.h: New file, based on tests/test-vasnprintf-gnu.c. * modules/vsnprintf-gnu-tests: New file, based on modules/vsnprintf-posix-tests.
* vasnprintf-gnu: Add tests.Bruno Haible2023-03-241-0/+275
| | | | | | * tests/test-vasnprintf-gnu.c: New file, based on tests/test-vasnprintf-posix.c. * modules/vasnprintf-gnu-tests: New file.
* *printf-posix: Fix implementation of %b directive.Bruno Haible2023-03-225-0/+1662
| | | | | | | | | | | | | | * lib/vasnprintf.c (VASNPRINTF): In the %b directive implementation, fix the precision handling, and ignore the '0' flag when a width and a precision are both present. * tests/test-snprintf-posix.h (test_function): Add test cases for the %x directive and more test cases for the %b directive. * tests/test-sprintf-posix.h (test_function): Likewise. * tests/test-vasnprintf-posix.c (test_function): Likewise. * tests/test-vasnwprintf-posix.c (test_function): Likewise. * tests/test-vasprintf-posix.c (test_function): Likewise. * modules/vasnwprintf-posix-tests (Files): Add m4/musl.m4. (configure.ac): Invoke gl_MUSL_LIBC.
* vasnwprintf: Fix for older platforms without swprintf.Bruno Haible2023-03-211-0/+38
| | | | | | | | | * lib/vasnprintf.c (VASNPRINTF): In the %lc handling, ignore the precision. Convert the snprintf result to a wchar_t[] not by mbsrtowcs, but by a loop that does not stop at NUL characters. * tests/test-vasnwprintf-posix.c (test_function): Add more tests for the %c and %lc directives. * modules/vasnwprintf (Depends-on): Add mbrtowc. Remove mbsrtowcs.
* *printf-posix: Work around bug with %lc of 0 on many platforms.Bruno Haible2023-03-214-0/+146
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/vasnprintf.c (local_wctomb): Define also for NEED_PRINTF_DIRECTIVE_LC. (VASNPRINTF): Implement %lc handling ourselves if NEED_PRINTF_DIRECTIVE_LC. * m4/printf.m4 (gl_PRINTF_DIRECTIVE_LC): New macro. * m4/vasnprintf.m4 (gl_PREREQ_VASNPRINTF_DIRECTIVE_LC): New macro. (gl_PREREQ_VASNPRINTF_WITH_EXTRAS): Invoke it. * m4/dprintf-posix.m4 (gl_FUNC_DPRINTF_POSIX): Require gl_PRINTF_DIRECTIVE_LC and test its result. Invoke gl_PREREQ_VASNPRINTF_DIRECTIVE_LC. * m4/fprintf-posix.m4 (gl_FUNC_FPRINTF_POSIX): Likewise. * m4/obstack-printf-posix.m4 (gl_FUNC_OBSTACK_PRINTF_POSIX): Likewise. * m4/snprintf-posix.m4 (gl_FUNC_SNPRINTF_POSIX): Likewise. * m4/sprintf-posix.m4 (gl_FUNC_SPRINTF_POSIX): Likewise. * m4/vasnprintf-posix.m4 (gl_FUNC_VASNPRINTF_POSIX): Likewise. * m4/vasprintf-posix.m4 (gl_FUNC_VASPRINTF_POSIX): Likewise. * m4/vdprintf-posix.m4 (gl_FUNC_VDPRINTF_POSIX): Likewise. * m4/vfprintf-posix.m4 (gl_FUNC_VFPRINTF_POSIX): Likewise. * m4/vsnprintf-posix.m4 (gl_FUNC_VSNPRINTF_POSIX): Likewise. * m4/vsprintf-posix.m4 (gl_FUNC_VSPRINTF_POSIX): Likewise. * tests/test-snprintf-posix.h (test_function): Add more tests for the %c and %lc directives. * tests/test-sprintf-posix.h (test_function): Likewise. * tests/test-vasnprintf-posix.c (test_function): Likewise. * tests/test-vasprintf-posix.c (test_function): Likewise. * doc/glibc-functions/asprintf.texi: Mention the %lc 0 bug. * doc/glibc-functions/obstack_printf.texi: Likewise. * doc/glibc-functions/obstack_vprintf.texi: Likewise. * doc/glibc-functions/vasprintf.texi: Likewise. * doc/posix-functions/dprintf.texi: Likewise. * doc/posix-functions/fprintf.texi: Likewise. * doc/posix-functions/printf.texi: Likewise. * doc/posix-functions/snprintf.texi: Likewise. * doc/posix-functions/sprintf.texi: Likewise. * doc/posix-functions/vdprintf.texi: Likewise. * doc/posix-functions/vfprintf.texi: Likewise. * doc/posix-functions/vprintf.texi: Likewise. * doc/posix-functions/vsnprintf.texi: Likewise. * doc/posix-functions/vsprintf.texi: Likewise.
* memrchr tests: Avoid GCC warning.Bruno Haible2023-03-201-1/+1
| | | | | * tests/test-memrchr.c: Don't use '#pragma GCC diagnostic' for GCC versions older than 4.7.
* test-pselect, test-select: use different portsPaul Eggert2023-03-193-2/+2
| | | | | | | | | | | | | I have served rare and hard-to-reproduce problems with the GNU grep release candidate with ‘make -j5 check’ on Fedora 37 x86-64. One possibility is that test-pselect and test-select interfere with each other somehow when run simultaneously, as they use the same port. Work around this possibility by using different ports from each other, and from test-poll (which also uses 12345). Of course it’d be better if all these tests used system-assigned ports, but I assume that’d take more work. * tests/test-pselect.c, tests/test-select.c (TEST_PORT): New macro. * tests/test-select.h (TEST_PORT): Remove.
* *printf-posix: ISO C 23: Add %b directive for binary output of integers.Bruno Haible2023-03-175-0/+415
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/printf-parse.c (PRINTF_PARSE): Recognize the 'b' directive. * lib/printf-parse.h: Update comment. * lib/wprintf-parse.h: Likewise. * lib/vasnprintf.c (MAX_ROOM_NEEDED, VASNPRINTF): Add support for the 'b' directive. * m4/printf.m4 (gl_PRINTF_DIRECTIVE_B): New macro. * m4/vasnprintf.m4 (gl_PREREQ_VASNPRINTF_DIRECTIVE_B): New macro. (gl_PREREQ_VASNPRINTF_WITH_EXTRAS): Invoke it. * m4/vasnwprintf-posix.m4 (gl_FUNC_VASNWPRINTF_POSIX): Invoke gl_PREREQ_VASNPRINTF_DIRECTIVE_B. * m4/dprintf-posix.m4 (gl_FUNC_DPRINTF_POSIX): Require gl_PRINTF_DIRECTIVE_B and test its result. Invoke gl_PREREQ_VASNPRINTF_DIRECTIVE_B. * m4/fprintf-posix.m4 (gl_FUNC_FPRINTF_POSIX): Likewise. * m4/obstack-printf-posix.m4 (gl_FUNC_OBSTACK_PRINTF_POSIX): Likewise. * m4/snprintf-posix.m4 (gl_FUNC_SNPRINTF_POSIX): Likewise. * m4/sprintf-posix.m4 (gl_FUNC_SPRINTF_POSIX): Likewise. * m4/vasnprintf-posix.m4 (gl_FUNC_VASNPRINTF_POSIX): Likewise. * m4/vasprintf-posix.m4 (gl_FUNC_VASPRINTF_POSIX): Likewise. * m4/vdprintf-posix.m4 (gl_FUNC_VDPRINTF_POSIX): Likewise. * m4/vfprintf-posix.m4 (gl_FUNC_VFPRINTF_POSIX): Likewise. * m4/vsnprintf-posix.m4 (gl_FUNC_VSNPRINTF_POSIX): Likewise. * m4/vsprintf-posix.m4 (gl_FUNC_VSPRINTF_POSIX): Likewise. * tests/test-snprintf-posix.h (test_function): Add some tests of the %b directive. * tests/test-sprintf-posix.h (test_function): Likewise. * tests/test-vasnprintf-posix.c (test_function): Likewise. * tests/test-vasnwprintf-posix.c (test_function): Likewise. * tests/test-vasprintf-posix.c (test_function): Likewise. * doc/glibc-functions/asprintf.texi: Mention the 'b' directive. * doc/glibc-functions/obstack_printf.texi: Likewise. * doc/glibc-functions/obstack_vprintf.texi: Likewise. * doc/glibc-functions/vasprintf.texi: Likewise. * doc/posix-functions/dprintf.texi: Likewise. * doc/posix-functions/fprintf.texi: Likewise. * doc/posix-functions/fwprintf.texi: Likewise. * doc/posix-functions/printf.texi: Likewise. * doc/posix-functions/snprintf.texi: Likewise. * doc/posix-functions/sprintf.texi: Likewise. * doc/posix-functions/swprintf.texi: Likewise. * doc/posix-functions/vdprintf.texi: Likewise. * doc/posix-functions/vfprintf.texi: Likewise. * doc/posix-functions/vfwprintf.texi: Likewise. * doc/posix-functions/vprintf.texi: Likewise. * doc/posix-functions/vsnprintf.texi: Likewise. * doc/posix-functions/vsprintf.texi: Likewise. * doc/posix-functions/vswprintf.texi: Likewise. * doc/posix-functions/vwprintf.texi: Likewise. * doc/posix-functions/wprintf.texi: Likewise.
* vasnwprintf-posix: Add tests.Bruno Haible2023-03-174-0/+4215
| | | | | | | | | | | | | * tests/test-vasnwprintf-posix.c: New file, based on tests/test-vasnprintf-posix.c. * tests/test-vasnwprintf-posix2.sh: New file, based on tests/test-vasnprintf-posix2.sh. * tests/test-vasnwprintf-posix2.c: New file, based on tests/test-vasnprintf-posix2.c. * tests/test-vasnwprintf-posix3.c: New file, based on tests/test-vasnprintf-posix3.c. * modules/vasnwprintf-posix-tests: New file, based on modules/vasnprintf-posix-tests.
* vasnwprintf: Add tests.Bruno Haible2023-03-171-0/+122
| | | | | | * tests/test-vasnwprintf.c: New file, based on tests/test-vasnprintf.c. * modules/vasnwprintf-tests: New file, based on modules/vasnprintf-tests.
* strtol, strtoll, strtoul, strtoull: Make ISO C 23 compliant.Bruno Haible2023-03-164-0/+248
| | | | | | | | | | | | | | | | | | | | * lib/strtol.c (INTERNAL (strtol)): Treat 'b' and base 2 like 'x' and base 16. Based on glibc commit 64924422a99690d147a166b4de3103f3bf3eaf6c by Joseph Myers. * m4/strtol.m4 (gl_FUNC_STRTOL): Test also whether parsing binary integers works. Update cross-compilation guesses. * m4/strtoll.m4 (gl_FUNC_STRTOLL): Likewise. * m4/strtoul.m4 (gl_FUNC_STRTOUL): Likewise. * m4/strtoull.m4 (gl_FUNC_STRTOULL): Likewise. * tests/test-strtol.c (main): Add tests of parsing binary integers. * tests/test-strtoll.c (main): Likewise. * tests/test-strtoul.c (main): Likewise. * tests/test-strtoull.c (main): Likewise. * doc/posix-functions/strtol.texi: Mention the problem with parsing binary integers. * doc/posix-functions/strtoll.texi: Likewise. * doc/posix-functions/strtoul.texi: Likewise. * doc/posix-functions/strtoull.texi: Likewise.
* stddef: Define 'unreachable', for ISO C 23 compliance.Bruno Haible2023-03-161-0/+24
| | | | | | | | | | | | * lib/verify.h (_GL_HAS_BUILTIN_UNREACHABLE): Don't define if already defined. * lib/stddef.in.h (_GL_HAS_BUILTIN_UNREACHABLE, unreachable): New macros. (abort): Declare if needed for unreachable. * m4/stddef_h.m4 (gl_STDDEF_H): Test for unreachable. * tests/test-stddef.c (test_unreachable_optimization, test_unreachable_noreturn): New functions, based on tests/test-verify.c. * doc/posix-headers/stddef.texi: Mention unreachable.
* gettimeofday, timespec_get tests: Avoid test failure on glibc/Linux.Bruno Haible2023-03-082-2/+4
| | | | | | | * modules/gettimeofday-tests (Depends-on): Add 'time'. * modules/timespec_get-tests (Depends-on): Likewise. * tests/test-gettimeofday.c (test_consistency): Update comment. * tests/test-timespec_get.c (main): Likewise.
* time: Add tests.Bruno Haible2023-03-081-0/+49
| | | | | * tests/test-time.c: New file. * modules/time-tests: New file.
* time: New module.Bruno Haible2023-03-081-0/+4
| | | | | | | | | | | | | | * lib/time.in.h (time): New declaration. * lib/time.c: New file. * m4/time_h.m4 (gl_TIME_H_REQUIRE_DEFAULTS): Initialize GNULIB_TIME. (gl_TIME_H_DEFAULTS): Initialize REPLACE_TIME. * m4/time.m4: New file. * modules/time-h (Makefile.am): Substitute GNULIB_TIME, REPLACE_TIME. * modules/time: New file. * tests/test-time-h-c++.cc: Check the signature of GNULIB_NAMESPACE::time. * doc/posix-functions/time.texi: Mention the glibc problem and the 'time' module.
* time-h: Renamed from time.Bruno Haible2023-03-083-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * modules/time-h: Renamed from modules/time. * tests/test-time-h.c: Renamed from tests/test-time.c. * modules/time-h-tests: Renamed from modules/time-tests. Update. * tests/test-time-h-c++.cc: Renamed from tests/test-time-c++.cc. * tests/test-time-h-c++2.cc: Renamed from tests/test-time-c++2.cc. * modules/time-h-c++-tests: Renamed from modules/time-c++-tests. Update. * modules/cond (Depends-on): Update. * modules/ctime (Depends-on): Likewise. * modules/localtime (Depends-on): Likewise. * modules/mktime (Depends-on): Likewise. * modules/nanosleep (Depends-on): Likewise. * modules/parse-datetime (Depends-on): Likewise. * modules/posixcheck (Depends-on): Likewise. * modules/pthread-h (Depends-on): Likewise. * modules/stat-time (Depends-on): Likewise. * modules/stat-time-tests (Depends-on): Likewise. * modules/strftime-fixes (Depends-on): Likewise. * modules/strptime (Depends-on): Likewise. * modules/sys_stat (Depends-on): Likewise. * modules/tempname (Depends-on): Likewise. * modules/threads-h (Depends-on): Likewise. * modules/time_r (Depends-on): Likewise. * modules/time_rz (Depends-on): Likewise. * modules/timegm (Depends-on): Likewise. * modules/timespec (Depends-on): Likewise. * modules/timespec_get (Depends-on): Likewise. * modules/timespec_getres (Depends-on): Likewise. * modules/tzset (Depends-on): Likewise. * modules/usleep-tests (Depends-on): Likewise. * modules/utime (Depends-on): Likewise. * modules/utimecmp (Depends-on): Likewise. * modules/utimens (Depends-on): Likewise. * modules/windows-cond (Depends-on): Likewise. * modules/windows-timedmutex (Depends-on): Likewise. * modules/windows-timedrecmutex (Depends-on): Likewise. * modules/windows-timedrwlock (Depends-on): Likewise. * modules/xnanosleep (Depends-on): Likewise. * doc/posix-headers/time.texi: Update. * NEWS: Mention the change.
* gettimeofday tests: Enhance test.Bruno Haible2023-03-081-4/+44
| | | | | | | | * tests/test-gettimeofday.c: Include <stdlib.h> and macros.h. (test_clobber): New function, extracted from main. (test_consistency): New function, based on tests/test-timespec_get.c. (main): Invoke both functions. * modules/gettimeofday-tests (Files): Add macros.h.
* timespec_get tests: Add comment.Bruno Haible2023-03-051-0/+2
| | | | * tests/test-timespec_get.c: Add a comment regarding a glibc bug.
* nl_langinfo tests: Avoid test failure on Solaris 11.Bruno Haible2023-03-021-2/+2
| | | | | * tests/test-nl_langinfo2.c (main): Skip French T_FMT_AMPM test on Solaris.
* unilbrk tests: Fix compilation failures (regression 2023-02-11).Bruno Haible2023-02-188-8/+24
| | | | | | | | | | | | * tests/unilbrk/test-u8-possible-linebreaks.c (main): Outside of libunistring, don't test the backward compatibility function. * tests/unilbrk/test-u16-possible-linebreaks.c (main): Likewise. * tests/unilbrk/test-u32-possible-linebreaks.c (main): Likewise. * tests/unilbrk/test-ulc-possible-linebreaks.c (main): Likewise. * tests/unilbrk/test-u8-width-linebreaks.c (main): Likewise. * tests/unilbrk/test-u16-width-linebreaks.c (main): Likewise. * tests/unilbrk/test-u32-width-linebreaks.c (main): Likewise. * tests/unilbrk/test-ulc-width-linebreaks.c (main): Likewise.
* chown, lchown, fchownat tests: Avoid test failure on macOS 12.Bruno Haible2023-02-102-7/+18
| | | | | | * tests/test-chown.h (test_chown): Skip some assertions if getgid() == (gid_t)-1. * tests/test-lchown.h (test_lchown): Likewise.
* nl_langinfo tests: Add another test.Bruno Haible2023-02-082-0/+148
| | | | | | | | | | | * tests/test-nl_langinfo2.c: New file. * tests/test-nl_langinfo2.sh: New file. * modules/nl_langinfo-tests (Files): Add them. Add intl-thread-locale.m4. (Depends-on): Add c-strcasestr, stdbool. (configure.ac): Invoke gt_FUNC_USELOCALE. (Makefile.am): Arrange to compile test-nl_langinfo2 and test it through test-nl_langinfo2.sh.
* nl_langinfo tests: Prepare for adding more tests.Bruno Haible2023-02-082-3/+3
| | | | | | | * tests/test-nl_langinfo1.c: Renamed from tests/test-nl_langinfo.c. * tests/test-nl_langinfo1.sh: Renamed from tests/test-nl_langinfo.sh. Update. * modules/nl_langinfo-tests (Files, Makefile.am): Update.
* setlocale-null: Don't use a lock in Cygwin >= 3.4.6.Bruno Haible2023-02-061-1/+1
| | | | | | | | | Road paved by Corinna Vinschen <vinschen@redhat.com>. * m4/setlocale_null.m4 (gl_FUNC_SETLOCALE_NULL): Assume that setlocale (LC_ALL, NULL) is multithread-safe in Cygwin >= 3.4.6. * lib/setlocale_null.c: Update comments. * tests/test-setlocale_null-mt-all.c: Likewise.
* c-nullptr: Add tests.Bruno Haible2023-02-062-0/+126
| | | | | | | * tests/test-nullptr.c: New file. * modules/c-nullptr-tests: New file. * tests/test-nullptr-c++.cc: New file. * modules/c-nullptr-c++-tests: New file.
* assert-h, verify: Fix compilation error in C++ mode with MSVC 14.Bruno Haible2023-02-052-0/+7
| | | | | | * lib/verify.h (static_assert): Define _ALLOW_KEYWORD_MACROS. * tests/test-assert-h-c++.cc: Strengthen test. * tests/test-assert-h-c++2.cc: Likewise.
* assert-h, verify: Fix conflict with standard C++ header files on macOS.Bruno Haible2023-02-042-0/+8
| | | | | | | | * lib/verify.h (_Static_assert): Don't redefine with clang ≥ 3.8.0 in C++ mode. * tests/test-assert-h-c++.cc: Also check against conflict with the standard C++ header files. * tests/test-assert-h-c++2.cc: Likewise.
* unistdio/*printf: Fix negative width handling for %U, %lU, %llU.Bruno Haible2023-01-284-0/+1218
| | | | | | | | | | * lib/vasnprintf.c (VASNPRINTF): In the code for %U, %lU, %llU, test for the FLAG_LEFT bit in the flags variable. * tests/unistdio/test-u8-printf1.h (test_xfunction): Add tests for width given as argument for the directives %U, %lU, %llU, %s, %a, %f, %e, %g. * tests/unistdio/test-u16-printf1.h (test_xfunction): Likewise. * tests/unistdio/test-u32-printf1.h (test_xfunction): Likewise. * tests/unistdio/test-ulc-printf1.h (test_xfunction): Likewise.
* vasnprintf-posix: Fix possible bug with negative width handling for %lc.Bruno Haible2023-01-282-0/+2
| | | | | | | | | | | | | | * lib/vasnprintf.c (VASNPRINTF): In the code for %lc in vasnprintf, test for the FLAG_LEFT bit in the flags variable. * tests/test-vasnprintf-posix.c (test_function): Add tests for width given as argument for the directives %c, %lc. * tests/test-vasprintf-posix.c (test_function): Likewise. * tests/test-snprintf-posix.h (test_function): Likewise. * tests/test-sprintf-posix.h (test_function): Likewise. * tests/test-snprintf-posix.c: Include <wchar.h>, for wint_t. * tests/test-sprintf-posix.c: Likewise. * tests/test-vsnprintf-posix.c: Likewise. * tests/test-vsprintf-posix.c: Likewise.
* vasnprintf-posix: Fix possible bug with negative width handling for %lc.Bruno Haible2023-01-286-0/+308
| | | | | | | | | | | | * lib/vasnprintf.c (VASNPRINTF): In the code for %lc in vasnprintf, test for the FLAG_LEFT bit in the flags variable. * tests/test-vasnprintf-posix.c (test_function): Add tests for width given as argument for the directives %c, %lc. * tests/test-vasprintf-posix.c (test_function): Likewise. * tests/test-snprintf-posix.h (test_function): Likewise. * tests/test-sprintf-posix.h (test_function): Likewise. * tests/test-snprintf-posix.c: Include <wchar.h>, for wint_t. * tests/test-sprintf-posix.c: Likewise.
* vasnprintf-posix: Fix negative width handling for %ls directive.Bruno Haible2023-01-284-0/+288
| | | | | | | | | | | | Reported by clang via Po Lu <luangruo@yahoo.com>. * lib/vasnprintf.c (VASNPRINTF): In the code for %ls in vasnprintf and for %s in vasnwprintf, test for the FLAG_LEFT bit in the flags variable. * tests/test-vasnprintf-posix.c (test_function): Add tests for width given as argument for the directives %s, %ls. * tests/test-vasprintf-posix.c (test_function): Likewise. * tests/test-snprintf-posix.h (test_function): Likewise. * tests/test-sprintf-posix.h (test_function): Likewise.
* vasnprintf-posix: Add more unit tests.Bruno Haible2023-01-284-0/+608
| | | | | | | | * tests/test-vasnprintf-posix.c (test_function): Add tests for width given as argument for the directives %a, %f, %e, %g. * tests/test-vasprintf-posix.c (test_function): Likewise. * tests/test-snprintf-posix.h (test_function): Likewise. * tests/test-sprintf-posix.h (test_function): Likewise.
* login_tty: Ensure declaration in <utmp.h>.Bruno Haible2023-01-213-1/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * tests/test-utmp-c++.cc: New file. * modules/utmp-c++-tests: New file. * tests/test-utmp.c: New file. * modules/utmp-tests: New file. * lib/login_tty.c: Include <utmp.h>. * m4/login_tty.m4: New file. (gl_FUNC_LOGIN_TTY): Moved here from m4/pty.m4. Set HAVE_LOGIN_TTY. * m4/pty.m4 (gl_FUNC_LOGIN_TTY): Moved to m4/login_tty.m4. * modules/login_tty (Files): Add m4/login_tty.m4. (Depends-on): Add utmp. Remove pty. Update condition. (configure.ac): Update condition. Invoke gl_UTMP_MODULE_INDICATOR instead of gl_PTY_MODULE_INDICATOR. (Include): List <utmp.h>. * doc/glibc-functions/login_tty.texi: Mark the include file diversity as fixed. * tests/test-login_tty.c: Include <utmp.h>. Don't declare login_tty here. * lib/utmp.in.h: New file. * m4/utmp_h.m4: New file. * modules/utmp: New file. * doc/glibc-headers/utmp.texi: New file. * doc/gnulib.texi (Glibc Header File Substitutes): Include it.
* alignasof tests: Rename test file.Bruno Haible2023-01-211-1/+1
| | | | | * tests/test-alignasof.c: Renamed from tests/test-stdalign.c. * modules/alignasof-tests (Files, Makefile.am): Update accordingly.
* alignasof tests: Fix GCC warning (regression 2023-01-15).Bruno Haible2023-01-211-0/+1
| | | | * tests/test-stdalign.c (alignas): Undefine before redefine.
* getprogname: Move declaration from "getprogname.h" to <stdlib.h>.Bruno Haible2023-01-211-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | * lib/stdlib.in.h (getprogname): New declaration. * lib/getprogname.h: Add deprecation warning. (getprogname): Remove declaration. * lib/getprogname.c: Include <stdlib.h> instead of getprogname.h. * m4/stdlib_h.m4 (gl_STDLIB_H): Test whether getprogname is declared. (gl_STDLIB_H_REQUIRE_DEFAULTS): Initialize GNULIB_GETPROGNAME. (gl_STDLIB_H_DEFAULTS): Initialize HAVE_GETPROGNAME. * m4/getprogname.m4 (gl_PREREQ_GETPROGNAME): New macro, extracted from gl_FUNC_GETPROGNAME. Set HAVE_GETPROGNAME. (gl_FUNC_GETPROGNAME): Remove code that was moved to gl_PREREQ_GETPROGNAME. * modules/stdlib (Makefile.am): Substitute GNULIB_GETPROGNAME and HAVE_GETPROGNAME. * modules/getprogname (Depends-on): Add stdlib. (configure.ac): Define a module indicator. Invoke gl_PREREQ_GETPROGNAME. (Makefile.am): Don't compile getprogname.c if not needed. (Include): List <stdlib.h> instead of getprogname.h. * tests/test-getprogname.c: Include <stdlib.h> instead of getprogname.h. * NEWS: Mention the change. * lib/argmatch.c: Don't include getprogname.h. * lib/c-stack.c: Likewise. * lib/error.c: Likewise. * lib/git-merge-changelog.c: Likewise.
* execute tests: Avoid test failure with GNU make 4.4.Bruno Haible2023-01-171-6/+5
| | | | | | | | Reported by Eric Blake in <https://lists.gnu.org/archive/html/bug-gnulib/2023-01/msg00157.html>. * tests/test-execute-main.c (main): Reset the SIGPIPE handler to default on all platforms.
* execute tests: Avoid test failure on Android.Bruno Haible2023-01-171-0/+12
| | | | | * tests/test-execute-main.c (main): Reset the SIGPIPE handler to default.
* hard-locale: Port to Android ≥ 5.0.Bruno Haible2023-01-171-5/+13
| | | | | | | | * lib/hard-locale.c: Include <stdlib.h>. (hard_locale): On Android, consider also MB_CUR_MAX, even if the locale's name is "C". * tests/test-hard-locale.c (test_one, main): Assume that on Android, even the "C" locale is hard.
* stddef tests: Fix compilation error (regression 2023-01-15).Bruno Haible2023-01-161-1/+0
| | | | * tests/test-stddef.c: Don't include <stdalign.h>.
* mbrtowc, mbrtoc32 tests: Avoid test failure on Android ≥ 5.0.Bruno Haible2023-01-162-0/+20
| | | | | | | * tests/test-mbrtowc.c (main): On Android 5.0 or newer, when testing the "C" locale, verify that the encoding is UTF-8. * tests/test-mbrtoc32.c (main): Likewise. * doc/posix-functions/setlocale.texi: Mention the Android problems.
* mbrtowc, mbrtoc32 tests: Refactor.Bruno Haible2023-01-162-32/+76
| | | | | * tests/test-mbrtowc.c (main): Straighten convoluted code. * tests/test-mbrtoc32.c (main): Likewise.
* Use ‘head -n1’ rather than ‘head -1’Paul Eggert2023-01-162-4/+4
| | | | POSIX no longer requires support for ‘head -1’.
* test-framework-sh: work around AIX 7.2 diff bugsPaul Eggert2023-01-141-3/+4
| | | | | | | * tests/init.sh (compare_dev_null_): Run diff in the C locale. AIX 7.2 diff messes up in UTF-8 locales; for example, ‘printf '\360\220\200\200\n' | diff - /dev/null’ incorrectly outputs nothing and exits with status 0 when LC_ALL=en_US.UTF-8.