Mercurial > hg > octave-kai > gnulib-hg
diff tests/test-rmdir.h @ 12043:fc84db4ef49d
test-unlinkat: enhance test, to expose Solaris 9 bug
Share the unlink tests with unlinkat.
* tests/test-unlink.c (main): Factor guts...
* tests/test-unlink.h (test_rmdir_func): ...into new file.
* tests/test-rmdir.h (test_rmdir_func): Add parameter.
* tests/test-rmdir.c (main): Adjust caller.
* tests/test-unlinkat.c (main): Likewise. Add unlink tests.
(unlinker): New helper function.
(rmdirat): Enhance check.
* modules/rmdir-tests (Depends-on): Add stdbool.
* modules/unlink-tests (Depends-on): Likewise.
(Files): Add test-unlink.h.
* modules/openat-tests (Files): Likewise.
(Depends-on): Add unlinkdir.
Signed-off-by: Eric Blake <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Thu, 17 Sep 2009 22:16:56 -0600 (2009-09-18) |
parents | 5767a52927aa |
children | 34277de50e87 |
line wrap: on
line diff
--- a/tests/test-rmdir.h +++ b/tests/test-rmdir.h @@ -19,10 +19,11 @@ /* This file is designed to test both rmdir(n) and unlinkat(AT_FDCWD,n,AT_REMOVEDIR). FUNC is the function to test. Assumes that BASE and ASSERT are already defined, and that - appropriate headers are already included. */ + appropriate headers are already included. If PRINT, then warn + before returning status 77 when symlinks are unsupported. */ static int -test_rmdir_func (int (*func) (char const *name)) +test_rmdir_func (int (*func) (char const *name), bool print) { /* Remove any leftovers from a previous partial run. */ ASSERT (system ("rm -rf " BASE "*") == 0); @@ -78,8 +79,9 @@ but not enough to penalize POSIX systems with an rpl_rmdir. */ if (symlink (BASE "dir", BASE "link") != 0) { - fputs ("skipping test: symlinks not supported on this filesystem\n", - stderr); + if (print) + fputs ("skipping test: symlinks not supported on this filesystem\n", + stderr); return 77; } ASSERT (mkdir (BASE "dir", 0700) == 0);