X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-rename.h;h=7e024e0ab01ec133a99f6a792020897853a10a8e;hb=23eecb48e39afd0d267d64d40ba6bf97aa865e13;hp=b8ff4fed16be86450699ba0f751f214de2ec5056;hpb=cf3b6a11724d87837830e3e5390a6cacf6af1cd4;p=gnulib.git diff --git a/tests/test-rename.h b/tests/test-rename.h index b8ff4fed1..7e024e0ab 100644 --- a/tests/test-rename.h +++ b/tests/test-rename.h @@ -1,5 +1,5 @@ /* Test of rename() function. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009-2013 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 @@ -56,11 +56,16 @@ assert_nonexistent (const char *filename) if (stat (filename, &st) == -1) ASSERT (errno == ENOENT); else - /* But after renaming a directory over an empty directory on an NFS-mounted - file system, on Linux 2.6.18, for a period of 30 seconds the old - directory name is "present" according to stat() but "nonexistent" - according to dentry_exists(). */ - ASSERT (!dentry_exists (filename)); + { + /* But after renaming a directory over an empty directory on an NFS- + mounted file system, on Linux 2.6.18, for a period of 30 seconds the + old directory name is "present" according to stat() but "nonexistent" + according to dentry_exists(). */ + ASSERT (!dentry_exists (filename)); + /* Remove the old directory name, so that subsequent mkdir calls + succeed. */ + (void) rmdir (filename); + } } static int @@ -334,12 +339,12 @@ test_rename (int (*func) (char const *, char const *), bool print) errno = 0; ASSERT (func (BASE "dir2", BASE "dir/.") == -1); ASSERT (errno == EINVAL || errno == EBUSY || errno == EISDIR - || errno == ENOTEMPTY); + || errno == ENOTEMPTY || errno == EEXIST); } { errno = 0; ASSERT (func (BASE "dir2/.", BASE "dir") == -1); - ASSERT (errno == EINVAL || errno == EBUSY); + ASSERT (errno == EINVAL || errno == EBUSY || errno == EEXIST); } ASSERT (rmdir (BASE "dir") == 0); /* Files present here: @@ -361,12 +366,12 @@ test_rename (int (*func) (char const *, char const *), bool print) errno = 0; ASSERT (func (BASE "dir2", BASE "dir/.//") == -1); ASSERT (errno == EINVAL || errno == EBUSY || errno == EISDIR - || errno == ENOTEMPTY); + || errno == ENOTEMPTY || errno == EEXIST); } { errno = 0; ASSERT (func (BASE "dir2/.//", BASE "dir") == -1); - ASSERT (errno == EINVAL || errno == EBUSY); + ASSERT (errno == EINVAL || errno == EBUSY || errno == EEXIST); } ASSERT (rmdir (BASE "dir2") == 0); /* Files present here: @@ -783,6 +788,7 @@ test_rename (int (*func) (char const *, char const *), bool print) ASSERT (lstat (BASE "link1", &st) == 0); ASSERT (S_ISLNK (st.st_mode)); } + } /* Files present here: {BASE}file {BASE}link1 -> {BASE}file @@ -913,7 +919,7 @@ test_rename (int (*func) (char const *, char const *), bool print) if (result) /* GNU/Linux rejects attempts to use link2/. */ { ASSERT (result == -1); - ASSERT (errno == ENOTDIR); + ASSERT (errno == ENOTDIR || errno == EISDIR); } memset (&st, 0, sizeof st); ASSERT (lstat (BASE "dir", &st) == 0);