summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* Tests for module 'duplocale'.Bruno Haible2009-11-231-0/+107
|
* Check that <locale.h> defines locale_t and LC_GLOBAL_LOCALE.Bruno Haible2009-11-231-0/+5
|
* nanosleep: work around cygwin bugEric Blake2009-11-201-0/+94
| | | | | | | | | | | | | | | | | | | | | | Cygwin 1.5.x mistakenly failed with EINVAL for a duration longer than 49.7 days (2**32 milliseconds). Meanwhile, the existing code for HAVE_BUG_BIG_NANOSLEEP would infloop, instead of return failure, for invalid arguments. * lib/nanosleep.c (rpl_nanosleep) [HAVE_BUG_BIG_NANOSLEEP]: Fix logic bug when nanosleep fails. Work around cygwin 1.5.x bug. (getnow): Delete, not needed. * m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): No longer require LIB_CLOCK_GETTIME. * modules/nanosleep (Depends-on): Add intprops and verify. Drop clock-time, gettime. * doc/posix-functions/nanosleep.texi (nanosleep): Document the bug. * modules/nanosleep-tests: New test. * tests/test-nanosleep.c: New file. Signed-off-by: Eric Blake <ebb9@byu.net>
* sleep: work around cygwin bugEric Blake2009-11-201-10/+30
| | | | | | | | | | | | | | | | | | | On cygwin 1.5.x, sleep amounts larger than 49.7 days (2**32 milliseconds) failed instantly, but with a garbage return value from uninitialized memory. * lib/sleep.c (rpl_sleep): Work around the bug. * m4/sleep.m4 (gl_FUNC_SLEEP): Detect the bug. (gl_PREREQ_SLEEP): Delete unused macro. * modules/sleep (Depends-on): Add verify. * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Add default. * modules/unistd (Makefile.am): Substitute witness. * lib/unistd.in.h (sleep): Update prototype. * doc/posix-functions/sleep.texi (sleep): Document the bug. * tests/test-sleep.c (main) [HAVE_DECL_ALARM]: Test it. * modules/sleep-tests (Depends-on): Check for alarm. Signed-off-by: Eric Blake <ebb9@byu.net>
* test-xvasprintf: silence compiler warningsEric Blake2009-11-191-8/+16
| | | | | | | * tests/test-xvasprintf.c (test_xvasprintf, test_xasprintf): Mask empty string from gcc. Signed-off-by: Eric Blake <ebb9@byu.net>
* tests: avoid false negative with --with-packagerEric Blake2009-11-182-2/+4
| | | | | | | | | | Ignore extra line produced by version-etc. * tests/test-version-etc.sh: Discard packager information. * tests/test-argp-version-etc-1.sh: Likewise. Reported by Mike Frysinger. Signed-off-by: Eric Blake <ebb9@byu.net>
* usleep: use it to simplify testsEric Blake2009-11-175-45/+16
| | | | | | | | | | | | | | | | | | | | | | | Blindly using usleep makes it easier to write tests. * modules/stat-time-tests (Depends-on): Add usleep. (configure.ac): Drop usleep check. * modules/chown-tests (Depends-on, configure.ac): Likewise. * modules/lchown-tests (Depends-on, configure.ac): Likewise. * modules/fdutimensat-tests (Depends-on, configure.ac): Likewise. * modules/futimens-tests (Depends-on, configure.ac): Likewise. * modules/openat-tests (Depends-on, configure.ac): Likewise. * modules/utimens-tests (Depends-on, configure.ac): Likewise. * modules/utimensat-tests (Depends-on, configure.ac): Likewise. * modules/pipe-filter-gi-tests (Depends-on, configure.ac): Likewise. * tests/test-chown.h (nap): Rely on nicer usleep semantics. * tests/test-lchown.h (nap): Likewise. * tests/test-pipe-filter-gi2-main.c (small_nap): Likewise. * tests/test-stat-time.c (nap): Likewise. * tests/test-utimens-common.h (nap): Update comments. Signed-off-by: Eric Blake <ebb9@byu.net>
* usleep: new moduleEric Blake2009-11-171-0/+49
| | | | | | | | | | | | | | | | | | | | | mingw usleep(1000000) failed with EINVAL, as allowed by POSIX, but contrary to GNU usage. Rather than implement an accurate usleep based on select or nanosleep, both of which drag in dependencies on external libraries, this version intentionally takes the ceiling in seconds if usleep() is missing. * modules/usleep: New file. * m4/usleep.m4 (gl_FUNC_USLEEP): Likewise. * lib/usleep.c (usleep): Likewise. * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Add defaults. * modules/unistd (Makefile.am): Substitute witnesses. * lib/unistd.in.h (usleep): Add declaration. * doc/pastposix-functions/usleep.texi (usleep): Document this. * MODULES.html.sh (Date and time): Likewise. * modules/usleep-tests (Depends-on): New test. * tests/test-usleep.c: New file. Signed-off-by: Eric Blake <ebb9@byu.net>
* chown: work around OpenBSD bugEric Blake2009-11-171-1/+11
| | | | | | | | | | | | | | | | | | | | | | chown(name,geteuid(),-1) failed to update the change time if name was already owned by the current effective user. Work around it by using chmod, which does not have this bug. Unfortunately, lchown has the same bug, but OpenBSD 4.0 lacks lchmod and lutimes, so there is no way to affect ctime without unlinking and recreating the symlink, which is too dangerous. * lib/chown.c (rpl_chown): Work around the bug. * lib/lchown.c (rpl_lchown): Attempt to do likewise. * m4/chown.m4 (gl_FUNC_CHOWN): Test for ctime bug. * m4/lchown.m4 (gl_FUNC_LCHOWN): Check for lchmod. * modules/chown (Depends-on): Add stdbool. * modules/lchown (Depends-on): Likewise. * doc/posix-functions/chown.texi (chown): Document the bug. * doc/posix-functions/lchown.texi (lchown): Likewise. * tests/test-lchown.h (test_chown): Relax test. Signed-off-by: Eric Blake <ebb9@byu.net>
* xalloc-die-tests: optimizeEric Blake2009-11-171-5/+3
| | | | | | * tests/test-xalloc-die.sh: Reduce number of processes. Signed-off-by: Eric Blake <ebb9@byu.net>
* tests/test-xalloc-die.sh: Deal with EOL differences, and more.Simon Josefsson2009-11-171-3/+28
|
* test-xalloc-die.sh: make the code agree with the commit logJim Meyering2009-11-171-1/+1
| | | | | | * tests/test-xalloc-die.sh: Put "." at the front of $PATH, not at the end, just in case you happen to have a test-xalloc-die program in some other PATH directory.
* test-xalloc-die.sh: fix a portability bugJim Meyering2009-11-171-1/+3
| | | | | | | * tests/test-xalloc-die.sh: Do not invoke via ./test-xalloc-die. Instead, set PATH to start with "." and invoke via "test-xalloc-die". Otherwise, argv[0] (as often seen in diagnostics) would be too system-dependent, sometimes with, and sometimes without the leading "./".
* xalloc-die-tests: avoid printing null pointerEric Blake2009-11-162-0/+30
| | | | | | | | | | | | The test leaked "(null): memory exhausted" to stderr, or crashed for less capable printf. * modules/xalloc-die-tests (Files, Makefile.am): Wrap execution in shell script. * tests/test-xalloc-die.c (program_name): Declare. * tests/test-xalloc-die.sh (tmpfiles): New file. Signed-off-by: Eric Blake <ebb9@byu.net>
* setenv, unsetenv: work around various bugsEric Blake2009-11-162-0/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | POSIX requires setenv(NULL,"",0), setenv("a=b","",0), unsetenv(NULL), and unsetenv("a=b") to fail with EINVAL, but many BSD implementations lack validation. The gnulib replacement for void unsetenv did not do validation, and the replacement for setenv was out of sync with glibc. Also, some BSD implementations of setenv("a","==",1) eat the leading '='. See also some recent Austin Group interpretations on environ: http://austingroupbugs.net/view.php?id=167 http://austingroupbugs.net/view.php?id=185 * lib/setenv.c (setenv) [!HAVE_SETENV]: Resync from glibc. (setenv) [HAVE_SETENV]: Work around bugs. * lib/unsetenv.c (unsetenv) [HAVE_UNSETENV]: Work around bugs. * m4/setenv.m4 (gl_FUNC_SETENV_SEPARATE, gl_FUNC_UNSETENV): Check for bugs. (gl_FUNC_SETENV): Write in terms of gl_FUNC_SETENV_SEPARATE. * m4/environ.m4 (gl_ENVIRON): Avoid expand-before-require. * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Update defaults. * modules/stdlib (Makefile.am): Update substitutions. * lib/stdlib.in.h (setenv, unsetenv): Update prototypes. * doc/posix-functions/setenv.texi (setenv): Document the bugs. * doc/posix-functions/unsetenv.texi (unsetenv): Likewise. * modules/setenv-tests: New test. * modules/unsetenv-tests: Likewise. * tests/test-setenv.c: New file. * tests/test-unsetenv.c: Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
* test-freading: clean up temporary fileEric Blake2009-11-161-73/+39
| | | | | | | | * tests/test-freading.c (main): Remove file on success, and use ASSERT more liberally. Reported by Jim Meyering. Signed-off-by: Eric Blake <ebb9@byu.net>
* Add xalloc-die self-test.Simon Josefsson2009-11-151-0/+28
|
* openat: detect Solaris fchownat bugEric Blake2009-11-141-0/+89
| | | | | | | | | | | | | | | | | | Solaris 9 fchownat(dir,"name/",uid,gid,flag) has same bugs as chown and lchown. * lib/fchownat.c (rpl_fchownat): Work around Solaris bug. Avoid penalizing glibc chownat when only lchownat is broken. * m4/openat.m4 (gl_FUNC_FCHOWNAT): Replace fchownat if there are trailing slash bugs. * doc/posix-functions/fchownat.texi (fchownat): Document the bug. * modules/openat-tests (Files): Include more files. (Depends-on): Add mgetgroups, sleep, stat-time. (configure.ac): Add additional checks. (Makefile.am): Build new test. * tests/test-fchownat.c: New file. Signed-off-by: Eric Blake <ebb9@byu.net>
* lchown: detect Solaris and FreeBSD bugEric Blake2009-11-142-0/+367
| | | | | | | | | | | | | | | | | Solaris 9 and FreeBSD 7.2 lchown("link-to-file/",uid,gid) mistakenly changes ownership of "file". * lib/lchown.c (rpl_lchown): Work around bug. * m4/lchown.m4 (gl_FUNC_LCHOWN): Check for trailing slash bugs. * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Add witness. * modules/unistd (Makefile.am): Populate it. * lib/unistd.in.h (lchown): Update declaration. * doc/posix-functions/lchown.texi (lchown): Document the bug. * modules/lchown-tests: New file. * tests/test-lchown.h (test_lchown): Likewise. * tests/test-lchown.c (main): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
* chown: detect Solaris and FreeBSD bugEric Blake2009-11-142-0/+325
| | | | | | | | | | | | | | | | | | | | | | Solaris 9 and FreeBSD 7.2 chown("link-to-file/",uid,gid) mistakenly changes ownership of "file". * lib/chown.c (rpl_chown): Work around bug. * m4/chown.m4 (gl_FUNC_CHOWN): Check for trailing slash bugs. (gl_PREREQ_CHOWN): Delete. * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): Add witness. * modules/unistd (Makefile.am): Populate it. * lib/unistd.in.h (chown): Update declaration. * lib/lchown.c (chown): Update client. * modules/lchown (Depends-on): Add lstat. * doc/posix-functions/chown.texi (chown): Document the bug. * doc/posix-functions/getgroups.texi (getgroups): Document getgroups pitfall. * modules/chown-tests: New file. * tests/test-chown.h (test_chown): Likewise. * tests/test-chown.c (main): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
* getgroups: work around FreeBSD bugEric Blake2009-11-131-1/+1
| | | | | | | | | | | | FreeBSD 7.2 mistakenly succeeds on getgroups(-1,ptr) (POSIX requires EINVAL failure since -1 is less than the proper result). * lib/getgroups.c (rpl_getgroups): Work around the bug. * m4/getgroups.m4 (gl_FUNC_GETGROUPS): Detect the bug. * doc/posix-functions/getgroups.texi (getgroups): Document it. * tests/test-getgroups.c (main): Fix buffer overrun. Signed-off-by: Eric Blake <ebb9@byu.net>
* test-getgroups: avoid compilation failureJim Meyering2009-11-131-0/+1
| | | | * tests/test-getgroups.c: Include <stdint.h> for use of SIZE_MAX.
* getgroups: don't expose GETGROUPS_T to userEric Blake2009-11-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These days, most systems already declare getgroups with gid_t*. But in the rare case that GETGROUPS_T is still int but gid_t is short, the user should not have to uglify their code; let the replacement hide all the magic. Tested by configuring with ac_cv_type_getgroups=uint64_t on a platform with 32-bit gid_t, and ignoring compiler warnings. However, since we don't replace setgroups, the GETGROUPS_T workaround is still needed there for now. * lib/getgroups.c (rpl_getgroups): Change signature. Copy array an element at a time if GETGROUPS_T is wrong size. * lib/getugroups.h (getugroups): Change signature. * lib/unistd.in.h (getgroups): Likewise. * m4/getgroups.m4 (gl_FUNC_GETGROUPS): Use replacement if signature needs fixing. * m4/getugroups.m4 (gl_GETUGROUPS): No longer need AC_TYPE_GETGROUPS. * modules/group-member (Depends-on): Add getgroups. * lib/group-member.c (group_info, get_group_info): Use gid_t. (group_member): Rely on getgroups replacement. * lib/getugroups.c (getugroups): Use gid_t. * tests/test-getgroups.c (main): Likewise. * NEWS: Mention the signature change. * doc/posix-functions/getgroups.texi (getgroups): Mention the problem with signature. * doc/glibc-functions/setgroups.texi (setgroups): Mention that GETGROUPS_T is still useful for setgroups. Signed-off-by: Eric Blake <ebb9@byu.net>
* getgroups: fix logic errorEric Blake2009-11-131-0/+84
| | | | | | | | | | | | | The replacement getgroups mistakenly failed with EINVAL if there were more than 20 groups, since -1 < n_groups. Also, realloc geometrically rather than linearly. * lib/getgroups.c (rpl_getgroups): Don't fail if current process has more than 20 groups. * modules/getgroups-tests: New test. * tests/test-getgroups.c: New file. Signed-off-by: Eric Blake <ebb9@byu.net>
* Drop redundant string.h (silent change).Simon Josefsson2009-11-131-1/+0
| | | | Suggested by Eric Blake <ebb9@byu.net>.
* test-base64: Improve.Simon Josefsson2009-11-131-86/+149
|
* tests/test-xvasprintf.c: Fix memory leak.Simon Josefsson2009-11-131-0/+8
|
* test-xvasprintf: Add %s%s related checks.Simon Josefsson2009-11-131-2/+36
|
* mkfifoat: use new modules for Solaris and BSD bugsEric Blake2009-11-111-43/+48
| | | | | | | | | | | | | | | | | | | Pick up Solaris 9 and BSD fixes to mkfifo and mknod. No known system has mknodat but broken mknod, so there is no need for rpl_mkfifoat or rpl_mknodat. Split mknodat into its own file. * m4/mkfifoat.m4 (gl_FUNC_MKFIFOAT): Simplify. * lib/mkfifoat.c (mknodat): Split... * lib/mknodat.c (mknodat): ...into new file. * modules/mkfifoat (Files): Ship new file. (Depends-on): Add mkfifo, mknod. * modules/mkfifoat-tests (Files): Reuse mkfifo tests. (Depends-on): Add symlink. * tests/test-mkfifoat.c (main): Enhance test. Drop portions now redundant with test_mkfifo.h. (do_mkfifoat, do_mknodat): New helpers. Signed-off-by: Eric Blake <ebb9@byu.net>
* mknod: new moduleEric Blake2009-11-111-0/+62
| | | | | | | | | | | | | | | | | | | | | | | Solaris 9 mknod("name/",mode,dev) mistakenly creates "name" for non-directory mode. FreeBSD 7.2 mknod("dangling/",mode,dev) mistakenly creates the target of the symlink if run as root. FreeBSD and OpenBSD mknod("fifo",S_IFIFO|mode,0) fails for non-root. Use of mknod caused link failures on mingw. * modules/mknod: New file. * m4/mknod.m4 (gl_FUNC_MKNOD): Likewise. * lib/mknod.c (mknod): Likewise. * m4/sys_stat_h.m4 (gl_SYS_STAT_H_DEFAULTS): Set witness defaults. * modules/sys_stat (Makefile.am): Substitute them. * lib/sys_stat.in.h (mknod): Declare replacement. * MODULES.html.sh (Support for systems lacking POSIX:2008): Document it. * doc/posix-functions/mknod.texi (mknod): Likewise. * modules/mknod-tests: New test. * tests/test-mknod.c: Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
* mkfifo: new moduleEric Blake2009-11-112-0/+127
| | | | | | | | | | | | | | | | | | | | | | | | Solaris 9 mkfifo("name/",mode) mistakenly creates "name". FreeBSD 7.2 mkfifo("dangling/",mode) mistakenly creates a fifo at the target of "dangling". Mingw lacks named pipes altogether, but this at least avoids link failures. * modules/mkfifo: New file. * m4/mkfifo.m4 (gl_FUNC_MKFIFO): Likewise. * lib/mkfifo.c (mkfifo): Likewise. * m4/sys_stat_h.m4 (gl_SYS_STAT_H_DEFAULTS): Set witness defaults. * modules/sys_stat (Makefile.am): Substitute them. * lib/sys_stat.in.h (mkfifo): Declare replacement. * MODULES.html.sh (Support for systems lacking POSIX:2008): Document it. * doc/posix-functions/mkfifo.texi (mkfifo): Likewise. * modules/mkfifo-tests: New test. * tests/test-mkfifo.h (test_mkfifo): New file, borrowed in part from test-mkfifoat.c. * tests/test-mkfifo.c: New file. Signed-off-by: Eric Blake <ebb9@byu.net>
* readlink: detect FreeBSD bugEric Blake2009-11-111-1/+12
| | | | | | | | | | | | readlink("link-to-symlink/",buf,len) mistakenly read the contents of "symlink", rather than failing. * m4/readlink.m4 (gl_FUNC_READLINK): Also detect FreeBSD bug with slash on symlink. * doc/posix-functions/readlink.texi (readlink): Document the bug. * tests/test-readlink.h (test_readlink): Enhance test. Signed-off-by: Eric Blake <ebb9@byu.net>
* symlink: detect FreeBSD bugEric Blake2009-11-111-5/+23
| | | | | | | | | | | | symlink(name,"dangling/") mistakenly created a symlink at the target of "dangling". * m4/symlink.m4 (gl_FUNC_SYMLINK): Also detect FreeBSD bug with slash on symlink. * doc/posix-functions/symlink.texi (symlink): Document the bug. * tests/test-symlink.h (test_symlink): Enhance test. Signed-off-by: Eric Blake <ebb9@byu.net>
* link: detect FreeBSD bugEric Blake2009-11-102-13/+32
| | | | | | | | | | | | link("link-to-file/","a") mistakenly created "a" as a link to "file". * m4/link.m4 (gl_FUNC_LINK): Also detect FreeBSD bug with slash on symlink. * doc/posix-functions/link.texi (link): Document the bug. * tests/test-link.h (test_link): Enhance test. * tests/test-linkat.c (main): Update caller. Signed-off-by: Eric Blake <ebb9@byu.net>
* unlink, remove: detect FreeBSD bugEric Blake2009-11-102-2/+18
| | | | | | | | | | | | | unlink("link-to-file/") mistakenly removed "file". * m4/unlink.m4 (gl_FUNC_UNLINK): Also detect FreeBSD bug with slash on symlink. * doc/posix-functions/unlink.texi (unlink): Document the bug. * doc/posix-functions/remove.texi (remove): Likewise. * tests/test-unlink.h (test_unlink): Enhance test. * tests/test-remove.c (main): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
* rename: detect FreeBSD bugEric Blake2009-11-092-3/+6
| | | | | | | | | | | | | rename("link-to-file/","new") mistakenly succeeded. * m4/rename.m4 (gl_FUNC_RENAME): Also detect FreeBSD bug with slash on symlink. * modules/renameat-tests (Depends-on): Add filenamecat. * tests/test-rename.h (test_rename): Allow one more errno. * tests/test-renameat.c (main): Likewise. * doc/posix-functions/rename.texi (rename): Document the bug. Signed-off-by: Eric Blake <ebb9@byu.net>
* open: detect FreeBSD bugEric Blake2009-11-094-39/+111
| | | | | | | | | | | | | | | | | | | | open("link-to-file/", O_RDONLY) mistakenly succeeds. The previous patch was enough to fix utimens when no fd is involved, but this is necessary for futimens to pass. * m4/open.m4 (gl_FUNC_OPEN): Also detect FreeBSD bug with slash on symlink. * doc/posix-functions/open.texi (open): Document the bug. * doc/posix-functions/utimes.texi (utimes): Likewise. * tests/test-open.h (test_open): Add parameters, and test symlink handling. * tests/test-open.c (main): Adjust caller. * tests/test-fcntl-safer.c (main): Likewise. * modules/open-tests (Depends-on): Add stdbool, symlink. * modules/fcntl-safer-tests (Depends-on): Likewise. * tests/test-openat.c (main): Add test-open tests. Signed-off-by: Eric Blake <ebb9@byu.net>
* stat: detect FreeBSD bugEric Blake2009-11-093-17/+59
| | | | | | | | | | | | | | | | | | Like Solaris 9, FreeBSD 7.2 mistakenly allows stat("link-to-file/"). Unlike Solaris, it correctly forbids stat("file/"). A number of interfaces are affected (such as utimes), but replacing stat is enough to catch several by reusing the Solaris 9 fixes. * m4/stat.m4 (gl_FUNC_STAT): Also detect FreeBSD bug with slash on symlink. * doc/posix-functions/stat.texi (stat): Document the bug. * tests/test-stat.h (test_stat_func): Add argument. * tests/test-stat.c (main): Adjust caller. * tests/test-fstatat.c (main): Likewise. * modules/stat-tests (Depends-on): Add stdbool, symlink. Reported by Jim Meyering. Signed-off-by: Eric Blake <ebb9@byu.net>
* fflush, freadseek: use fseeko, not fseekEric Blake2009-11-079-4/+52
| | | | | | | | | | | | | | | | | | | | | Follow our own advice: fseek is not safe to use on large files. * lib/fflush.c (clear_ungetc_buffer_preserving_position) (clear_ungetc_buffer): Avoid potential problems on large files. * lib/freadseek.c (freadseek): Likewise. * modules/freadseek (Depends-on): Add fseeko. * modules/fseek (configure.ac): Set a witness. * tests/test-fflush.c (main): Use fseeko. * tests/test-fpurge.c (fseek): Disable link warning. * tests/test-freadable.c (fseek): Likewise. * tests/test-freading.c (fseek): Likewise. * tests/test-fseeko.c (fseek): Likewise. * tests/test-ftell.c (fseek): Likewise. * tests/test-ftello.c (fseek): Likewise. * tests/test-fwritable.c (fseek): Likewise. * tests/test-fwriting.c (fseek): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
* freopen-safer: new moduleEric Blake2009-11-051-0/+107
| | | | | | | | | | | | | | | | | | * modules/freopen-safer: New module. * m4/stdio-safer.m4 (gl_FREOPEN_SAFER): New macro. * lib/freopen-safer.c (freopen_safer): New file. * lib/stdio-safer.h (freopen_safer): New declaration. * lib/stdio--.h (freopen): New override. * MODULES.html.sh (File stream based Input/Output): Mention it. * doc/posix-functions/freopen.texi (freopen): Mention pitfalls and freopen-safer module. * doc/posix-functions/stderr.texi (stderr): Likewise. * doc/posix-functions/stdin.texi (stdin): Likewise. * doc/posix-functions/stdout.texi (stdout): Likewise. * modules/freopen-safer-tests: New test. * tests/test-reopen-safer.c: New file. Signed-off-by: Eric Blake <ebb9@byu.net>
* Fix typo in last commit.Simon Josefsson2009-11-051-1/+1
|
* test-func.c: Also test value of __func__.Simon Josefsson2009-11-051-0/+3
|
* test-sys_socket: Fix compilation warning.Simon Josefsson2009-11-051-1/+1
|
* Tests for module 'inet_pton'.Bruno Haible2009-11-051-0/+67
|
* Tests for module 'inet_ntop'.Bruno Haible2009-11-051-0/+64
|
* test-getaddrinfo: avoid compilation failure on FreeBSD 7.2Jim Meyering2009-11-031-0/+2
| | | | | * tests/test-getaddrinfo.c (simple): Test for EAI_NODATA only if it is defined.
* test-update-copyright: update test to match script changesEric Blake2009-11-021-1/+9
| | | | | | | * tests/test-update-copyright.sh: Avoid hard-coding perl location. Don't update *.bak created by earlier runs. Signed-off-by: Eric Blake <ebb9@byu.net>
* dirname: split into dirname-lgplEric Blake2009-10-291-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | dirname.h is proving quite useful from multiple LGPL modules, given the number of trailing slash bugs fixed in syscalls; only the calls to xalloc_die need to remain GPL. * modules/dirname-lgpl: New module. * modules/dirname (Files): Move library-safe files into dirname-lgpl. (Depends-on): Add dirname-lgpl. (configure.ac): Declare witness. * modules/double-slash-root (License): Relax license. * lib/dirname.h (base_name, dir_name): Only declare when using GPL module. * lib/dirname.c (dir_len, mdir_name): Move... * lib/dirname-lgpl.c: ...into new file. * lib/basename.c (last_component, base_len): Move... * lib/basename-lgpl.c: ...into new file. * m4/dirname.m4 (gl_DIRNAME_LGPL): New macro. (gl_DIRNAME): Use it. * MODULES.html.sh (Enhancements for POSIX:2008 functions): Mention new module. * modules/dirname-tests (Depends-on): Add progname. * tests/test-dirname.c (program_name): Delete. Signed-off-by: Eric Blake <ebb9@byu.net>
* tests: avoid some compiler warningsEric Blake2009-10-2917-28/+29
| | | | | | | | | | | | | | | | | | | | | | | | | Mostly Simon's modules; warnings reported by gcc 4.3.4 on coreutils. * tests/test-getaddrinfo.c (simple): Mark static, and allow string literals. * tests/test-memchr.c (main): Avoid type mismatch. * tests/test-arpa_inet.c (main): Avoid unused parameters. * tests/test-base64.c (main): Likewise. * tests/test-getdelim.c (main): Likewise. * tests/test-gethostname.c (main): Likewise. * tests/test-getline.c (main): Likewise. * tests/test-netinet_in.c (main): Likewise. * tests/test-select.c (open_server_socket, main): Likewise. * tests/test-select-stdin.c (main): Likewise. * tests/test-sockets.c (main): Likewise. * tests/test-strsignal.c (main): Likewise. * tests/test-sys_select.c (main): Likewise. * tests/test-sys_socket.c (main): Likewise. * tests/test-u64.c (main): Likewise. * tests/test-xfprintf-posix.c (main): Likewise. * tests/test-xvasprintf.c (test_xvasprintf, main): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>
* tests: avoid several compiler warningsEric Blake2009-10-2287-182/+193
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * tests/test-getcwd.c (main): Avoid buffer underflow. * tests/test-getdate.c (main): String literals are not safe with putenv, so use setenv. Declare unused argument. * modules/getdate-tests (Depends-on): Add setenv. * tests/test-argv-iter.c (main): Declare unused argument. Avoid problems with string literals in char *. * tests/test-hash.c (main): Avoid shadowing declaration. (insert_new): Treat string literals as char const *. * tests/test-getopt.h (test_getopt): Likewise. (getopt_loop): Alter types to minimize casting elsewhere. * tests/test-getopt_long.h (test_getopt_long, getopt_long_loop) (test_getopt_long_posix): Likewise. (do_getopt_long): Add wrapper to minimize casting. * tests/test-atexit.c (clear_temp_file): Use void. * tests/test-areadlink-with-size.c (main): Declare unused arguments. * tests/test-areadlink.c (main): Likewise. * tests/test-areadlinkat-with-size.c (main): Likewise. * tests/test-areadlinkat.c (main): Likewise. * tests/test-canonicalize-lgpl.c (main): Likewise. * tests/test-canonicalize.c (main): Likewise. * tests/test-dirent-safer.c (main): Likewise. * tests/test-dirname.c (main): Likewise. * tests/test-dup2.c (main): Likewise. * tests/test-fchdir.c (main): Likewise. * tests/test-fcntl-h.c (main): Likewise. * tests/test-fcntl-safer.c (main): Likewise. * tests/test-fdopendir.c (main): Likewise. * tests/test-fdutimensat.c (main): Likewise. * tests/test-fflush.c (main): Likewise. * tests/test-filenamecat.c (main): Likewise. * tests/test-filevercmp.c (main): Likewise. * tests/test-fopen-safer.c (main): Likewise. * tests/test-fopen.c (main): Likewise. * tests/test-fpending.c (main): Likewise. * tests/test-fpurge.c (main): Likewise. * tests/test-freading.c (main): Likewise. * tests/test-fstatat.c (main): Likewise. * tests/test-fsync.c (main): Likewise. * tests/test-futimens.c (main): Likewise. * tests/test-getndelim2.c (main): Likewise. * tests/test-gettimeofday.c (main): Likewise. * tests/test-getopt.c (main): Likewise. * tests/test-i-ring.c (main): Likewise. * tests/test-inttypes.c (main): Likewise. * tests/test-link.c (main): Likewise. * tests/test-lstat.c (main): Likewise. * tests/test-math.c (main): Likewise. * tests/test-md5.c (main): Likewise. * tests/test-memchr2.c (main): Likewise. * tests/test-memrchr.c (main): Likewise. * tests/test-mkdir.c (main): Likewise. * tests/test-mkdirat.c (main): Likewise. * tests/test-mkfifoat.c (main): Likewise. * tests/test-open.c (main): Likewise. * tests/test-openat-safer.c (main): Likewise. * tests/test-openat.c (main): Likewise. * tests/test-quotearg.c (main): Likewise. * tests/test-rawmemchr.c (main): Likewise. * tests/test-readlink.c (main): Likewise. * tests/test-remove.c (main): Likewise. * tests/test-rename.c (main): Likewise. * tests/test-renameat.c (main): Likewise. * tests/test-rmdir.c (main): Likewise. * tests/test-sha1.c (main): Likewise. * tests/test-signal.c (main): Likewise. * tests/test-sigaction.c (main): Likewise. * tests/test-stat.c (main): Likewise. * tests/test-stat-time.c (main): Likewise. * tests/test-stddef.c (main): Likewise. * tests/test-stdint.c (main): Likewise. * tests/test-stdio.c (main): Likewise. * tests/test-stdlib.c (main): Likewise. * tests/test-strchrnul.c (main): Likewise. * tests/test-strerror.c (main): Likewise. * tests/test-string.c (main): Likewise. * tests/test-strtod.c (main): Likewise. * tests/test-strverscmp.c (main): Likewise. * tests/test-symlink.c (main): Likewise. * tests/test-symlinkat.c (main): Likewise. * tests/test-sys_stat.c (main): Likewise. * tests/test-sys_time.c (main): Likewise. * tests/test-time.c (main): Likewise. * tests/test-unistd.c (main): Likewise. * tests/test-unlink.c (main): Likewise. * tests/test-unlinkat.c (main): Likewise. * tests/test-utimens.c (main): Likewise. * tests/test-utimensat.c (main): Likewise. * tests/test-version-etc.c (main): Likewise. * tests/test-wchar.c (main): Likewise. * tests/test-wctype.c (main): Likewise. * tests/test-xprintf-posix.c (main): Likewise. * tests/test-posixtm.c (main): Likewise. (STREQ): Delete unused macro. * tests/test-linkat.c (main): Declare unused arguments. Avoid shadowed variables. * tests/test-memchr.c (main): Likewise. Signed-off-by: Eric Blake <ebb9@byu.net>