t_md.sh revision 272458
1262629Sdelphij# $NetBSD: t_md.sh,v 1.7 2011/05/14 17:42:28 jmmv Exp $ 250276Speter# 3262629Sdelphij# Copyright (c) 2010 The NetBSD Foundation, Inc. 450276Speter# All rights reserved. 550276Speter# 650276Speter# Redistribution and use in source and binary forms, with or without 750276Speter# modification, are permitted provided that the following conditions 850276Speter# are met: 950276Speter# 1. Redistributions of source code must retain the above copyright 1050276Speter# notice, this list of conditions and the following disclaimer. 1150276Speter# 2. Redistributions in binary form must reproduce the above copyright 1250276Speter# notice, this list of conditions and the following disclaimer in the 1350276Speter# documentation and/or other materials provided with the distribution. 1450276Speter# 1550276Speter# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 1650276Speter# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 1750276Speter# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 1850276Speter# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 1950276Speter# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2050276Speter# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2150276Speter# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2250276Speter# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2350276Speter# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2450276Speter# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2550276Speter# POSSIBILITY OF SUCH DAMAGE. 2650276Speter# 2750276Speter 2850276Speterrawpart=`sysctl -n kern.rawpartition | tr '01234' 'abcde'` 2950276Speterrawmd=/dev/rmd0${rawpart} 30174993Srafan 3150276Speteratf_test_case basic cleanup 3250276Speterbasic_head() 3350276Speter{ 3450276Speter 35262629Sdelphij atf_set "descr" "Check that md can be created, read and written" 36262629Sdelphij} 37262629Sdelphij 38262629Sdelphijbasic_body() 39262629Sdelphij{ 40262629Sdelphij 41262629Sdelphij # Scope out raw part. This is actually the *host* raw partition, 42262629Sdelphij # but just let it slide for now, since they *should* be the same. 43262629Sdelphij rawpart=`sysctl -n kern.rawpartition | tr '01234' 'abcde'` 44262629Sdelphij 45262629Sdelphij atf_check -s exit:0 $(atf_get_srcdir)/h_mdserv ${rawmd} 46262629Sdelphij 47262629Sdelphij export RUMP_SERVER=unix://commsock 48262629Sdelphij atf_check -s exit:0 -e ignore -x \ 49262629Sdelphij "dd if=/bin/ls count=10 | rump.dd of=${rawmd} seek=100" 5050276Speter atf_check -s exit:0 -e ignore -x \ 51174993Srafan "rump.dd if=${rawmd} skip=100 count=10 | dd of=testfile" 52 atf_check -s exit:0 -e ignore -o file:testfile dd if=/bin/ls count=10 53} 54 55basic_cleanup() 56{ 57 58 env RUMP_SERVER=unix://commsock rump.halt 59} 60 61atf_init_test_cases() 62{ 63 64 atf_add_test_case basic 65} 66