Module Name:    src
Committed By:   jym
Date:           Wed Jul 20 22:53:44 UTC 2011

Modified Files:
        src/tests/lib/libc/sys: t_mprotect.c

Log Message:
Modify exec test to be more resilient regarding partial exec protection:
skip test instead of returning a failure that could be misinterpreted.

Suggested by Jukka in private mail.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/sys/t_mprotect.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/sys/t_mprotect.c
diff -u src/tests/lib/libc/sys/t_mprotect.c:1.2 src/tests/lib/libc/sys/t_mprotect.c:1.3
--- src/tests/lib/libc/sys/t_mprotect.c:1.2	Mon Jul 18 23:16:11 2011
+++ src/tests/lib/libc/sys/t_mprotect.c	Wed Jul 20 22:53:44 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mprotect.c,v 1.2 2011/07/18 23:16:11 jym Exp $ */
+/* $NetBSD: t_mprotect.c,v 1.3 2011/07/20 22:53:44 jym Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_mprotect.c,v 1.2 2011/07/18 23:16:11 jym Exp $");
+__RCSID("$NetBSD: t_mprotect.c,v 1.3 2011/07/20 22:53:44 jym Exp $");
 
 #include <sys/param.h>
 #include <sys/mman.h>
@@ -224,21 +224,23 @@
 
 	(void)wait(&sta);
 
+	ATF_REQUIRE(munmap(map, page) == 0);
+
 	ATF_REQUIRE(WIFEXITED(sta) != 0);
 
 	switch (xp_support) {
 	case PARTIAL_XP:
-		/* Partial protection might fail: indicate it */
-		ATF_CHECK_MSG(WEXITSTATUS(sta) == SIGSEGV,
-		    "Host only supports partial executable space protection");
+		/* Partial protection might fail; skip the test when it does */
+		if (WEXITSTATUS(sta) != SIGSEGV) {
+			atf_tc_skip("Host only supports "
+			    "partial executable space protection");
+		}
 		break;
 	case PERPAGE_XP: default:
 		/* Per-page --x protection should not fail */
 		ATF_REQUIRE(WEXITSTATUS(sta) == SIGSEGV);
 		break;
 	}
-
-	ATF_REQUIRE(munmap(map, page) == 0);
 }
 
 ATF_TC(mprotect_pax);

Reply via email to