summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Refactor common macros used in tests.Bruno Haible2009-12-24377-5093/+568
|
* Fix indentation.Bruno Haible2009-12-241-1/+1
|
* test-nanosleep: fix typoEric Blake2009-12-241-1/+1
| | | | | | | | * tests/test-nanosleep.c (SIGNATURE_CHECK): Fix typo in previous patch. Reported by Bruno Haible. Signed-off-by: Eric Blake <ebb9@byu.net>
* tests: add signature checksEric Blake2009-12-24131-39/+600
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These tests will help catch problems similar to the one recently fixed for cygwin declaring getsubopt and symlinkat in the wrong header. * tests/signature.h (SIGNATURE_CHECK): New file. * modules/atexit-tests (Files): Use it. * modules/btowc-tests (Files): Likewise. * modules/canonicalize-lgpl-tests (Files): Likewise. * modules/ceilf-tests (Files): Likewise. * modules/ceill-tests (Files): Likewise. * modules/chown-tests (Files): Likewise. * modules/dprintf-posix-tests (Files): Likewise. * modules/dup2-tests (Files): Likewise. * modules/dup3-tests (Files): Likewise. * modules/duplocale-tests (Files): Likewise. * modules/fchdir-tests (Files): Likewise. * modules/fcntl-tests (Files): Likewise. * modules/fdopendir-tests (Files): Likewise. * modules/fflush-tests (Files): Likewise. * modules/flock-tests (Files): Likewise. * modules/floorf-tests (Files): Likewise. * modules/floorl-tests (Files): Likewise. * modules/fnmatch-tests (Files): Likewise. * modules/fopen-tests (Files): Likewise. * modules/fprintf-posix-tests (Files): Likewise. * modules/freopen-tests (Files): Likewise. * modules/frexp-nolibm-tests (Files): Likewise. * modules/frexp-tests (Files): Likewise. * modules/frexpl-nolibm-tests (Files): Likewise. * modules/frexpl-tests (Files): Likewise. * modules/fseek-tests (Files): Likewise. * modules/fseeko-tests (Files): Likewise. * modules/fsync-tests (Files): Likewise. * modules/ftell-tests (Files): Likewise. * modules/ftello-tests (Files): Likewise. * modules/futimens-tests (Files): Likewise. * modules/getaddrinfo-tests (Files): Likewise. * modules/getcwd-tests (Files): Likewise. * modules/getdelim-tests (Files): Likewise. * modules/getdtablesize-tests (Files): Likewise. * modules/getgroups-tests (Files): Likewise. * modules/gethostname-tests (Files): Likewise. * modules/getline-tests (Files): Likewise. * modules/getopt-posix-tests (Files): Likewise. * modules/gettimeofday-tests (Files): Likewise. * modules/glob-tests (Files): Likewise. * modules/iconv-tests (Files): Likewise. * modules/inet_ntop-tests (Files): Likewise. * modules/inet_pton-tests (Files): Likewise. * modules/isblank-tests (Files): Likewise. * modules/lchown-tests (Files): Likewise. * modules/ldexpl-tests (Files): Likewise. * modules/link-tests (Files): Likewise. * modules/linkat-tests (Files): Likewise. * modules/lseek-tests (Files): Likewise. * modules/lstat-tests (Files): Likewise. * modules/mbrtowc-tests (Files): Likewise. * modules/mbsinit-tests (Files): Likewise. * modules/mbsnrtowcs-tests (Files): Likewise. * modules/mbsrtowcs-tests (Files): Likewise. * modules/memchr-tests (Files): Likewise. * modules/memcmp-tests (Files): Likewise. * modules/memmem-tests (Files): Likewise. * modules/memrchr-tests (Files): Likewise. * modules/mkdir-tests (Files): Likewise. * modules/mkfifo-tests (Files): Likewise. * modules/mkfifoat-tests (Files): Likewise. * modules/mknod-tests (Files): Likewise. * modules/nanosleep-tests (Files): Likewise. * modules/nl_langinfo-tests (Files): Likewise. * modules/obstack-printf-tests (Files): Likewise. * modules/open-tests (Files): Likewise. * modules/openat-tests (Files): Likewise. * modules/perror-tests (Files): Likewise. * modules/pipe2-tests (Files): Likewise. * modules/poll-tests (Files): Likewise. * modules/popen-tests (Files): Likewise. * modules/posix_spawn-tests (Files): Likewise. * modules/posix_spawnp-tests (Files): Likewise. * modules/pread-tests (Files): Likewise. * modules/printf-posix-tests (Files): Likewise. * modules/pty-tests (Files): Likewise. * modules/random_r-tests (Files): Likewise. * modules/rawmemchr-tests (Files): Likewise. * modules/readlink-tests (Files): Likewise. * modules/remove-tests (Files): Likewise. * modules/rename-tests (Files): Likewise. * modules/renameat-tests (Files): Likewise. * modules/rmdir-tests (Files): Likewise. * modules/round-tests (Files): Likewise. * modules/roundf-tests (Files): Likewise. * modules/roundl-tests (Files): Likewise. * modules/select-tests (Files): Likewise. * modules/setenv-tests (Files): Likewise. * modules/sigaction-tests (Files): Likewise. * modules/sleep-tests (Files): Likewise. * modules/snprintf-posix-tests (Files): Likewise. * modules/snprintf-tests (Files): Likewise. * modules/sprintf-posix-tests (Files): Likewise. * modules/stat-tests (Files): Likewise. * modules/strcasestr-tests (Files): Likewise. * modules/strchrnul-tests (Files): Likewise. * modules/strerror-tests (Files): Likewise. * modules/strsignal-tests (Files): Likewise. * modules/strstr-tests (Files): Likewise. * modules/strtod-tests (Files): Likewise. * modules/strverscmp-tests (Files): Likewise. * modules/symlink-tests (Files): Likewise. * modules/symlinkat-tests (Files): Likewise. * modules/times-tests (Files): Likewise. * modules/trunc-tests (Files): Likewise. * modules/truncf-tests (Files): Likewise. * modules/truncl-tests (Files): Likewise. * modules/tsearch-tests (Files): Likewise. * modules/uname-tests (Files): Likewise. * modules/unlink-tests (Files): Likewise. * modules/unsetenv-tests (Files): Likewise. * modules/usleep-tests (Files): Likewise. * modules/utimensat-tests (Files): Likewise. * modules/vasprintf-tests (Files): Likewise. * modules/vdprintf-posix-tests (Files): Likewise. * modules/vfprintf-posix-tests (Files): Likewise. * modules/vprintf-posix-tests (Files): Likewise. * modules/vsnprintf-posix-tests (Files): Likewise. * modules/vsnprintf-tests (Files): Likewise. * modules/vsprintf-posix-tests (Files): Likewise. * modules/wcrtomb-tests (Files): Likewise. * modules/wcsnrtombs-tests (Files): Likewise. * modules/wcsrtombs-tests (Files): Likewise. * modules/wcwidth-tests (Files): Likewise. * tests/test-isfinite.c (isfinite): Ensure macro declaration. * tests/test-isinf.c (isinf): Likewise. * tests/test-isnan.c (isnan): Likewise. * tests/test-signbit.c (signbit): Likewise. * tests/test-select.c (FD_CLR, FD_ISSET, FD_SET, FD_ZERO): Ensure declaration, either as macro or with correct signature. (select): Ensure function under test is declared with correct signature in correct header. * tests/test-atexit.c (atexit): Likewise. * tests/test-btowc.c (btowc): Likewise. * tests/test-canonicalize-lgpl.c (realpath) (canonicalize_file_name): Likewise. * tests/test-ceilf1.c (ceilf): Likewise. * tests/test-ceill.c (ceill): Likewise. * tests/test-chown.c (chown): Likewise. * tests/test-dprintf-posix.c (dprintf): Likewise. * tests/test-dup2.c (dup2): Likewise. * tests/test-dup3.c (dup3): Likewise. * tests/test-duplocale.c (duplocale): Likewise. * tests/test-fchdir.c (fchdir): Likewise. * tests/test-fchownat.c (fchownat): Likewise. * tests/test-fcntl.c (fcntl): Likewise. * tests/test-fdopendir.c (fdopendir): Likewise. * tests/test-fflush.c (fflush): Likewise. * tests/test-flock.c (flock): Likewise. * tests/test-floorf1.c (floorf): Likewise. * tests/test-floorl.c (floorl): Likewise. * tests/test-fnmatch.c (fnmatch): Likewise. * tests/test-fopen.c (fopen): Likewise. * tests/test-fprintf-posix.c (fprintf): Likewise. * tests/test-freopen.c (freopen): Likewise. * tests/test-frexp.c (frexp): Likewise. * tests/test-frexpl.c (frexpl): Likewise. * tests/test-fseek.c (fseek): Likewise. * tests/test-fseeko.c (fseeko): Likewise. * tests/test-fstatat.c (fstatat): Likewise. * tests/test-fsync.c (fsync): Likewise. * tests/test-ftell.c (ftell): Likewise. * tests/test-ftello.c (ftello): Likewise. * tests/test-futimens.c (futimens): Likewise. * tests/test-getaddrinfo.c (getaddrinfo, freeaddrinfo) (gai_strerror): Likewise. * tests/test-getcwd.c (getcwd): Likewise. * tests/test-getdelim.c (getdelim): Likewise. * tests/test-getdtablesize.c (getdtablesize): Likewise. * tests/test-getgroups.c (getgroups): Likewise. * tests/test-gethostname.c (gethostname): Likewise. * tests/test-getline.c (getline): Likewise. * tests/test-getopt.c (getopt, getopt_long, getopt_long_only): Likewise. * tests/test-gettimeofday.c (gettimeofday): Likewise. * tests/test-glob.c (glob, globfree): Likewise. * tests/test-iconv.c (iconv, iconv_open, iconv_close): Likewise. * tests/test-inet_ntop.c (inet_ntop): Likewise. * tests/test-inet_pton.c (inet_pton): Likewise. * tests/test-isblank.c (isblank): Likewise. * tests/test-lchown.c (lchown): Likewise. * tests/test-ldexpl.c (ldexpl): Likewise. * tests/test-link.c (link): Likewise. * tests/test-linkat.c (linkat): Likewise. * tests/test-lseek.c (lseek): Likewise. * tests/test-lstat.c (lstat): Likewise. * tests/test-mbrtowc.c (mbrtowc): Likewise. * tests/test-mbsinit.c (mbsinit): Likewise. * tests/test-mbsnrtowcs.c (mbsnrtowcs): Likewise. * tests/test-mbsrtowcs.c (mbsrtowcs): Likewise. * tests/test-memchr.c (memchr): Likewise. * tests/test-memcmp.c (memcmp): Likewise. * tests/test-memmem.c (memmem): Likewise. * tests/test-memrchr.c (memrchr): Likewise. * tests/test-mkdir.c (mkdir): Likewise. * tests/test-mkdirat.c (mkdirat): Likewise. * tests/test-mkfifo.c (mkfifo): Likewise. * tests/test-mkfifoat.c (mkfifoat, mknodat): Likewise. * tests/test-mknod.c (mknod): Likewise. * tests/test-nanosleep.c (nanosleep): Likewise. * tests/test-nl_langinfo.c (nl_langinfo): Likewise. * tests/test-obstack-printf.c (obstack_printf, obstack_vprintf): Likewise. * tests/test-open.c (open): Likewise. * tests/test-openat.c (openat): Likewise. * tests/test-perror.c (perror): Likewise. * tests/test-pipe2.c (pipe2): Likewise. * tests/test-poll.c (poll): Likewise. * tests/test-popen.c (popen, pclose): Likewise. * tests/test-posix_spawn1.c (posix_spawnp, posix_spawnattr_init) (posix_spawnattr_destroy, posix_spawnattr_setsigmask) (posix_spawnattr_setflags, posix_spawn_file_actions_init) (posix_spawn_file_actions_destroy) (posix_spawn_file_actions_addclose) (posix_spawn_file_actions_addopen) (posix_spawn_file_actions_adddup2): Likewise. * tests/test-posix_spawn3.c (posix_spawn): Likewise. * tests/test-pread.c (pread): Likewise. * tests/test-printf-posix.c (printf): Likewise. * tests/test-pty.c (openpty, forkpty): Likewise. * tests/test-random_r.c (srandom_r, initstate_r, setstate_r) (random_r): Likewise. * tests/test-rawmemchr.c (rawmemchr): Likewise. * tests/test-readlink.c (readlink): Likewise. * tests/test-remove.c (remove): Likewise. * tests/test-rename.c (rename): Likewise. * tests/test-renameat.c (renameat): Likewise. * tests/test-rmdir.c (rmdir): Likewise. * tests/test-round1.c (round): Likewise. * tests/test-roundf1.c (roundf): Likewise. * tests/test-roundl.c (roundl): Likewise. * tests/test-setenv.c (setenv): Likewise. * tests/test-sigaction.c (sigaction): Likewise. * tests/test-sleep.c (sleep): Likewise. * tests/test-snprintf.c (snprintf): Likewise. * tests/test-sprintf-posix.c (sprintf): Likewise. * tests/test-stat.c (stat): Likewise. * tests/test-stpncpy.c (stpncpy): Likewise. * tests/test-strcasestr.c (strcasestr): Likewise. * tests/test-strchrnul.c (strchrnul): Likewise. * tests/test-strerror.c (strerror): Likewise. * tests/test-strsignal.c (strsignal): Likewise. * tests/test-strstr.c (strstr): Likewise. * tests/test-strtod.c (strtod): Likewise. * tests/test-strverscmp.c (strverscmp): Likewise. * tests/test-symlink.c (symlink): Likewise. * tests/test-symlinkat.c (symlinkat, readlinkat): Likewise. * tests/test-times.c (times): Likewise. * tests/test-trunc1.c (trunc): Likewise. * tests/test-truncf1.c (truncf): Likewise. * tests/test-truncl.c (truncl): Likewise. * tests/test-tsearch.c (tdelete, tfind, tsearch, twalk): Likewise. * tests/test-uname.c (uname): Likewise. * tests/test-unlink.c (unlink): Likewise. * tests/test-unlinkat.c (unlinkat): Likewise. * tests/test-unsetenv.c (unsetenv): Likewise. * tests/test-usleep.c (usleep): Likewise. * tests/test-utimensat.c (utimensat): Likewise. * tests/test-vasprintf.c (asprintf, vasprintf): Likewise. * tests/test-vdprintf-posix.c (vdprintf): Likewise. * tests/test-vfprintf-posix.c (vfprintf): Likewise. * tests/test-vprintf-posix.c (vprintf): Likewise. * tests/test-vsnprintf.c (vsnprintf): Likewise. * tests/test-vsprintf-posix.c (vsprintf): Likewise. * tests/test-wcrtomb.c (wcrtomb): Likewise. * tests/test-wcsnrtombs.c (wcsnrtombs): Likewise. * tests/test-wcsrtombs.c (wcsrtombs): Likewise. * tests/test-wcwidth.c (wcwidth): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
* Include header file being tested immediately after config.h.Bruno Haible2009-12-2412-21/+28
|
* localename: more testsBruno Haible2009-12-231-0/+191
|
* gnulib-common: prefer _GL_UNUSED over _UNUSED_PARAMETER_Eric Blake2009-12-2314-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are more contexts where __attribute__((__unused__)) is useful than just parameter lists. Also, naming the macro _GL_UNUSED fits with the recent addition of _GL_ARG_NONNULL. Preserve the name _UNUSED_PARAMETER_ for backwards-compatible use in external projects. * m4/gnulib-common.m4 (gl_COMMON): Create a more-appropriately named alias for __attribute__((__unused__)). * lib/chown.c: Update client. * lib/fchmodat.c: Likewise. * lib/fts.c: Likewise. * lib/getdate.y: Likewise. * lib/getgroups.c: Likewise. * lib/getopt.c: Likewise. * lib/getugroups.c: Likewise. * lib/mkdir.c: Likewise. * lib/mkfifo.c: Likewise. * lib/mkfifoat.c: Likewise. * lib/mknod.c: Likewise. * lib/mknodat.c: Likewise. * lib/readlink.c: Likewise. * lib/se-context.in.h: Likewise. * lib/se-selinux.in.h: Likewise. * lib/sockets.c: Likewise. * lib/symlink.c: Likewise. * lib/symlinkat.c: Likewise. * lib/unicodeio.c: Likewise. * lib/unistr.h: Likewise. * tests/test-areadlink.c: Likewise. * tests/test-areadlinkat.c: Likewise. * tests/test-filenamecat.c: Likewise. * tests/test-fseeko.c: Likewise. * tests/test-ftello.c: Likewise. * tests/test-getdate.c: Likewise. * tests/test-getgroups.c: Likewise. * tests/test-gethostname.c: Likewise. * tests/test-quotearg.c: Likewise. * tests/test-version-etc.c: Likewise. * tests/test-xalloc-die.c: Likewise. * tests/test-xfprintf-posix.c: Likewise. * tests/test-xprintf-posix.c: Likewise. * tests/test-xvasprintf.c: Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
* tests: avoid compiler warningsEric Blake2009-12-238-8/+8
| | | | | | | | | | | | | | | | | Silence more warnings during coreutils build. * tests/test-fcntl.c (main): Delete unused parameters. * tests/test-freopen-safer.c (main): Likewise. * tests/test-xalloc-die.c (main): Mark unused parameters. * tests/test-fseeko.c (main): Likewise. * tests/test-ftello.c (main): Likewise. * tests/test-nanosleep.c (main): Avoid declaration warning. * tests/test-sleep.c (main): Likewise. * tests/test-unsetenv.c (main): Silence warning about string literal. * m4/setenv.m4 (gl_FUNC_UNSETENV): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
* More localename tests.Bruno Haible2009-12-231-8/+272
|
* test-getopt: test stderr behaviorEric Blake2009-12-222-25/+391
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Portions of this commit are commented out because they tickle glibc bugs. For a real-life example of the bug: $ env -ua -: env: invalid option -- : Try `env --help' for more information. $ env -: env: invalid option -- : Try `env --help' for more information. $ env -+ env: invalid option -- + Try `env --help' for more information. $ env -ua -+ Try `env --help' for more information. Notice that when -+ is not given as the first argument, the error message is mistakenly suppressed. * modules/getopt-posix-tests (Depends-on): Add dup2. * tests/test-getopt.c (ASSERT): Avoid stderr. (main): Move stderr to a temporary file. * tests/test-getopt.h (getopt_loop): No longer manipulate opterr. Instead, add parameter to inform caller if output occurred. (test_getopt): Adjust all tests to expect silence, and add new tests of leading ":". * doc/glibc-functions/getopt_long.texi (getopt_long): Document glibc shortcomings with leading "-:" or "+:" in optstring. * doc/glibc-functions/getopt_long_only.texi (getopt_long_only): Likewise. * doc/posix-functions/getopt.texi (getopt): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
* test-getopt: enhance testEric Blake2009-12-223-36/+1107
| | | | | | | | | | | | | | | | | | | | Add coverage of optind==0 for getopt_long, since coreutils depends on it. Also test an optstring containing "W;", since that tends to expose corner-case bugs (even in glibc, so the test is weaker than it could be). * m4/getopt.m4 (gl_GETOPT_CHECK_HEADERS): Require that getopt_long supports optind=0. * tests/test-getopt.c (OPTIND_MIN): Move... * tests/test-getopt.h (OPTIND_MIN): ...here. * tests/test-getopt_long.h (test_getopt_long): Add more coverage. Require that optind=0 works, since modern BSD supports it in addition to optreset, and since coreutils expects it. (test_getopt_long_only): New test. * doc/glibc-functions/getopt_long.texi (getopt_long): Document glibc shortcomings with 'W;', and enforcement of optind=0. * doc/glibc-functions/getopt_long_only.texi (getopt_long_only): Likewise.
* test-utimens: avoid spurious failureEric Blake2009-12-214-112/+73
| | | | | | | | | | | | | | | | | | | | Fixes a spurious failure on ext3, with one-second resolution, now that ctime effects are being tested for inequality. * tests/test-chown.h (nap): Factor... * tests/nap.h: ...into new file. * tests/test-lchown.h (nap): Avoid duplication. * tests/test-utimens-common.h (nap): Use shared implementation, necessary on file systems with 1-second resolution. * modules/chown-tests (Files): Include new file. * modules/fdutimensat-tests (Files): Likewise. * modules/futimens-tests (Files): Likewise. * modules/lchown-tests (Files): Likewise. * modules/openat-tests (Files): Likewise. * modules/utimens-tests (Files): Likewise. * modules/utimensat-tests (Files): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
* utimens: check for ctime updateEric Blake2009-12-194-25/+122
| | | | | | | | | | | | | | futimens/utimensat on Linux fails to bump ctime if mtime is UTIME_OMIT and atime is specified. * tests/test-utimens-common.h (check_ctime): Define. * tests/test-utimens.h (test_utimens): Expose the Linux bug. * tests/test-futimens.h (test_futimens): Likewise. * tests/test-lutimens.h (test_lutimens): Likewise. * doc/posix-functions/futimens.texi (futimens): Document the bug. * doc/posix-functions/utimensat.texi (utimensat): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
* dprintf-posix: Check against memory leak fixed on 2009-12-15.Bruno Haible2009-12-192-0/+140
|
* fprintf-posix: Check against memory leak fixed on 2009-12-15.Bruno Haible2009-12-192-0/+139
|
* fcntl: use to simplify other modulesEric Blake2009-12-161-0/+9
| | | | | | | | | | | | | | | | | | | | | Let fcntl do the work, instead of copying code into other modules. * modules/cloexec (Depends-on): Add fcntl. * modules/fchdir (Depends-on): Likewise. * modules/fd-safer-flag (Depends-on): Likewise. * modules/unistd-safer (Depends-on): Likewise. * modules/dup3 (configure.ac): Set module indicator. * m4/fchdir.m4 (gl_FUNC_FCHDIR): Replace fcntl if fchdir is missing. * lib/fchdir.c (_gl_register_dup): Fix comment. * lib/cloexec.c (dup_cloexec): Simplify, by relying on fcntl. * lib/dup-safer.c (dup_safer): Likewise. * lib/dup-safer-flag.c (dup_safer_flag): Likewise. * lib/dup3.c (dup3): Likewise. * tests/test-fchdir.c (main): Enhance test. Fixes a dup_cloexec bug reported by Ondřej Vašík. Signed-off-by: Eric Blake <ebb9@byu.net>
* fcntl: port portions of fcntl to mingwEric Blake2009-12-161-13/+24
| | | | | | | | | | | | | | | | | | | | | | | Borrow ideas from dup_cloexec and dup3 to implement F_DUPFD and F_DUPFD_CLOEXEC. Support querying the inheritance status via F_GETFD, but for now, no support for changing with F_SETFD. The remaining portions of fcntl fail with EINVAL. * m4/fcntl.m4 (gl_FUNC_FCNTL): Also build fcntl.c on mingw. * lib/fcntl.c (fcntl) <F_DUPFD, F_DUPFD_CLOEXEC, F_GETFD>: Provide replacement for mingw. * modules/fcntl (Description): Update. (Depends-on): Add dup2. * m4/fcntl_h.m4 (gl_FCNTL_H_DEFAULTS): Add witness. * modules/fcntl-h (Makefile.am): Substitute it. * lib/fcntl.in.h (fcntl): Update declaration. (F_DUPFD, F_GETFD): New macros, when needed. * doc/posix-headers/fcntl.texi (fcntl.h): Update documentation. * doc/posix-functions/fcntl.texi (fcntl): Likewise. * tests/test-fcntl.c (check_flags, main): Enhance test for items we now guarantee. Signed-off-by: Eric Blake <ebb9@byu.net>
* fcntl: support F_DUPFD_CLOEXEC on systems with fcntlEric Blake2009-12-161-0/+345
| | | | | | | | | | | | | | | | | | | | | | | | Implement F_DUPFD_CLOEXEC. The unit test still fails on systems with other fcntl bugs (such as cygwin 1.5 mishandling F_DUPFD, or mingw lacking fcntl altogether). Passes on Linux, both with and without kernel support, and on cygwin 1.7. * modules/fcntl (Files): List new files. (configure.ac): Run a test. * m4/fcntl.m4 (gl_FUNC_FCNTL): New file. * lib/fcntl.c (rpl_fcntl): Likewise. * m4/fcntl_h.m4 (gl_FCNTL_H_DEFAULTS): Add witness defaults. (gl_FCNTL_H): Always replace fcntl.h. * modules/fcntl-h (Makefile.am): Substitute witnesses. * lib/fcntl.in.h (fcntl): Declare replacement. (F_DUPFD_CLOEXEC, GNULIB_defined_F_DUPFD_CLOEXEC): New macro when needed, plus a witness. * doc/posix-functions/fcntl.texi (fcntl): Document this. * doc/posix-headers/fcntl.texi (fcntl.h): Likewise. * tests/test-fcntl.c: New file. * modules/fcntl-tests: Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
* Move the malloc checking from module 'list' to new module 'xlist'.Bruno Haible2009-12-149-223/+408
|
* Move the malloc checking from module 'oset' to new module 'xoset'.Bruno Haible2009-12-143-13/+18
|
* setenv: relax requirement in light of POSIX rulingEric Blake2009-12-112-0/+8
| | | | | | | | | | | | | | | | Requiring that {un,}setenv gracefully reject NULL is just a waste of processing power; POSIX agreed to this argument in http://austingroupbugs.net/view.php?id=185 so we no longer worry whether a native implementation handles NULL. * m4/setenv.m4 (gl_FUNC_SETENV_SEPARATE): Test handling of "" but not NULL. * tests/test-setenv.c (main): Relax test. * tests/test-unsetenv.c (main): Likewise. * doc/posix-functions/setenv.texi (setenv): Document this. * doc/posix-functions/unsetenv.texi (unsetenv): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
* Tests for module 'nl_langinfo'.Bruno Haible2009-12-112-0/+141
|
* Tests for module 'langinfo'.Bruno Haible2009-12-111-0/+92
|
* New module 'arg-nonnull'. Declare which arguments expect non-NULL values.Bruno Haible2009-12-113-3/+21
|
* Use spaces for indentation, not tabs.Bruno Haible2009-12-10417-13986/+13986
|
* Add pty module for forkpty and openpty.Simon Josefsson2009-12-101-0/+55
|
* init.sh: avoid Solaris 10 /bin/sh portability problemJim Meyering2009-12-083-23/+24
| | | | | | | | | | | | | | | | | Solaris 10's /bin/sh does not pass '.' arguments 2..N to the sourced script: $ printf 'echo "$@"\n' > f; /bin/sh -c '. ./f bar' $ printf 'echo "$@"\n' > f; bash -c '. ./f bar' bar tests/init.sh relied on that, accepting a --set-path=DIR argument, and two tests used that idiom. * tests/init.sh: Update suggested usage comments. (path_prepend_): New function, to be used in place of the --src-path=DIR option. Disallow empty strings and strings containing ":". (setup_): Move PATH-prepending code into path_prepend_. * tests/test-pread.sh: Adapt to new usage. * tests/test-xalloc-die.sh: Likewise.
* fchdir: fix logic bugsEric Blake2009-12-081-1/+7
| | | | | | | | | | | | | Configuring with ac_cv_func_fchdir=no on a system that has fchdir and where open handles directories, just to test out the replacement capabilities, uncovered an m4 test bug and a link failure on rpl_fstat. * m4/fchdir.m4 (gl_FUNC_FCHDIR): Fix logic bug. * tests/test-fchdir.c (main): Enhance test. * lib/fchdir.c (rpl_fstat): Always provide if fchdir replacement is in use. Signed-off-by: Eric Blake <ebb9@byu.net>
* unistd-safer: add unit testEric Blake2009-12-073-2/+190
| | | | | | | | | | | | | | Add more unit tests. Meanwhile, fix compilation error on mingw when testing unistd-safer and fchdir together; and avoid gcc warning on platforms without setmode. * modules/unistd-safer-tests: New file. * tests/test-dup-safer.c: Likewise. * tests/test-cloexec.c (setmode): Avoid compiler warning. * tests/test-dup2.c (setmode): Likewise. * lib/cloexec.c (dup_cloexec): Fix mingw compile error. Signed-off-by: Eric Blake <ebb9@byu.net>
* cloexec: preserve text vs. binary across dup_cloexecEric Blake2009-12-072-0/+57
| | | | | | | | | | | | | | | | | On mingw, dup_cloexec mistakenly converted a text fd into a binary fd. Cygwin copied the source mode. Most other platforms don't distinguish between modes. * lib/cloexec.c (dup_cloexec) [W32]: Query and use translation mode. * modules/dup2-tests (Depends-on): Add binary-io. * modules/cloexec-tests (Depends-on): Likewise. * tests/test-dup2.c (setmode, is_mode): New helpers. (main): Add tests that translation mode is preserved. * tests/test-cloexec.c (setmode, is_mode, main): Likewise. Reported by Bruno Haible. Signed-off-by: Eric Blake <ebb9@byu.net>
* mgetgroups: reduce duplicate listingsEric Blake2009-12-072-39/+21
| | | | | | | | | | | | | | | | POSIX doesn't guarantee whether the effective gid is included in the list of supplementary groups returned by getgroups. On the other hand, some platforms include the effective gid twice in the list. Meanwhile, mgetgroups can independently add a duplicate. Rather than spend a full-blown O(n log n) cleanup, we just remove the most common forms of duplicate groups with an O(n) pass. * lib/mgetgroups.c (mgetgroups): Reduce duplicates from the resulting array. * tests/test-chown.h (test_chown): Simplify client. * tests/test-lchown.h (test_lchown): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
* test-dup2: enhance testEric Blake2009-12-051-8/+42
| | | | | | | | | Ensure that dup2(cloexec_fd, target) returns an inheritable fd. * modules/dup2-tests (Depends-on): Add cloexec. * tests/test-dup2.c (main): Enhance test. Signed-off-by: Eric Blake <ebb9@byu.net>
* cloexec: add dup_cloexecEric Blake2009-12-051-0/+122
| | | | | | | | | | | | | | | | | | | | This is needed to enforce correct semantics of mkostemp_safer. Meanwhile, it is one step closer to providing O_CLOEXEC support to open, as well as implementing portions of fcntl for mingw. * lib/cloexec.h (dup_cloexec): New prototype. Add copyright header and comments. * lib/cloexec.c (set_cloexec_flag): Add comments. (dup_cloexec): New function, with mingw implementation borrowed from... * lib/w32spawn.h (dup_noinherit): ...here. * modules/execute (Depends-on): Add cloexec. * modules/pipe (Depends-on): Likewise. * modules/cloexec (Depends-on): Add dup2. * modules/cloexec-tests (Files): New file. * tests/test-cloexec.c: Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
* test-xalloc-die: fix test for mingwEric Blake2009-12-051-25/+8
| | | | | | | | | | | | When cross-compiling on mingw to target mingw, argv[0] still includes a .exe suffix. Rather than worry about ${EXEEXT}, just add a sed post-process. Also, simplify the script by using tests/init.sh. * modules/xalloc-die-tests (Files): Add tests/init.sh. * tests/test-xalloc-die.sh: Rewrite to use init.sh. Strip directory and .exe suffix off argv[0] output. Signed-off-by: Eric Blake <ebb9@byu.net>
* test-fseeko: fix test for mingwEric Blake2009-12-051-12/+13
| | | | | | | | | Undefining fseek made test-fseeko.sh fail when testing on pipes. * tests/test-fseeko.c (fseek): Redefine GL_LINK_WARNING, rather than undefining fseek, so test will pass on mingw. Signed-off-by: Eric Blake <ebb9@byu.net>
* mgetgroups: avoid argument promotion issues with -1Eric Blake2009-12-042-8/+10
| | | | | | | | | | | | On platforms where gid_t is equivalent to uint16_t, argument promotion states that -1 != (gid_t) -1. * lib/mgetgroups.c (mgetgroups): A cast is required when checking for invalid gid_t. * tests/test-chown.h (getegid, test_chown): Likewise. * tests/test-lchown.h (getegid, test_lchown): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
* getopt-gnu: flush out another BSD bugEric Blake2009-11-273-165/+291
| | | | | | | | | | | | | | | | | | | | | | | | | POSIX requires 'echo foo > bar; m4 -Dfoo=1 bar -Dfoo=2 bar' to output '1' then '2'. To achieve this, m4 relies on the GNU getopt{,_long} extension of a leading '-'. However, BSD getopt fails to honor this extension when POSIXLY_CORRECT. Also, BSD getopt fails to reparse POSIXLY_CORRECT from the environment even when a reset is requested (whether by optreset=1 or by optind=0). * m4/getopt.m4 (gl_GETOPT_CHECK_HEADERS): Test for the bug. * tests/test-getopt.c (main): Check POSIXLY_CORRECT first, to flush out BSD bug. * tests/test-getopt.h (test_getopt): End lists with NULL. * tests/test-getopt_long.h (test_getopt_long): Likewise. (test_getopt_long_posix): Enhance test. * modules/getopt-posix-tests (Depends-on): Add stdbool. * doc/glibc-functions/getopt_long.texi (getopt_long): Mention getopt-gnu. * doc/glibc-functions/getopt_long_only.texi (getopt_long_only): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
* test-xalloc-die: avoid spurious failure due to libtool argv differenceJim Meyering2009-11-272-4/+4
| | | | | | | | | | | | | In a libtool-enabled project, this test would fail due to a difference in the emitted program name, e.g., -test-xalloc-die: memory exhausted +/tmp/.../tests/.libs/lt-test-xalloc-die: memory exhausted Use program to avoid that. * modules/xalloc-die-tests (Depends-on): Add progname. * tests/test-xalloc-die.c: Include progname.h". (program_name): Remove decl. (main): Call set_program_name. * tests/test-xalloc-die.sh (compare): Remove unnecessary ${EXE}.
* init.sh: suggest to use skip_ and fail_ functions in commentsEric Blake2009-11-261-0/+1
| | | | * tests/init.sh: Add a sentence.
* init.sh: add documentation in commentsBruno Haible2009-11-261-0/+36
| | | | * tests/init.sh: Add some developer and user documentation.
* init.sh: accommodate even those who specify bogus srcdir manuallyJim Meyering2009-11-262-3/+3
| | | | | | | | | | | * tests/init.sh: Normally, srcdir is guaranteed by automake and configure-time tests to be sanitized, so that there is no need to use "$srcdir" in Makefile rules and shell scripts. Using $srcdir (with no double quotes) suffices. However, since tests may be invoked manually, and since you may explicitly set srcdir to the name of a directory containing spaces, do quote its uses here. * tests/test-pread.sh: Likewise. Suggested by Bruno Haible.
* test-pread.sh: avoid diagnostics for those who ignore SIGPIPEJim Meyering2009-11-261-2/+2
| | | | | | | | * tests/test-pread.sh: Write no data into the pipe, because test-pread actually reads none. This avoids a diagnostic, "bash: echo: write error: Broken pipe", that arises in the unusual event something is ignoring SIGPIPE, and might be interpreted as some sort of failure. Reported by Bruno Haible.
* test-pread: cover failure with ESPIPE and EINVALJim Meyering2009-11-252-1/+17
| | | | | | * tests/test-pread.c (main): Test for failure, too. * tests/test-pread.sh: Invoke with stdin on a pipe. Suggested by Eric Blake.
* test-pread.sh: clean upJim Meyering2009-11-251-2/+2
| | | | | | | * tests/test-pread.sh: Don't refer to $builddir. Just use equivalent ".". * modules/pread-tests (TESTS_ENVIRONMENT): Don't export builddir. That is unnecessary, since it's always ".". Suggestion from Eric Blake.
* test-pread.sh: make executableJim Meyering2009-11-251-0/+0
| | | | | * tests/test-pread.sh: Set executable bit. Reported by Eric Blake.
* correct typo in test-pread.shJim Meyering2009-11-251-0/+1
| | | | * tests/test-pread.sh: Add #! line.
* test preadJim Meyering2009-11-252-0/+85
| | | | | | * tests/test-pread.c: New file. * tests/test-pread.sh: Likewise. * modules/pread-tests: Likewise.
* tests/init.sh: new file to be used via most *.sh testsJim Meyering2009-11-251-0/+216
| | | | * tests/init.sh: New file.
* duplocale: Fix logic bug.Bruno Haible2009-11-241-5/+28
|
* test-update-copyright: don't hard-code /usr/bin/perlJim Meyering2009-11-231-1/+1
| | | | | | * tests/test-update-copyright.sh (YEAR): Use date +%Y, rather than perl to print the current year. Gilles Espinasse reported that the replaced use of perl was hard-coded as /usr/bin/perl.