Source-Changes-HG archive

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

[src/trunk]: src/tests/syscall Do not return for early failures; otherwise th...



details:   https://anonhg.NetBSD.org/src/rev/8b0d32690665
branches:  trunk
changeset: 764828:8b0d32690665
user:      njoly <njoly%NetBSD.org@localhost>
date:      Fri May 06 22:24:41 2011 +0000

description:
Do not return for early failures; otherwise the testcase will be
reported as passed, even if not really run.

diffstat:

 tests/syscall/t_mprotect.c |  12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diffs (40 lines):

diff -r 6d5c564722e6 -r 8b0d32690665 tests/syscall/t_mprotect.c
--- a/tests/syscall/t_mprotect.c        Fri May 06 21:51:19 2011 +0000
+++ b/tests/syscall/t_mprotect.c        Fri May 06 22:24:41 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mprotect.c,v 1.5 2011/05/06 21:51:19 njoly Exp $ */
+/* $NetBSD: t_mprotect.c,v 1.6 2011/05/06 22:24:41 njoly 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.5 2011/05/06 21:51:19 njoly Exp $");
+__RCSID("$NetBSD: t_mprotect.c,v 1.6 2011/05/06 22:24:41 njoly Exp $");
 
 #include <sys/param.h>
 #include <sys/mman.h>
@@ -116,9 +116,7 @@
        int fd;
 
        fd = open(path, O_RDONLY | O_CREAT);
-
-       if (fd < 0)
-               return;
+       ATF_REQUIRE(fd >= 0);
 
        /*
         * The call should fail with EACCES if we try to mark
@@ -241,9 +239,7 @@
         * to the page. This should generate a SIGSEGV.
         */
        map = mmap(NULL, page, PROT_WRITE|PROT_READ, MAP_ANON, -1, 0);
-
-       if (map == MAP_FAILED)
-               return;
+       ATF_REQUIRE(map != MAP_FAILED);
 
        ATF_REQUIRE(strlcpy(map, "XXX", 3) == 3);
        ATF_REQUIRE(mprotect(map, page, PROT_READ) == 0);



Home | Main Index | Thread Index | Old Index