Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/kernel Test that reading /dev/random returns within a ...
details: https://anonhg.NetBSD.org/src/rev/f7b28246d847
branches: trunk
changeset: 345200:f7b28246d847
user: pooka <pooka%NetBSD.org@localhost>
date: Thu May 12 11:41:43 2016 +0000
description:
Test that reading /dev/random returns within a reasonable time.
diffstat:
tests/kernel/t_rnd.c | 23 +++++++++++++++++++++--
1 files changed, 21 insertions(+), 2 deletions(-)
diffs (48 lines):
diff -r 185f60e091bb -r f7b28246d847 tests/kernel/t_rnd.c
--- a/tests/kernel/t_rnd.c Thu May 12 10:55:03 2016 +0000
+++ b/tests/kernel/t_rnd.c Thu May 12 11:41:43 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_rnd.c,v 1.6 2015/04/13 22:24:34 riastradh Exp $ */
+/* $NetBSD: t_rnd.c,v 1.7 2016/05/12 11:41:43 pooka Exp $ */
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_rnd.c,v 1.6 2015/04/13 22:24:34 riastradh Exp $");
+__RCSID("$NetBSD: t_rnd.c,v 1.7 2016/05/12 11:41:43 pooka Exp $");
#include <sys/types.h>
#include <sys/fcntl.h>
@@ -86,10 +86,29 @@
ATF_REQUIRE_ERRNO(EINVAL, rump_sys_ioctl(fd, RNDADDDATA, &rd) == -1);
}
+ATF_TC(read_random);
+ATF_TC_HEAD(read_random, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "does reading /dev/random return "
+ "within reasonable time");
+ atf_tc_set_md_var(tc, "timeout", "10");
+}
+
+ATF_TC_BODY(read_random, tc)
+{
+ char buf[128];
+ int fd;
+
+ rump_init();
+ RL(fd = rump_sys_open("/dev/random", O_RDONLY));
+ RL(rump_sys_read(fd, buf, sizeof(buf)));
+}
+
ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, RNDADDDATA);
ATF_TP_ADD_TC(tp, RNDADDDATA2);
+ ATF_TP_ADD_TC(tp, read_random);
return atf_no_error();
}
Home |
Main Index |
Thread Index |
Old Index