1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-26 11:47:31 +00:00

Fix some TAP -> ATF conversion errors

- 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
This commit is contained in:
Enji Cooper 2015-11-09 06:16:38 +00:00
parent 7c49f4218a
commit 233193f1e6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=290571

View 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);