11.6Smartin#	$NetBSD: t_zpool.sh,v 1.6 2020/03/15 20:10:26 martin Exp $
21.1Spooka#
31.1Spooka# Copyright (c) 2011 The NetBSD Foundation, Inc.
41.1Spooka# All rights reserved.
51.1Spooka#
61.1Spooka# Redistribution and use in source and binary forms, with or without
71.1Spooka# modification, are permitted provided that the following conditions
81.1Spooka# are met:
91.1Spooka# 1. Redistributions of source code must retain the above copyright
101.1Spooka#    notice, this list of conditions and the following disclaimer.
111.1Spooka# 2. Redistributions in binary form must reproduce the above copyright
121.1Spooka#    notice, this list of conditions and the following disclaimer in the
131.1Spooka#    documentation and/or other materials provided with the distribution.
141.1Spooka#
151.1Spooka# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
161.1Spooka# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
171.1Spooka# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
181.1Spooka# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
191.1Spooka# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
201.1Spooka# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
211.1Spooka# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
221.1Spooka# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
231.1Spooka# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
241.1Spooka# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
251.1Spooka# POSSIBILITY OF SUCH DAMAGE.
261.1Spooka#
271.1Spooka
281.5Shannkenserver='rump_server -lrumpvfs -lrumpdev_disk -lrumpkern_solaris -lrumpfs_zfs -lrumpdev -lrumpdev_rnd -d key=/dk,hostpath=zfs.img,size=100m'
291.1Spooka
301.1Spookaexport RUMP_SERVER=unix://zsuck
311.1Spooka
321.1Spookaatf_test_case create cleanup
331.1Spookacreate_head()
341.1Spooka{
351.1Spooka	atf_set "descr" "basic zpool create"
361.1Spooka}
371.1Spooka
381.1SpookaIFS=' '
391.1Spookaexmount='rumpfs on / type rumpfs (local)
401.1Spookajippo on /jippo type zfs (local)
411.1Spooka'
421.1Spooka
431.1Spookacreate_body()
441.1Spooka{
451.1Spooka
461.6Smartin	AVAIL=$( df -m ${TMPDIR} | awk '{if (int($4) > 0) print $4}' )
471.6Smartin	if [ $AVAIL -lt 65 ]; then
481.6Smartin		atf_skip "not enough free space in working directory"
491.6Smartin	fi
501.6Smartin
511.1Spooka	atf_check -s exit:0 -o ignore -e ignore ${server} ${RUMP_SERVER}
521.1Spooka
531.1Spooka	export LD_PRELOAD=/usr/lib/librumphijack.so
541.4Shannken	export RUMPHIJACK=blanket=/dev/zfs:/dk:/jippo,sysctl=yes,modctl=yes
551.1Spooka	atf_check -s exit:0 zpool create jippo /dk
561.1Spooka
571.1Spooka	export RUMPHIJACK=vfs=all
581.1Spooka	atf_check -s exit:0 -o inline:"${exmount}" mount
591.1Spooka}
601.1Spooka
611.1Spookacreate_cleanup()
621.1Spooka{
631.1Spooka
641.1Spooka	rump.halt
651.1Spooka}
661.1Spooka
671.1Spookaatf_init_test_cases()
681.1Spooka{
691.1Spooka
701.1Spooka	atf_add_test_case create
711.1Spooka}
72