Module Name:    src
Committed By:   pooka
Date:           Tue Nov 23 15:38:54 UTC 2010

Modified Files:
        src/distrib/sets/lists/tests: mi
        src/etc/mtree: NetBSD.dist.base
        src/tests/dev: Makefile
Added Files:
        src/tests/dev/md: Atffile Makefile h_mdserv.c t_md.sh

Log Message:
Add simple test for md(4) which just stuffs junk into /dev/rmd0d
and checks the same data can be retrieved.


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.61 -r1.62 src/etc/mtree/NetBSD.dist.base
cvs rdiff -u -r1.4 -r1.5 src/tests/dev/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/dev/md/Atffile src/tests/dev/md/Makefile \
    src/tests/dev/md/h_mdserv.c src/tests/dev/md/t_md.sh

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.158 src/distrib/sets/lists/tests/mi:1.159
--- src/distrib/sets/lists/tests/mi:1.158	Fri Nov 19 18:18:54 2010
+++ src/distrib/sets/lists/tests/mi	Tue Nov 23 15:38:53 2010
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.158 2010/11/19 18:18:54 njoly Exp $
+# $NetBSD: mi,v 1.159 2010/11/23 15:38:53 pooka Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -218,6 +218,8 @@
 ./usr/libdata/debug/usr/tests/dev/cgd					tests-fs-debug
 ./usr/libdata/debug/usr/tests/dev/cgd/h_img2cgd					tests-fs-debug
 ./usr/libdata/debug/usr/tests/dev/cgd/h_img2cgd/h_img2cgd.debug			tests-fs-debug		debug,atf
+./usr/libdata/debug/usr/tests/dev/md					tests-fs-debug
+./usr/libdata/debug/usr/tests/dev/md/h_mdserv.debug					tests-fs-debug
 ./usr/libdata/debug/usr/tests/dev/scsipi					tests-fs-debug
 ./usr/libdata/debug/usr/tests/dev/scsipi/t_cd.debug			tests-fs-debug		debug,atf
 ./usr/libdata/debug/usr/tests/dev/sysmon					tests-fs-debug
@@ -1026,6 +1028,10 @@
 ./usr/tests/dev/cgd/h_img2cgd				tests-fs-tests
 ./usr/tests/dev/cgd/h_img2cgd/h_img2cgd			tests-fs-tests		atf
 ./usr/tests/dev/cgd/h_img2cgd/cgd.conf			tests-fs-tests		atf
+./usr/tests/dev/md				tests-fs-tests
+./usr/tests/dev/md/Atffile			tests-fs-tests		atf
+./usr/tests/dev/md/h_mdserv			tests-fs-tests		atf
+./usr/tests/dev/md/t_md			tests-fs-tests		atf
 ./usr/tests/dev/scsipi				tests-fs-tests
 ./usr/tests/dev/scsipi/Atffile			tests-fs-tests		atf
 ./usr/tests/dev/scsipi/t_cd			tests-fs-tests		atf

Index: src/etc/mtree/NetBSD.dist.base
diff -u src/etc/mtree/NetBSD.dist.base:1.61 src/etc/mtree/NetBSD.dist.base:1.62
--- src/etc/mtree/NetBSD.dist.base:1.61	Thu Nov 11 22:48:47 2010
+++ src/etc/mtree/NetBSD.dist.base	Tue Nov 23 15:38:53 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.base,v 1.61 2010/11/11 22:48:47 pooka Exp $
+#	$NetBSD: NetBSD.dist.base,v 1.62 2010/11/23 15:38:53 pooka Exp $
 #	@(#)4.4BSD.dist	8.1 (Berkeley) 6/13/93
 
 # Do not customize this file as it may be overwritten on upgrades.
@@ -210,6 +210,7 @@
 ./usr/libdata/debug/usr/tests/dev/audio
 ./usr/libdata/debug/usr/tests/dev/cgd
 ./usr/libdata/debug/usr/tests/dev/cgd/h_img2cgd
+./usr/libdata/debug/usr/tests/dev/md
 ./usr/libdata/debug/usr/tests/dev/scsipi
 ./usr/libdata/debug/usr/tests/dev/sysmon
 ./usr/libdata/debug/usr/tests/fs
@@ -1149,6 +1150,7 @@
 ./usr/tests/dev/audio
 ./usr/tests/dev/cgd
 ./usr/tests/dev/cgd/h_img2cgd
+./usr/tests/dev/md
 ./usr/tests/dev/scsipi
 ./usr/tests/dev/sysmon
 ./usr/tests/fs

Index: src/tests/dev/Makefile
diff -u src/tests/dev/Makefile:1.4 src/tests/dev/Makefile:1.5
--- src/tests/dev/Makefile:1.4	Thu Nov 11 22:38:46 2010
+++ src/tests/dev/Makefile	Tue Nov 23 15:38:54 2010
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.4 2010/11/11 22:38:46 pooka Exp $
+#	$NetBSD: Makefile,v 1.5 2010/11/23 15:38:54 pooka Exp $
 #
 
 .include <bsd.own.mk>
 
 TESTSDIR=	${TESTSBASE}/dev
 
-TESTS_SUBDIRS+=	audio cgd scsipi sysmon
+TESTS_SUBDIRS+=	audio cgd md scsipi sysmon
 
 .include <bsd.test.mk>

Added files:

Index: src/tests/dev/md/Atffile
diff -u /dev/null src/tests/dev/md/Atffile:1.1
--- /dev/null	Tue Nov 23 15:38:54 2010
+++ src/tests/dev/md/Atffile	Tue Nov 23 15:38:54 2010
@@ -0,0 +1,6 @@
+Content-Type: application/X-atf-atffile; version="1"
+X-NetBSD-Id: "$NetBSD: Atffile,v 1.1 2010/11/23 15:38:54 pooka Exp $"
+
+prop: test-suite = "NetBSD"
+
+tp-glob: t_*
Index: src/tests/dev/md/Makefile
diff -u /dev/null src/tests/dev/md/Makefile:1.1
--- /dev/null	Tue Nov 23 15:38:54 2010
+++ src/tests/dev/md/Makefile	Tue Nov 23 15:38:54 2010
@@ -0,0 +1,23 @@
+#	$NetBSD: Makefile,v 1.1 2010/11/23 15:38:54 pooka Exp $
+#
+
+.include <bsd.own.mk>
+
+TESTSDIR=	${TESTSBASE}/dev/md
+FILESDIR=	${TESTSDIR}
+
+TESTS_SH=	t_md
+TESTS_C=	h_mdserv
+
+ATFFILE=	yes
+
+LDADD+=	-lrumpdev_md -lrumpdev_disk -lrumpdev -lrumpvfs
+LDADD+=	-lrump
+LDADD+=	-lrumpuser
+LDADD+=	-lrump
+LDADD+=	-lpthread
+
+WARNS=	4
+NOMAN=
+
+.include <bsd.test.mk>
Index: src/tests/dev/md/h_mdserv.c
diff -u /dev/null src/tests/dev/md/h_mdserv.c:1.1
--- /dev/null	Tue Nov 23 15:38:54 2010
+++ src/tests/dev/md/h_mdserv.c	Tue Nov 23 15:38:54 2010
@@ -0,0 +1,33 @@
+/*	$NetBSD: h_mdserv.c,v 1.1 2010/11/23 15:38:54 pooka Exp $	*/
+
+#include <sys/types.h>
+#include <sys/mman.h>
+#include <sys/ioctl.h>
+
+#include <dev/md.h>
+
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <rump/rump.h>
+#include <rump/rump_syscalls.h>
+
+#include "../../h_macros.h"
+
+#define MDSIZE (1024*1024)
+
+int
+main(void)
+{
+	struct md_conf md;
+	int fd;
+
+	md.md_addr = malloc(MDSIZE);
+	md.md_size = MDSIZE;
+	md.md_type = MD_UMEM_SERVER;
+
+	RL(rump_init());
+	RL(fd = rump_sys_open("/dev/rmd0d", O_RDWR));
+	RL(rump_sys_ioctl(fd, MD_SETCONF, &md));
+	pause();
+}
Index: src/tests/dev/md/t_md.sh
diff -u /dev/null src/tests/dev/md/t_md.sh:1.1
--- /dev/null	Tue Nov 23 15:38:54 2010
+++ src/tests/dev/md/t_md.sh	Tue Nov 23 15:38:54 2010
@@ -0,0 +1,53 @@
+#	$NetBSD: t_md.sh,v 1.1 2010/11/23 15:38:54 pooka Exp $
+#
+# Copyright (c) 2010 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.
+#
+
+atf_test_case basic
+basic()
+{
+
+	atf_set "descr" "Check that md can be created, read and written"
+}
+
+basic_body()
+{
+
+	RUMPSOCK=unix://commsock
+	env RUMP_SP_SERVER=${RUMPSOCK} $(atf_get_srcdir)/h_mdserv &
+
+	sleep 1 # XXX: wait for server to start
+
+	export RUMP_SP_CLIENT=${RUMPSOCK}
+	atf_check -s exit:0 -e ignore dd if=/bin/ls rof=/dev/rmd0d seek=100 count=10
+	atf_check -s exit:0 -e ignore dd of=testfile rif=/dev/rmd0d skip=100 count=10
+	atf_check -s exit:0 -e ignore -o file:testfile dd if=/bin/ls count=10
+}
+
+atf_init_test_cases()
+{
+
+	atf_add_test_case basic
+}

Reply via email to