svn commit: r273945 - head/contrib/netbsd-tests/lib/libc/sys

Garrett Cooper ngie at FreeBSD.org
Sat Nov 1 20:45:46 UTC 2014


Author: ngie
Date: Sat Nov  1 20:45:45 2014
New Revision: 273945
URL: https://svnweb.freebsd.org/changeset/base/273945

Log:
  Port t_mincore to FreeBSD
  
  Mark :mincore_resid as atf_tc_expect_fail on FreeBSD because of new bug
  discovered in running the tests (it succeeded from earlier on in the year to
  September/October on FreeBSD, at least)
  
  Submitted by: pho

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_mincore.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mincore.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libc/sys/t_mincore.c	Sat Nov  1 20:41:47 2014	(r273944)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_mincore.c	Sat Nov  1 20:45:45 2014	(r273945)
@@ -74,6 +74,10 @@ __RCSID("$NetBSD: t_mincore.c,v 1.8 2012
 #include <unistd.h>
 #include <sys/resource.h>
 
+#ifdef __FreeBSD__
+#include <sys/stat.h>
+#endif
+
 static long		page = 0;
 static const char	path[] = "mincore";
 static size_t		check_residency(void *, size_t);
@@ -121,8 +125,10 @@ ATF_TC_BODY(mincore_err, tc)
 	ATF_REQUIRE(vec != NULL);
 	ATF_REQUIRE(map != MAP_FAILED);
 
+#ifdef __NetBSD__
 	errno = 0;
 	ATF_REQUIRE_ERRNO(EINVAL, mincore(map, 0, vec) == -1);
+#endif
 
 	errno = 0;
 	ATF_REQUIRE_ERRNO(ENOMEM, mincore(0, page, vec) == -1);
@@ -187,13 +193,24 @@ ATF_TC_BODY(mincore_resid, tc)
 
 	npgs = 128;
 
+#ifdef __FreeBSD__
+	addr = mmap(NULL, npgs * page, PROT_READ | PROT_WRITE,
+	    MAP_ANON | MAP_PRIVATE, -1, (off_t)0);
+#else
 	addr = mmap(NULL, npgs * page, PROT_READ | PROT_WRITE,
 	    MAP_ANON | MAP_PRIVATE | MAP_WIRED, -1, (off_t)0);
+#endif
 
 	if (addr == MAP_FAILED)
 		atf_tc_skip("could not mmap wired anonymous test area, system "
 		    "might be low on memory");
 
+#ifdef __FreeBSD__
+	atf_tc_expect_fail("the following calls fail; this seems to be a new "
+	    "issue (didn't occur in 07/2014)");
+
+	ATF_REQUIRE(mlock(addr, npgs * page) == 0);
+#endif
 	ATF_REQUIRE(check_residency(addr, npgs) == npgs);
 	ATF_REQUIRE(munmap(addr, npgs * page) == 0);
 
@@ -238,12 +255,16 @@ ATF_TC_BODY(mincore_resid, tc)
 	(void)munlockall();
 
 	ATF_REQUIRE(madvise(addr2, npgs * page, MADV_FREE) == 0);
+#ifdef __NetBSD__
 	ATF_REQUIRE(check_residency(addr2, npgs) == 0);
+#endif
 
 	(void)memset(addr, 0, npgs * page);
 
 	ATF_REQUIRE(madvise(addr, npgs * page, MADV_FREE) == 0);
+#ifdef __NetBSD__
 	ATF_REQUIRE(check_residency(addr, npgs) == 0);
+#endif
 
 	(void)munmap(addr, npgs * page);
 	(void)munmap(addr2, npgs * page);


More information about the svn-src-head mailing list