Source-Changes-HG archive

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

[src/trunk]: src/tests/lib/libc/sys Modify exec test to be more resilient reg...



details:   https://anonhg.NetBSD.org/src/rev/264d958aee07
branches:  trunk
changeset: 767528:264d958aee07
user:      jym <jym%NetBSD.org@localhost>
date:      Wed Jul 20 22:53:44 2011 +0000

description:
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.

diffstat:

 tests/lib/libc/sys/t_mprotect.c |  16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diffs (47 lines):

diff -r aa6c93c81f3f -r 264d958aee07 tests/lib/libc/sys/t_mprotect.c
--- a/tests/lib/libc/sys/t_mprotect.c   Wed Jul 20 22:53:38 2011 +0000
+++ b/tests/lib/libc/sys/t_mprotect.c   Wed Jul 20 22:53:44 2011 +0000
@@ -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);



Home | Main Index | Thread Index | Old Index