Module Name:    src
Committed By:   pooka
Date:           Tue Sep  8 20:37:46 UTC 2009

Modified Files:
        src/distrib/sets/lists/tests: mi
        src/tests/kernel: Makefile
Added Files:
        src/tests/kernel: t_rnd.c

Log Message:
Add test case for PR kern/42020:

t_rnd (1/1): 1 test cases
    RNDADDDATA: Failed: Test case did not exit cleanly: Abort trap (core dumped)

Failed test cases:
    t_rnd:RNDADDDATA


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.1 -r1.2 src/tests/kernel/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/kernel/t_rnd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.47 src/distrib/sets/lists/tests/mi:1.48
--- src/distrib/sets/lists/tests/mi:1.47	Mon Sep  7 08:22:51 2009
+++ src/distrib/sets/lists/tests/mi	Tue Sep  8 20:37:46 2009
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.47 2009/09/07 08:22:51 he Exp $
+# $NetBSD: mi,v 1.48 2009/09/08 20:37:46 pooka Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -129,6 +129,7 @@
 ./usr/libdata/debug/usr/tests/kernel/t_pipe.debug			tests-kernel-tests	debug
 ./usr/libdata/debug/usr/tests/kernel/t_poll3w.debug			tests-kernel-tests	debug
 ./usr/libdata/debug/usr/tests/kernel/t_posix_fadvise.debug		tests-kernel-tests	debug
+./usr/libdata/debug/usr/tests/kernel/t_rnd.debug			tests-kernel-tests	debug
 ./usr/libdata/debug/usr/tests/kernel/t_time.debug			tests-kernel-tests	debug
 ./usr/libdata/debug/usr/tests/kernel/t_ucontext.debug			tests-kernel-tests	debug
 ./usr/libdata/debug/usr/tests/kernel/t_writev.debug			tests-kernel-tests	debug
@@ -838,6 +839,7 @@
 ./usr/tests/kernel/t_pipe			tests-kernel-tests
 ./usr/tests/kernel/t_poll3w			tests-kernel-tests
 ./usr/tests/kernel/t_posix_fadvise		tests-kernel-tests
+./usr/tests/kernel/t_rnd			tests-kernel-tests
 ./usr/tests/kernel/t_time			tests-kernel-tests
 ./usr/tests/kernel/t_ucontext			tests-kernel-tests
 ./usr/tests/kernel/t_umount			tests-kernel-tests

Index: src/tests/kernel/Makefile
diff -u src/tests/kernel/Makefile:1.1 src/tests/kernel/Makefile:1.2
--- src/tests/kernel/Makefile:1.1	Fri Feb 20 21:39:57 2009
+++ src/tests/kernel/Makefile	Tue Sep  8 20:37:45 2009
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1 2009/02/20 21:39:57 jmmv Exp $
+# $NetBSD: Makefile,v 1.2 2009/09/08 20:37:45 pooka Exp $
 
 NOMAN=		# defined
 
@@ -14,12 +14,15 @@
 TESTS_C+=	t_pipe
 TESTS_C+=	t_poll3w
 TESTS_C+=	t_posix_fadvise
+TESTS_C+=	t_rnd
 TESTS_C+=	t_time
 TESTS_C+=	t_ucontext
 TESTS_C+=	t_writev
 
 TESTS_SH=	t_umount
 
+LDADD.t_rnd+=  -lrumpvfs -lrumpdev_rnd -lrumpdev -lrump -lrumpuser -lpthread
+
 .PATH:			${NETBSDSRCDIR}/sys/kern
 TESTS_C+=		t_extent
 SRCS.t_extent=		t_extent.c subr_extent.c

Added files:

Index: src/tests/kernel/t_rnd.c
diff -u /dev/null src/tests/kernel/t_rnd.c:1.1
--- /dev/null	Tue Sep  8 20:37:46 2009
+++ src/tests/kernel/t_rnd.c	Tue Sep  8 20:37:45 2009
@@ -0,0 +1,72 @@
+/*	$NetBSD: t_rnd.c,v 1.1 2009/09/08 20:37:45 pooka Exp $	*/
+
+/*
+ * Copyright (c) 2009 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: t_rnd.c,v 1.1 2009/09/08 20:37:45 pooka Exp $");
+
+#include <sys/types.h>
+#include <sys/fcntl.h>
+#include <sys/ioctl.h>
+#include <sys/rnd.h>
+
+#include <atf-c.h>
+
+#include <rump/rump.h>
+#include <rump/rump_syscalls.h>
+
+#include "../h_macros.h"
+
+ATF_TC(RNDADDDATA);
+ATF_TC_HEAD(RNDADDDATA, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "checks ioctl(RNDADDDATA)");
+}
+
+/* Adapted from example provided by Juho Salminen in PR kern/42020 */
+ATF_TC_BODY(RNDADDDATA, tc)
+{
+	rnddata_t rd;
+	int fd;
+
+	rump_init();
+	fd = rump_sys_open("/dev/random", O_RDWR, 0);
+	if (fd == -1)
+		atf_tc_fail_errno("cannot open /dev/random");
+		
+	rd.entropy = 1;
+	rd.len = 1;
+	if (rump_sys_ioctl(fd, RNDADDDATA, &rd) == -1)
+		atf_tc_fail_errno("RNDADDDATA");
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+	ATF_TP_ADD_TC(tp, RNDADDDATA);
+
+	return atf_no_error();
+}

Reply via email to