]> xenbits.xensource.com Git - people/liuw/freebsd.git/commitdiff
Fix some TAP -> ATF conversion errors
authorngie <ngie@FreeBSD.org>
Mon, 9 Nov 2015 06:16:38 +0000 (06:16 +0000)
committerngie <ngie@FreeBSD.org>
Mon, 9 Nov 2015 06:16:38 +0000 (06:16 +0000)
- Remove a leftover printf from when this was a TAP based testcase
- Catch mmap failures properly

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division

lib/libc/tests/gen/arc4random_test.c

index ec82c3272d2a422d6c0052d267f7b19ddfbeded7..a28db303e88c77ab55ceb8dbeac1a2aa97df4a9f 100644 (file)
@@ -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);