Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Add test case for PR kern/42020:



details:   https://anonhg.NetBSD.org/src/rev/1bd8e8f4d134
branches:  trunk
changeset: 747298:1bd8e8f4d134
user:      pooka <pooka%NetBSD.org@localhost>
date:      Tue Sep 08 20:37:45 2009 +0000

description:
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

diffstat:

 distrib/sets/lists/tests/mi |   4 +-
 tests/kernel/Makefile       |   5 ++-
 tests/kernel/t_rnd.c        |  72 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 79 insertions(+), 2 deletions(-)

diffs (126 lines):

diff -r a72edfe356cd -r 1bd8e8f4d134 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Tue Sep 08 20:34:47 2009 +0000
+++ b/distrib/sets/lists/tests/mi       Tue Sep 08 20:37:45 2009 +0000
@@ -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
diff -r a72edfe356cd -r 1bd8e8f4d134 tests/kernel/Makefile
--- a/tests/kernel/Makefile     Tue Sep 08 20:34:47 2009 +0000
+++ b/tests/kernel/Makefile     Tue Sep 08 20:37:45 2009 +0000
@@ -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
diff -r a72edfe356cd -r 1bd8e8f4d134 tests/kernel/t_rnd.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/kernel/t_rnd.c      Tue Sep 08 20:37:45 2009 +0000
@@ -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();
+}



Home | Main Index | Thread Index | Old Index