Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/syscall For granularity, split the EEXIST-check to a s...
details: https://anonhg.NetBSD.org/src/rev/1d9fc9983156
branches: trunk
changeset: 766916:1d9fc9983156
user: jruoho <jruoho%NetBSD.org@localhost>
date: Mon Jul 04 04:10:34 2011 +0000
description:
For granularity, split the EEXIST-check to a separate test case.
It appears that yet another bug was caught.
diffstat:
tests/syscall/t_mknod.c | 40 ++++++++++++++++++++++++++--------------
1 files changed, 26 insertions(+), 14 deletions(-)
diffs (82 lines):
diff -r c6d4f20169f8 -r 1d9fc9983156 tests/syscall/t_mknod.c
--- a/tests/syscall/t_mknod.c Mon Jul 04 03:52:11 2011 +0000
+++ b/tests/syscall/t_mknod.c Mon Jul 04 04:10:34 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mknod.c,v 1.5 2011/07/04 03:52:11 jruoho Exp $ */
+/* $NetBSD: t_mknod.c,v 1.6 2011/07/04 04:10:34 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.5 2011/07/04 03:52:11 jruoho Exp $");
+__RCSID("$NetBSD: t_mknod.c,v 1.6 2011/07/04 04:10:34 jruoho Exp $");
#include <sys/stat.h>
@@ -54,7 +54,6 @@
ATF_TC_BODY(mknod_err, tc)
{
char buf[PATH_MAX + 1];
- int fd;
(void)memset(buf, 'x', sizeof(buf));
@@ -79,17 +78,6 @@
errno = 0;
ATF_REQUIRE_ERRNO(ENOENT, mknod("/a/b/c/d/e/f/g", S_IFCHR, 0) == -1);
-
- fd = open(_PATH_DEVNULL, O_RDONLY);
-
- if (fd >= 0) {
-
- errno = 0;
- ATF_REQUIRE_ERRNO(EEXIST,
- mknod(_PATH_DEVNULL, S_IFCHR, 0) == -1);
-
- (void)close(fd);
- }
}
ATF_TC_CLEANUP(mknod_err, tc)
@@ -97,6 +85,29 @@
(void)unlink(path);
}
+ATF_TC(mknod_exist);
+ATF_TC_HEAD(mknod_exist, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Test EEXIST from mknod(2)");
+ atf_tc_set_md_var(tc, "require.user", "root");
+}
+
+ATF_TC_BODY(mknod_exist, tc)
+{
+ int fd;
+
+ fd = open(_PATH_DEVNULL, O_RDONLY);
+
+ if (fd < 0)
+ return;
+ else {
+ (void)close(fd);
+ }
+
+ errno = 0;
+ ATF_REQUIRE_ERRNO(EEXIST, mknod(_PATH_DEVNULL, S_IFCHR, 0) == -1);
+}
+
ATF_TC_WITH_CLEANUP(mknod_perm);
ATF_TC_HEAD(mknod_perm, tc)
{
@@ -170,6 +181,7 @@
{
ATF_TP_ADD_TC(tp, mknod_err);
+ ATF_TP_ADD_TC(tp, mknod_exist);
ATF_TP_ADD_TC(tp, mknod_perm);
ATF_TP_ADD_TC(tp, mknod_stat);
Home |
Main Index |
Thread Index |
Old Index