summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* isfinite, isinf, isnan tests: fix for little-endian PowerPCUlrich Weigand2014-05-305-0/+46
| | | | | | | | | * tests/test-isfinite.c (test_isfinitel): Only manipulate the first double of a PowerPC "double double" pair. * tests/test-isinf.c (test_isinfl): Likewise. * tests/test-isnan.c (test_long_double): Likewise. * tests/test-isnanl.h (main): Likewise. * tests/test-signbit.c (test_signbitl): Likewise.
* getlogin_r-tests: check return value rather than errnoPádraig Brady2014-05-221-4/+4
| | | | | * tests/test-getlogin_r.c (main): As per POSIX we should be verifying the return value from getlogin_r() rather than errno.
* getlogin_r-tests: fix various issues in recent changePádraig Brady2014-05-221-1/+6
| | | | | | | | * tests/test-getlogin_r.c: Include required headers that were missed in recent commit eec20b4e. Also consistently check the errno rather than the return value from getlogin_r as POSIX only specifies that non zero is returned on error. * modules/getlogin_r-tests (configure.ac): Add the check for ttyname().
* getlogin_r-tests: avoid false failure under sudo/ssh etc.Pádraig Brady2014-05-191-5/+24
| | | | | * tests/test-getlogin_r.c (main): Sync up with test-getlogin.c changes from commit 97249cf29 to not depend on environment variables.
* getlogin-tests: avoid false failure under cronPádraig Brady2014-05-181-2/+0
| | | | | | * tests/test-getlogin.c (main): Avoid verifying errnos from ttyname() since that's not what's under test. Centos 6 was seen to return EINVAL for ttyname() when run from cron.
* mbrlen, mbrtowc: fix bug with empty inputPaul Eggert2014-05-161-4/+1
| | | | | | | | | * lib/mbrtowc.c (rpl_mbrtowc) [MBRTOWC_EMPTY_INPUT_BUG]: Fix the bug. * m4/mbrlen.m4 (gl_MBRLEN_EMPTY_INPUT): New macro. It's not used, so this is mainly for documentation. * m4/mbrtowc.m4 (gl_MBRTOWC_EMPTY_INPUT): New macro. (gl_FUNC_MBRTOWC): Use it. * tests/test-mbrtowc.c (main): Test for the bug.
* getlogin-tests: avoid false failure under sudo/ssh etc.Guilherme de Almeida Suckevicz2014-05-141-5/+31
| | | | | | | | * modules/getlogin-tests (configure.ac): Check for ttyname(). * tests/test-getlogin.c (main): Don't depend on environment variables to correlate with getlogin(), since sudo and ssh etc. can tamper with the LOGNAME and USER env vars. Instead lookup the name from the uid associated with the stdin tty.
* parse-datetime: fix crash or infloop in TZ="" parsingPádraig Brady2014-02-271-0/+16
| | | | | | | | | | | | | | | | This was reported in http://bugs.gnu.org/16872 from the coreutils command: date -d 'TZ="""' The infinite loop for this case was present since the initial TZ="" parsing support in commit de95bdc2 29-10-2004. This was changed to a crash or heap corruption depending on the platform with commit 2e3e4195 18-01-2010. * lib/parse-datetime.y (parse_datetime): Break out of the TZ="" parsing loop once the second significant " is found. Also skip over any subsequent whitespace to be consistent with the non TZ= case. * tests/test-parse-datetime.c: Add test cases for TZ="" parsing.
* fdopen-tests: port to Tru64Paul Eggert2014-01-201-22/+15
| | | | | | | | * tests/test-fdopen.c (main): Don't invoke fdopen on a file descriptors that is not open, as POSIX doesn't specify the resulting behavior and the test does not work on Tru64. Problem reported by Steven M. Schweda in: http://lists.gnu.org/archive/html/bug-gnulib/2014-01/msg00079.html
* tests: fix export bug in previous patchPaul Eggert2014-01-071-1/+2
| | | | | | Problem reported by Jim Meyering. * tests/init.sh (re_shell): New var, which is exported instead of re_shell_.
* tests: simplify porting to Solaris 10 /bin/shPaul Eggert2014-01-071-0/+1
| | | | | | | Some test cases in 'grep' need a shell that groks '$('; export re_shell_ for their benefit. Problem reported for 'grep' by Dagobert Michelsen in <http://bugs.gnu.org/16380>. * tests/init.sh (re_shell_): Export if it's used.
* maint: update copyrightEric Blake2014-01-011115-1115/+1115
| | | | | | I ran 'make update-copyright'. Signed-off-by: Eric Blake <eblake@redhat.com>
* passfd: give nicer error for recvfd at eofEric Blake2013-12-241-0/+8
| | | | | | | | | | | | | I noticed that recvfd() fails with errno set to EACCES if the other end of the socket has closed (such as if it calls _exit()); but "Permission denied" as the strerror() message doesn't read very well. This improves things to give the nicer message: "Transport endpoint is not connected". * lib/passfd.c (recvfd): Fake ENOTCONN if other end closes early. * tests/test-passfd.c (main): Enhance test to cover this. Signed-off-by: Eric Blake <eblake@redhat.com>
* open-tests: fix build failure with -Werror=old-style-declarationPádraig Brady2013-12-091-1/+1
| | | | * tests/test-open.h: Reorder the inline to avoid the issue.
* open-tests: port to glibc with _FORTIFY_SOURCE and -O1Paul Eggert2013-12-051-1/+10
| | | | | | | | Problem reported by Daiki Ueno in: http://lists.gnu.org/archive/html/bug-gnulib/2013-06/msg00052.html * tests/test-open.h (__always_inline): New macro, if not already defined. (test_open): Use it.
* test-xvasprintf: disable some -Wformat-security diagnosticsIvailo2013-12-031-0/+7
| | | | | * tests/test-xvasprintf.c: Disable -Wformat-zero-length and -Wformat-nonliteral checks, as these edge cases are part of the test.
* mkfifo-tests, etc.: allow HP-UX 11.11 bugPaul Eggert2013-10-161-1/+4
| | | | | | | | | | | | Problem reported by Daniel Richard G. in <http://lists.gnu.org/archive/html/bug-gnulib/2013-10/msg00068.html>. * doc/posix-functions/mkfifo.texi (mkfifo): * doc/posix-functions/mkfifoat.texi (mkfifoat): * doc/posix-functions/mknod.texi (mknod): * doc/posix-functions/mknodat.texi (mknodat): Document the HP-UX 11.11 bug. * tests/test-mkfifo.h (test_mkfifo): Allow the HP-UX 11.11 bug.
* New module 'count-trailing-zeros'.Paul Eggert2013-10-071-0/+71
| | | | | | | | | * MODULES.html.sh: Mention it. * lib/count-trailing-zeros.c, lib/count-trailing-zeros.h: * m4/count-trailing-zeros.m4, modules/count-trailing-zeros: * modules/count-trailing-zeros-tests: * tests/test-count-trailing-zeros.c: New files.
* tests: improve diagnostic when an assertion failsPaul Eggert2013-10-061-2/+2
| | | | * tests/macros.h (ASSERT): Report the assertion that failed.
* dup2, dup3: work around another cygwin crasherEric Blake2013-09-262-0/+18
| | | | | | | | | | | | | | | | | | | | | | | Cygwin 1.7.25 can crash due to an off-by-one bug on an attempt to duplicate a file into the current RLIMIT_NOFILE soft limit, when that limit is smaller than the hard limit. The intent in the cygwin code was to allow the dup and auto-increase the soft limit, which is itself questionable (and which we work around in the gnulib getdtablesize module); but avoiding the crash is worth doing even if the soft limit semantics are wrong. http://cygwin.com/ml/cygwin/2013-09/msg00397.html http://cygwin.com/ml/cygwin-developers/2013-q3/msg00010.html * m4/dup2.m4 (gl_FUNC_DUP2): Expose the bug. * m4/dup3.m4 (gl_FUNC_DUP3): Likewise. * tests/test-dup2.c (main): Likewise. * lib/dup2.c (rpl_dup2): Use setdtablesize to avoid it. * lib/dup3.c (dup3): Likewise. * doc/posix-functions/dup2.texi (dup2): Document it. * doc/glibc-functions/dup3.texi (dup3): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
* getdtablesize: work around cygwin issueEric Blake2013-09-261-0/+2
| | | | | | | | | | | | | | | | | | | | | Cygwin 1.7.25 has a bug that even though it claims to support RLIMIT_NOFILE inheritance, there is no enforcement of the soft limit, and getdtablesize() automatically grows until it reaches the hard limit which cannot be changed by setrlimit(). Best is to just treat things as an invariant limit, as several other modules assume that getdtablesize() will not change without an intervening setrlimit(). * m4/getdtablesize.m4 (gl_FUNC_GETDTABLESIZE): Detect problem. * modules/getdtablesize (configure.ac): Build replacement. * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Set up a witness. * modules/unistd (Makefile.am): Expose the witness. * lib/unistd.in.h (getdtablesize): Declare replacement. * lib/getdtablesize.c (rpl_getdtablesize): Work around it. * tests/test-getdtablesize.c (main): Test it. * doc/glibc-functions/getdtablesize.texi (getdtablesize): Document it. Signed-off-by: Eric Blake <eblake@redhat.com>
* userspec: support optional parameters to parse_user_spec()Pádraig Brady2013-09-211-0/+11
| | | | | | | | * lib/userspec.c (parse_user_spec): If the GID param is NULL, then avoid group processing and treat the full spec as a user. (parse_with_separator): Allow the USERNAME and GROUPNAME to be optional params (NULL), in which case they're ignored. * tests/test-userspec.c (main): Ensure NULL params are ignored.
* gc: support HMAC-SHA256 and HMAC-SHA512.Simon Josefsson2013-08-264-0/+380
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/gc.h: Add gc_hmac_sha256 and gc_hmac_sha512. * lib/gc-libgcrypt.c (gc_hmac_sha256, gc_hmac_sha512): New functions. (gc_hmac_md5): Use symbolic constant. * lib/gc-gnulib.c: Include hmac.h for HMAC-SHA256/512 too. (gc_hmac_sha256, gc_hmac_sha512): New functions. * lib/hmac.h: Add hmac_sha256 and hmac_sha512 prototypes. * m4/sha256.m4: Protect against empty expansion. * m4/sha512.m4: Likewise. * lib/hmac-sha256.c: New file. * lib/hmac-sha512.c: Likewise. * m4/gc-hmac-sha256.m4: Likewise. * m4/gc-hmac-sha512.m4: Likewise. * m4/gc-sha256.m4: Likewise. * m4/gc-sha512.m4: Likewise. * modules/crypto/gc-hmac-sha256: Likewise. * modules/crypto/gc-hmac-sha256-tests: Likewise. * modules/crypto/gc-hmac-sha512: Likewise. * modules/crypto/gc-hmac-sha512-tests: Likewise. * modules/crypto/hmac-sha256: Likewise. * modules/crypto/hmac-sha256-tests: Likewise. * modules/crypto/hmac-sha512: Likewise. * modules/crypto/hmac-sha512-tests: Likewise. * tests/test-gc-hmac-sha256.c: Likewise. * tests/test-gc-hmac-sha512.c: Likewise * tests/test-hmac-sha256.c: Likewise. * tests/test-hmac-sha512.c: Likewise
* xvasprintf-tests: port to GCC with hardening flagsPaul Eggert2013-08-131-2/+4
| | | | | | * tests/test-xvasprintf.c (test_xasprintf): Pass another arg to xasprintf, to pacify GCC. Reported by Santiago Vila in: http://lists.gnu.org/archive/html/bug-diffutils/2013-08/msg00002.html
* sys_time: port to OpenBSDPaul Eggert2013-08-102-4/+6
| | | | | | | | | * lib/sys_time.in.h: Simply delegate to the system's header in the BSDish cases as well. Problem reported by Mike Miller in <http://lists.gnu.org/archive/html/bug-gnulib/2013-08/msg00016.html>. * tests/test-sys_select.c, tests/test-sys_time.c (verify_tv_sec_type): Allow platforms like 64-bit OpenBSD where timeval's tv_sec is wider than time_t.
* tests: port large-fd POSIX spawn tests to OS XPaul Eggert2013-06-113-4/+50
| | | | | | | | | | | Problem reported by Daiki Ueno in <http://lists.gnu.org/archive/html/bug-gnulib/2013-06/msg00031.html>. * tests/test-posix_spawn_file_actions_addclose.c: * tests/test-posix_spawn_file_actions_adddup2.c: * tests/test-posix_spawn_file_actions_addopen.c: Include <limits.h>, for OPEN_MAX, if available. (big_fd): New static function. (main): Use it.
* tests/nap.h: use an adaptive delay to avoid ctime update issuesBernhard Voelker2013-06-051-61/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The recent change in nap.h (5191133e) decreased the probability of lost races to about a third, however such problems could still be observed in virtual machines and openSUSE's OBS. Instead of calulating the nap() time once and using it (together with a small correction multiplier), avoid the race alltogether by verifying on a reference file whether a timestamp difference has happened. Before, nap() detected the needed time once empirically and then used that delay (together with a small correction multiplier) in further calls. This problem has been reported and discussed several times, including guesses about possible kernel issues: https://lists.gnu.org/archive/html/bug-gnulib/2013-04/msg00071.html http://lists.gnu.org/archive/html/coreutils/2012-03/msg00088.html https://lists.gnu.org/archive/html/bug-gnulib/2011-11/msg00226.html http://bugs.gnu.org/12820 https://lists.gnu.org/archive/html/bug-gnulib/2010-11/msg00113.html https://lists.gnu.org/archive/html/bug-gnulib/2009-11/msg00007.html Now, nap() avoids the race alltogether by verifying on a reference file whether a timestamp difference has happened. * tests/nap.h (nap_fd): Define file descriptor variable for the witness file. (nap_works): Change return value to bool. Change passing the old file's status by value instead of by reference as this function does no longer update that timestamp; rename the function argument from st to old_st. Remove the local variables cdiff and mdiff because that function now returns true/false instead of the precise delay. (guess_delay): Remove function. (clear_tmp_file): Add new function to close and unlink the witness file. (nap): Instead of re-using the delay which has been calculated during the first call, avoid the race by actually verifying that a timestamp difference can be observed on the current file system. Use an adaptive approach for the delay to minimize execution time. Assert that the maximum delay is <= ~2 seconds, more precisely sum(2^n) from 0 to 30 = 2^31 - 1 = 2.1s. Use atexit to call clear_tmp_file when the process terminates.
* test-lchown, test-chown: also skip test if lchown/chown fails with EPERMBernhard Voelker2013-05-222-4/+4
| | | | | | | | | | These tests abort on FAT file systems right after the test for filtering out situation without ownership support; errno is EPERM in such a case. * tests/test-lchown.h (test_lchown): Add EPERM to the condition to skip this test. * tests/test-chown.h (test_chown): Likewise.
* parse-datetime, tests: don't use "string" + intPaul Eggert2013-05-187-7/+7
| | | | | | | | | | | | | | | | | Recent versions of 'clang' complain about C source code that uses expressions of the form '"string literal" + integer', I guess on the theory that it's confusing for readers who are used to C++. On those grounds I suppose it's OK to make this minor style change. * lib/parse-datetime.y (parse_datetime): * tests/test-fchdir.c (main): * tests/test-snprintf-posix.h (test_function): * tests/test-snprintf.c (main): * tests/test-vasnprintf-posix.c (test_function): * tests/test-vasnprintf.c (test_function): * tests/test-vsnprintf.c (main): * tests/unistdio/test-ulc-asnprintf1.h (test_function): Rewrite '"str" + E' to '&"str"[E]'.
* spawn-tests, sys_socket-tests, sys_wait-tests: port to clangPaul Eggert2013-05-153-5/+5
| | | | | | | * tests/test-spawn.c (main): * tests/test-sys_socket.c (main): * tests/test-sys_wait.c (main): Don't have a switch value that isn't covered by a case.
* getaddrinfo-tests: port --enable-gcc-warnings to clangPaul Eggert2013-05-151-2/+3
| | | | | * tests/test-getaddrinfo.c (simple): Avoid casts from looser to stricter-aligned pointers.
* quotearg: do not read beyond end of bufferJim Meyering2013-05-141-0/+35
| | | | | | | | | | | | | * lib/quotearg.c (quotearg_buffer_restyled): Do not read beyond the end of an ARG for which no length was specified. With an N-byte quote string, (e.g., N is 3 in the fr_FR.UTF-8 locale), this function would read N-2 bytes beyond ARG's trailing NUL. This was triggered via coreutils' misc/sort-debug-keys.sh test and detected by running the test against a binary compiled with gcc-4.8.0's -fsanitize=address. * tests/test-quotearg-simple.c (main): Add a test to trigger the bug. * modules/quotearg-simple-tests (Files): Add tests/zerosize-ptr.h. Introduced via the 2000-01-15 commit, c4b7f3f8, "Quote multibyte characters correctly."
* deps: require Automake >= 1.9.6 in generated Makefile fragmentsStefano Lattarini2013-05-108-8/+8
| | | | | | | | | | | | | | | | That is the same minimal version required in the DEPENDENCIES file. Moreover, the old code generated a requirement of Automake >= 1.5, and that is an insanely outdated version. * gnulib-tool: Bump minimal version requirement in AUTOMAKE_OPTIONS. * tests/havelib/rpathlx/Makefile.am: Likewise. * tests/havelib/rpathly/Makefile.am: Likewise. * tests/havelib/rpathlyx/Makefile.am: Likewise. * tests/havelib/rpathlz/Makefile.am: Likewise. * tests/havelib/rpathlzyx/Makefile.am: Likewise. * tests/havelib/rpathx/Makefile.am: Likewise. * tests/havelib/rpathy/Makefile.am: Likewise. * tests/havelib/rpathz/Makefile.am: Likewise.
* utimensat-tests, etc.: try to fix some racesPaul Eggert2013-04-302-81/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem reported by Bernhard Voelker in <http://lists.gnu.org/archive/html/bug-gnulib/2013-04/msg00071.html>. I don't know whether this patch fixes that race condition, but it fixes *some* race conditions, so it should be a win. * modules/chown-tests (Depends-on): * modules/fchownat-tests (Depends-on): * modules/fdutimensat-tests (Depends-on): * modules/futimens-tests (Depends-on): * modules/lchown-tests (Depends-on): * modules/stat-time-tests (Depends-on): * modules/utimens-tests (Depends-on): * modules/utimensat-tests (Depends-on): Depend on nanosleep, not usleep. * modules/chown-tests (test_chown_LDADD): * modules/lchown-tests (test_lchown_LDADD): * modules/stat-time-tests (test_stat_time_LDADD): New macro. * modules/fchownat-tests (test_fchownat_LDADD): * modules/fdutimensat-tests (test_fdutimensat_LDADD): * modules/futimens-tests (test_futimens_LDADD): * modules/utimens-tests (test_utimens_LDADD): * modules/utimensat-tests (test_utimensat_LDADD): Add $(LIB_NANOSLEEP). * modules/stat-time-tests (Files): Add tests/nap.h. * tests/nap.h: Include <limits.h>, for INT_MAX. (lt_mtime): Remove. (diff_timespec): New function. (get_stat): Rename from get_mtime. All callers changed. (nap_works): Determine the needed delay by inspecting the file system's timestamp jumps; this should be more reliable. Look at both mtime and ctime, and take the maximum of the two jumps. (nap_works, guess_delay): Return a nanosecond cound, not a microsecond count. All callers changed. (nap_works, nap): Use nanosleep, not usleep. Check for nanosleep failure. (nap): Multiply the guess by 1.125, to accommodate the case where the file system's clock is a bit slower than nanosleep's clock. * tests/test-stat-time.c (BASE): New macro. Include nap.h. (nap): Remove; nap.h now defines this. This removes a duplicate implementation of 'nap'.
* tests: don't assume getdtablesize () <= 10000000Paul Eggert2013-04-299-22/+35
| | | | | | | | | | | | | | | | | | | | | | * modules/cloexec-tests: * modules/dup2-tests: * modules/dup3-tests: * modules/nonblocking-tests: * modules/posix_spawn_file_actions_addclose-tests: * modules/posix_spawn_file_actions_adddup2-tests: * modules/posix_spawn_file_actions_addopen-tests: * modules/unistd-safer-tests: Depend on the getdtablesize module. * tests/test-cloexec.c: * tests/test-dup-safer.c: * tests/test-dup2.c: * tests/test-dup3.c: * tests/test-fcntl.c: * tests/test-nonblocking.c: * tests/test-posix_spawn_file_actions_addclose.c: * tests/test-posix_spawn_file_actions_adddup2.c: * tests/test-posix_spawn_file_actions_addopen.c: Don't assume getdtablesize () <= 10000000.
* regex-tests, regex: allow glibc re_search behaviorDmitry V. Levin2013-04-111-6/+17
| | | | | | | | | | | | | | | | | | | | The data passed to re_search by the test for glibc bug 15078 is a multi-character collating element followed by a single character. According to POSIX, "It is unspecified whether a non-matching list expression matches a multi-character collating element that is not matched by any of the expressions." One of differences between glibc and gnulib implementations of re_search is that glibc re_search matches multi-character collating elements in that case while gnulib re_search doesn't. Since both re_search implementations conform to standard, change the test to allow glibc re_search behavior. * tests/test-regex.c (main): In test for glibc bug 15078, reformat re_search input data to make the multi-character collating element in it clearly visible, and treat re_search return code 0 as valid. * m4/regex.m4 (gl_REGEX): Likewise.
* regex-tests: skip UTF-8 test on mingwEric Blake2013-03-121-19/+26
| | | | | | | | | | | | | test-regex failed on mingw; and I traced it in gdb to an instance of init_dfa() setting dfa->is_utf8 to 0 in spite of setlocale() claiming success for "en_US.UTF-8". test-wcwidth already has precedent for skipping utf-8 tests where the system (or gnulib setlocale replacement, in this case) lies about utf-8 support. * modules/regex-tests (Depends-on): Add localcharset. * tests/test-regex.c (main): Use it to skip test on mingw. Signed-off-by: Eric Blake <eblake@redhat.com>
* tests: make it easier to bypass alarm time in debuggerEric Blake2013-03-117-8/+17
| | | | | | | | | | | | | | | | While auditing alarm usage, I noticed that test-regex had a nice idiom that made it easier to disable an alarm under glibc. Use it elsewhere, so future copy-and-paste will preserve the idiom. * tests/test-file-has-acl.c (main): Allow gdb to override alarm. * tests/test-memmem.c (main): Likewise. * tests/test-passfd.c (main): Likewise. * tests/test-ptsname.c (main): Likewise. * tests/test-ptsname_r.c (main): Likewise. * tests/test-strcasestr.c (main): Likewise. * tests/test-strstr.c (main): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
* regex: port to mingw's recent addition of undeclared alarmEric Blake2013-03-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | On mingw (at least, when cross-compiling with Fedora 18's mingw32-headers-2.0.999-0.15.trunk.20121110.fc18.noarch build), compilation of test-regex fails: test-regex.c: In function 'main': test-regex.c:42:11: error: 'SIGALRM' undeclared (first use in this function) test-regex.c:42:11: note: each undeclared identifier is reported only once for each function it appears in test-regex.c:43:3: warning: implicit declaration of function 'alarm' It turns out that recent mingw64 added an export of alarm() and SIGALRM, but guarded their declarations behind __USE_MINGW_ALARM (default off, and with alarm() only in the non-standard <io.h>); so the m4 tests were setting HAVE_ALARM to 1 based on link success but then failing to compile. * doc/posix-functions/alarm.texi (alarm): Document that alarm exists but still doesn't work in newer mingw. * m4/frexp.m4 (gl_FUNC_FREXP_WORKS): Check for alarm declaration, not existence. Ensure SIGALRM is not trapped. * m4/mktime.m4 (gl_FUNC_MKTIME): Likewise. * m4/regex.m4 (gl_REGEX): Likewise. * m4/remainderf.m4 (gl_FUNC_REMAINDERF_WORKS): Likewise. * tests/test-regex.c (main): Use correct probe for alarm. Signed-off-by: Eric Blake <eblake@redhat.com>
* vasprintf-posix-tests: allow rounding 1.51 to 1.Gary V. Vaughan2013-03-091-1/+2
| | | | | | * tests/test-vasprintf-posix.c (test_function): Don't insist on round-to-even, since POSIX says rounding is implementation-defined and OS X 10.8.2 rounds 1.51 to 1 here.
* vasprintf-posix-tests: allow rounding 1.5 to 1.Gary V. Vaughan2013-03-091-1/+2
| | | | | | | | * tests/test-vasprintf-posix.c (test_function): Don't insist on round-to-even, since POSIX says rounding is implementation-defined and OS X 10.8.2 rounds 1.5 to 1 here. Signed-off-by: Gary V. Vaughan <gary@gnu.org>
* vasnprintf-posix-tests: allow rounding 1.5 to 1Paul Eggert2013-03-081-1/+2
| | | | | | | * tests/test-vasnprintf-posix.c (test_function): Don't insist on round-to-even, since POSIX says rounding is implementation-defined and OS X 10.8.2 rounds 1.5 to 1 here. Reported by Gary V. Vaughan in <http://lists.gnu.org/archive/html/bug-gnulib/2013-03/msg00019.html>.
* test-getsockopt: avoid compiler warningEric Blake2013-03-041-0/+1
| | | | | | | | | test-getsockopt.c: In function 'main': test-getsockopt.c:48:5: warning: implicit declaration of function 'close' [-Wimplicit-function-declaration] * tests/test-getsockopt.c (includes): Ensure close is declared. Signed-off-by: Eric Blake <eblake@redhat.com>
* getcwd: break fdopendir + save_cwd recursive loop (Bug#13516)Paul Eggert2013-02-031-29/+42
| | | | | | | | | | | | | | | Reported for OS X 10.8.2 by Assaf Gordon in <http://bugs.gnu.org/13516>. * lib/getcwd.c (HAVE_OPENAT_SUPPORT): Do not define if !HAVE_OPENAT && !HAVE_FDOPENDIR. * m4/getcwd-abort-bug.m4: Reformat to match test-getcwd.c so that they can be kept in sync more easily. Avoid PATH_MAX test on the Hurd. Sync from test-getcwd.c for errno tests after mkdir or chdir failure. * tests/test-getcwd.c (HAVE_OPENAT_SUPPORT): New macro, from lib/getcwd.c. (test_abort_bug): Do not test for the deep directory bug unless we have openat support. Avoid PATH_MAX test on the Hurd.
* regex-tests, regex: fix bug: memset undeclaredPaul Eggert2013-02-031-1/+1
| | | | | | | | | | * tests/test-regex.c: Don't include regex.h twice. Include string.h, to declare memset. Christensen's report also mentioned this issue. * m4/regex.m4 (gl_REGEX): Keep test program more in sync with test-regex.c, to avoid future problems like this. Remove AC_INCLUDES_DEFAULT. Include <string.h>. Don't include <regex.h> twice.
* regex-tests: new modulePaul Eggert2013-01-311-0/+185
| | | | * modules/regex-tests, tests/test-regex.c: New files.
* test-getpeername: fix typoEric Blake2013-01-261-1/+1
| | | | | | | | Commit 9feb36b introduced a typo. * tests/test-getpeername.c: Fix typo introduced in fd cleanup. Signed-off-by: Eric Blake <eblake@redhat.com>
* statat: new module, split out from fstatatPaul Eggert2013-01-232-1/+38
| | | | | | | | | | | | | | | | GNU Emacs needs the POSIX-specified fstatat, but not the gnulib-specified statat and lstat. Split the latter two into a new module 'statat'. * lib/openat.h: Depend on GNULIB_STATAT, not GNULIB_FSTATAT. * lib/openat.h, lib/statat.c (STATAT_INLINE): Rename from FSTATAT_INLINE. All uses changed. * modules/fstatat (Files): Remove lib/statat.c. (gl_MODULE_INDICATOR([fstatat])): Remove. (lib_SOURCES): Remove. (Maintainer): Add self. * modules/statat, modules/statat-tests, tests/test-statat.c: New files. * tests/test-fstatat.c (BASE): Don't define if already defined. (do_stat, do_lstat) [!TEST_STATAT]: Test fstatat instead.
* Fix typo in previous change, by including <unistd.h>.Paul Eggert2013-01-2222-0/+22
|
* tests: don't assume fd 99 is closedPaul Eggert2013-01-2262-10/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | * tests/test-accept.c, tests/test-accept4.c, tests/test-bind.c: * tests/test-close.c, tests/test-connect.c, tests/test-dprintf.c: * tests/test-dup.c, tests/test-dup2.c, tests/test-faccessat.c: * tests/test-fchdir.c, tests/test-fchmod.c, tests/test-fchmodat.c: * tests/test-fchown.c, tests/test-fchownat.c, tests/test-fclose.c: * tests/test-fdatasync.c, tests/test-fdopen.c, tests/test-fdopendir.c: * tests/test-fflush.c, tests/test-fgetc.c, tests/test-fputc.c: * tests/test-fread.c, tests/test-freopen.c, tests/test-fseeko4.c: * tests/test-fstat.c, tests/test-fstatat.c, tests/test-fsync.c: * tests/test-ftello4.c, tests/test-ftruncate.c, tests/test-futimens.h: * tests/test-fwrite.c, tests/test-getpeername.c: * tests/test-getsockname.c, tests/test-getsockopt.c: * tests/test-grantpt.c, tests/test-ioctl.c, tests/test-isatty.c: * tests/test-linkat.c, tests/test-listen.c, tests/test-lseek.c: * tests/test-mkdirat.c, tests/test-mkfifoat.c, tests/test-openat.c: * tests/test-pread.c, tests/test-pwrite.c, tests/test-read.c: * tests/test-readlinkat.c, tests/test-recv.c, tests/test-recvfrom.c: * tests/test-renameat.c, tests/test-select.h, tests/test-send.c: * tests/test-sendto.c, tests/test-setsockopt.c, tests/test-shutdown.c: * tests/test-symlinkat.c, tests/test-ttyname_r.c: * tests/test-unlinkat.c, tests/test-unlockpt.c: * tests/test-utimensat.c, tests/test-vdprintf.c, tests/test-write.c: Close file descriptor 99, instead of assuming it's already closed.