diff --git a/tests/randomtest/Makefile b/tests/randomtest/Makefile new file mode 100644 index 0000000..2755131 --- /dev/null +++ b/tests/randomtest/Makefile @@ -0,0 +1,5 @@ +PROG= randomtest + +RUMPLIBS= -lrumpvfs -lrumpdev_rnd -lrumpdev -lrumpuser + +.include diff --git a/tests/randomtest/randomtest.c b/tests/randomtest/randomtest.c new file mode 100644 index 0000000..74f6f96 --- /dev/null +++ b/tests/randomtest/randomtest.c @@ -0,0 +1,28 @@ +#include "common.c" + +#include + +#include +#include + +int +main() +{ + unsigned i; + int fd; + unsigned char buf[32]; + ssize_t nread; + + rump_init(); + for (i = 0; i < 10000; i++) { + (void)alarm(2); + if ((fd = rump_sys_open("/dev/random", RUMP_O_RDONLY)) == -1) + die("open /dev/random"); + if ((nread = rump_sys_read(fd, buf, sizeof buf)) == -1) + die("read"); + (void)rump_sys_close(fd); + } + rump_sys_reboot(0, NULL); + + return 0; +} diff --git a/tests/testrump.sh b/tests/testrump.sh index 12269e3..9af9fd1 100644 --- a/tests/testrump.sh +++ b/tests/testrump.sh @@ -108,9 +108,20 @@ dodynamic () fi } +dorandomtest () +{ + + printf 'Random number generation ... ' + if ./randomtest; then + echo done + else + die failed: $? + fi +} + ALLTESTS="init fstest fstest_img simpleclient nettest_simple nettest_simple6 nettest_routed nettest_routed6 - dynamic" + dynamic randomtest" alltests () {