Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/syscall Adjust the EEXIST-check once more. (This faile...



details:   https://anonhg.NetBSD.org/src/rev/5c4cb619d821
branches:  trunk
changeset: 766924:5c4cb619d821
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Mon Jul 04 09:29:37 2011 +0000

description:
Adjust the EEXIST-check once more. (This failed incorrectly in the Qemu-runs.)

diffstat:

 tests/syscall/t_mknod.c |  28 ++++++++++++++++++++--------
 1 files changed, 20 insertions(+), 8 deletions(-)

diffs (61 lines):

diff -r 0e938cda078e -r 5c4cb619d821 tests/syscall/t_mknod.c
--- a/tests/syscall/t_mknod.c   Mon Jul 04 08:19:51 2011 +0000
+++ b/tests/syscall/t_mknod.c   Mon Jul 04 09:29:37 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mknod.c,v 1.6 2011/07/04 04:10:34 jruoho Exp $ */
+/* $NetBSD: t_mknod.c,v 1.7 2011/07/04 09:29:37 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_mknod.c,v 1.6 2011/07/04 04:10:34 jruoho Exp $");
+__RCSID("$NetBSD: t_mknod.c,v 1.7 2011/07/04 09:29:37 jruoho Exp $");
 
 #include <sys/stat.h>
 
@@ -85,7 +85,7 @@
        (void)unlink(path);
 }
 
-ATF_TC(mknod_exist);
+ATF_TC_WITH_CLEANUP(mknod_exist);
 ATF_TC_HEAD(mknod_exist, tc)
 {
        atf_tc_set_md_var(tc, "descr", "Test EEXIST from mknod(2)");
@@ -96,16 +96,28 @@
 {
        int fd;
 
-       fd = open(_PATH_DEVNULL, O_RDONLY);
+       fd = open("/etc/passwd", O_RDONLY);
+
+       if (fd >= 0) {
 
-       if (fd < 0)
-               return;
-       else {
                (void)close(fd);
+
+               errno = 0;
+               ATF_REQUIRE_ERRNO(EEXIST,
+                   mknod("/etc/passwd", S_IFCHR, 0) == -1);
        }
 
+       ATF_REQUIRE(mknod(path, S_IFCHR, 0) == 0);
+
        errno = 0;
-       ATF_REQUIRE_ERRNO(EEXIST, mknod(_PATH_DEVNULL, S_IFCHR, 0) == -1);
+       ATF_REQUIRE_ERRNO(EEXIST, mknod(path, S_IFCHR, 0) == -1);
+
+       ATF_REQUIRE(unlink(path) == 0);
+}
+
+ATF_TC_CLEANUP(mknod_exist, tc)
+{
+       (void)unlink(path);
 }
 
 ATF_TC_WITH_CLEANUP(mknod_perm);



Home | Main Index | Thread Index | Old Index