1207753Smm# $NetBSD: t_statvfs.sh,v 1.4 2010/11/07 17:51:18 jmmv Exp $ 2207753Smm# 3207753Smm# Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc. 4207753Smm# All rights reserved. 5207753Smm# 6207753Smm# Redistribution and use in source and binary forms, with or without 7263285Sdelphij# modification, are permitted provided that the following conditions 8207753Smm# are met: 9213700Smm# 1. Redistributions of source code must retain the above copyright 10207753Smm# notice, this list of conditions and the following disclaimer. 11207753Smm# 2. Redistributions in binary form must reproduce the above copyright 12207753Smm# notice, this list of conditions and the following disclaimer in the 13207753Smm# documentation and/or other materials provided with the distribution. 14263285Sdelphij# 15207753Smm# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 16207753Smm# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17207753Smm# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18207753Smm# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19213700Smm# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20213700Smm# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21207753Smm# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22207753Smm# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23213700Smm# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24213700Smm# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25207753Smm# POSSIBILITY OF SUCH DAMAGE. 26207753Smm# 27207753Smm 28207753Smm# 29207753Smm# Verifies that the statvfs system call works properly (returning the 30207753Smm# correct values) over a tmpfs mount point. 31207753Smm# 32213700Smm 33213700Smmatf_test_case values 34213700Smmvalues_head() { 35213700Smm atf_set "descr" "Tests that statvfs(2) returns correct values" 36207753Smm atf_set "require.user" "root" 37213700Smm} 38213700Smmvalues_body() { 39207753Smm test_mount -o -s10M 40207753Smm 41207753Smm pagesize=$(sysctl hw.pagesize | cut -d ' ' -f 3) 42213700Smm eval $($(atf_get_srcdir)/h_tools statvfs .) 43213700Smm [ ${pagesize} -eq ${f_bsize} ] || \ 44213700Smm atf_fail "Invalid bsize" 45207753Smm [ $((${f_bsize} * ${f_blocks})) -ge $((10 * 1024 * 1024)) ] || \ 46207753Smm atf_file "bsize * blocks too small" 47207753Smm [ $((${f_bsize} * ${f_blocks})) -le \ 48207753Smm $((10 * 1024 * 1024 + ${pagesize})) ] || \ 49207753Smm atf_fail "bsize * blocks too big" 50207753Smm 51207753Smm test_unmount 52207753Smm} 53207753Smm 54207753Smmatf_init_test_cases() { 55207753Smm . $(atf_get_srcdir)/../h_funcs.subr 56207753Smm . $(atf_get_srcdir)/h_funcs.subr 57207753Smm 58207753Smm atf_add_test_case values 59213700Smm} 60207753Smm