Stress rump hyperentropy a little harder.

This commit is contained in:
riastradh 2017-04-16 18:24:23 +00:00
parent fa7f7f0ebb
commit 894367af71
1 changed files with 10 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_rnd.c,v 1.10 2017/01/13 21:30:41 christos Exp $ */
/* $NetBSD: t_rnd.c,v 1.11 2017/04/16 18:24:23 riastradh Exp $ */
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: t_rnd.c,v 1.10 2017/01/13 21:30:41 christos Exp $");
__RCSID("$NetBSD: t_rnd.c,v 1.11 2017/04/16 18:24:23 riastradh Exp $");
#include <sys/types.h>
#include <sys/fcntl.h>
@ -35,6 +35,7 @@ __RCSID("$NetBSD: t_rnd.c,v 1.10 2017/01/13 21:30:41 christos Exp $");
#include <sys/rndio.h>
#include <atf-c.h>
#include <unistd.h>
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
@ -98,10 +99,15 @@ ATF_TC_BODY(read_random, tc)
{
char buf[128];
int fd;
unsigned i;
rump_init();
RL(fd = rump_sys_open("/dev/random", O_RDONLY));
RL(rump_sys_read(fd, buf, sizeof(buf)));
for (i = 0; i < 1000; i++) {
alarm(2);
RL(fd = rump_sys_open("/dev/random", RUMP_O_RDONLY));
RL(rump_sys_read(fd, buf, sizeof(buf)));
RZ(rump_sys_close(fd));
}
}
ATF_TP_ADD_TCS(tp)