1 1.3 jruoho # $NetBSD: quotas_common.sh,v 1.3 2012/03/18 09:31:50 jruoho Exp $ 2 1.3 jruoho 3 1.3 jruoho # Copyright (c) 2011 Manuel Bouyer 4 1.3 jruoho # All rights reserved. 5 1.3 jruoho # 6 1.3 jruoho # Redistribution and use in source and binary forms, with or without 7 1.3 jruoho # modification, are permitted provided that the following conditions 8 1.3 jruoho # are met: 9 1.3 jruoho # 1. Redistributions of source code must retain the above copyright 10 1.3 jruoho # notice, this list of conditions and the following disclaimer. 11 1.3 jruoho # 2. Redistributions in binary form must reproduce the above copyright 12 1.3 jruoho # notice, this list of conditions and the following disclaimer in the 13 1.3 jruoho # documentation and/or other materials provided with the distribution. 14 1.3 jruoho # 15 1.3 jruoho # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 16 1.3 jruoho # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 1.3 jruoho # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 1.3 jruoho # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19 1.3 jruoho # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 1.3 jruoho # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 1.3 jruoho # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 1.3 jruoho # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 1.3 jruoho # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 1.3 jruoho # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 1.3 jruoho # POSSIBILITY OF SUCH DAMAGE. 26 1.3 jruoho # 27 1.2 bouyer 28 1.2 bouyer create_with_quotas() 29 1.2 bouyer { 30 1.2 bouyer local endian=$1; shift 31 1.2 bouyer local vers=$1; shift 32 1.2 bouyer local type=$1; shift 33 1.2 bouyer local op; 34 1.2 bouyer if [ ${type} = "both" ]; then 35 1.2 bouyer op="-q user -q group" 36 1.2 bouyer else 37 1.2 bouyer op="-q ${type}" 38 1.2 bouyer fi 39 1.2 bouyer atf_check -o ignore -e ignore newfs ${op} \ 40 1.2 bouyer -B ${endian} -O ${vers} -s 4000 -F ${IMG} 41 1.2 bouyer } 42 1.2 bouyer 43 1.2 bouyer # from tests/ipf/h_common.sh via tests/sbin/resize_ffs 44 1.2 bouyer test_case() 45 1.2 bouyer { 46 1.2 bouyer local name="${1}"; shift 47 1.2 bouyer local check_function="${1}"; shift 48 1.2 bouyer local descr="${1}"; shift 49 1.3 jruoho 50 1.2 bouyer atf_test_case "${name}" 51 1.2 bouyer 52 1.2 bouyer eval "${name}_head() { \ 53 1.2 bouyer atf_set "descr" "Checks ${descr} quotas inodes" 54 1.2 bouyer }" 55 1.2 bouyer eval "${name}_body() { \ 56 1.2 bouyer ${check_function} " "${@}" "; \ 57 1.2 bouyer }" 58 1.2 bouyer tests="${tests} ${name}" 59 1.2 bouyer } 60 1.2 bouyer 61 1.2 bouyer atf_init_test_cases() 62 1.2 bouyer { 63 1.2 bouyer IMG=fsimage 64 1.2 bouyer DIR=target 65 1.2 bouyer for i in ${tests}; do 66 1.2 bouyer atf_add_test_case $i 67 1.2 bouyer done 68 1.2 bouyer } 69