- Ignore EINVAL check with mknod(path, S_IFCHR, -1) as the testcase is always

executed on a non-devfs filesystem
- Expect mknod(path, S_IFREG, 0) to fail on FreeBSD

Submitted by: pho
Sponsored by: EMC / Isilon Storage Division
This commit is contained in:
Enji Cooper 2014-10-24 03:42:37 +00:00
parent 3ff2096995
commit 3638ce9c38
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=273572

View File

@ -58,8 +58,15 @@ ATF_TC_BODY(mknod_err, tc)
(void)memset(buf, 'x', sizeof(buf));
#ifndef __FreeBSD__
/*
* As of FreeBSD 6.0 device nodes may be created in regular file systems but
* such nodes cannot be used to access devices. As a result an invalid dev
* argument is unchecked.
*/
errno = 0;
ATF_REQUIRE_ERRNO(EINVAL, mknod(path, S_IFCHR, -1) == -1);
#endif
errno = 0;
ATF_REQUIRE_ERRNO(ENAMETOOLONG, mknod(buf, S_IFCHR, 0) == -1);
@ -166,6 +173,9 @@ ATF_TC_BODY(mknod_stat, tc)
(void)memset(&st, 0, sizeof(struct stat));
#ifdef __FreeBSD__
atf_tc_expect_fail("mknod does not allow S_IFREG");
#endif
ATF_REQUIRE(mknod(path, S_IFREG, 0) == 0);
ATF_REQUIRE(stat(path, &st) == 0);