Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Nov 2015 20:30:54 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r290881 - stable/10/lib/libc/tests/gen
Message-ID:  <201511152030.tAFKUsYB090021@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Sun Nov 15 20:30:54 2015
New Revision: 290881
URL: https://svnweb.freebsd.org/changeset/base/290881

Log:
  MFC r290571:
  
  Fix some TAP -> ATF conversion errors
  
  - Remove a leftover printf from when this was a TAP based testcase
  - Catch mmap failures properly
  
  Sponsored by: EMC / Isilon Storage Division

Modified:
  stable/10/lib/libc/tests/gen/arc4random_test.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/tests/gen/arc4random_test.c
==============================================================================
--- stable/10/lib/libc/tests/gen/arc4random_test.c	Sun Nov 15 20:25:26 2015	(r290880)
+++ stable/10/lib/libc/tests/gen/arc4random_test.c	Sun Nov 15 20:30:54 2015	(r290881)
@@ -30,10 +30,12 @@ __FBSDID("$FreeBSD$");
 #include <sys/types.h>
 #include <sys/mman.h>
 #include <sys/wait.h>
+#include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+
 #include <atf-c.h>
 
 /*
@@ -56,14 +58,9 @@ ATF_TC_BODY(test_arc4random, tc)
 	pid_t pid;
 	char c;
 
-	printf("1..1\n");
-
 	page = mmap(NULL, sizeof(struct shared_page), PROT_READ | PROT_WRITE,
 		    MAP_ANON | MAP_SHARED, -1, 0);
-	if (page == MAP_FAILED) {
-		printf("fail 1 - mmap\n");
-		exit(1);
-	}
+	ATF_REQUIRE_MSG(page != MAP_FAILED, "mmap failed; errno=%d", errno);
 
 	arc4random_buf(&c, 1);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201511152030.tAFKUsYB090021>