X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-rmdir.h;h=476b307d1078c31cabb580ed3071cbd49d4752ca;hb=96f8fde75f5197ff2d68e616ef41532b96fba64f;hp=2470240049adb40196a88b00db374cc22c339d0b;hpb=fc8289d694095c8e5def3078a2557e122dcf459b;p=gnulib.git diff --git a/tests/test-rmdir.h b/tests/test-rmdir.h index 247024004..476b307d1 100644 --- a/tests/test-rmdir.h +++ b/tests/test-rmdir.h @@ -1,5 +1,5 @@ /* Tests of rmdir. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,14 +19,12 @@ /* 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); - /* Setup. */ ASSERT (mkdir (BASE "dir", 0700) == 0); ASSERT (close (creat (BASE "dir/file", 0600)) == 0); @@ -67,8 +65,9 @@ test_rmdir_func (int (*func) (char const *name)) /* Empty directory. */ ASSERT (unlink (BASE "dir/file") == 0); errno = 0; - ASSERT (func (BASE "dir/./") == -1); - ASSERT (errno == EINVAL || errno == EBUSY); + ASSERT (func (BASE "dir/.//") == -1); + ASSERT (errno == EINVAL || errno == EBUSY || errno == EEXIST + || errno == ENOTEMPTY); ASSERT (func (BASE "dir") == 0); /* Test symlink behavior. Specifying trailing slash should remove @@ -78,8 +77,9 @@ test_rmdir_func (int (*func) (char const *name)) 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 file system\n", + stderr); return 77; } ASSERT (mkdir (BASE "dir", 0700) == 0);