Home | History | Annotate | Line # | Download | only in newfs
quotas_common.sh revision 1.2.4.1
      1  1.2.4.1    yamt # $NetBSD: quotas_common.sh,v 1.2.4.1 2012/04/17 00:09:15 yamt Exp $
      2  1.2.4.1    yamt 
      3  1.2.4.1    yamt #  Copyright (c) 2011 Manuel Bouyer
      4  1.2.4.1    yamt #  All rights reserved.
      5  1.2.4.1    yamt #
      6  1.2.4.1    yamt #  Redistribution and use in source and binary forms, with or without
      7  1.2.4.1    yamt #  modification, are permitted provided that the following conditions
      8  1.2.4.1    yamt #  are met:
      9  1.2.4.1    yamt #  1. Redistributions of source code must retain the above copyright
     10  1.2.4.1    yamt #     notice, this list of conditions and the following disclaimer.
     11  1.2.4.1    yamt #  2. Redistributions in binary form must reproduce the above copyright
     12  1.2.4.1    yamt #     notice, this list of conditions and the following disclaimer in the
     13  1.2.4.1    yamt #     documentation and/or other materials provided with the distribution.
     14  1.2.4.1    yamt #
     15  1.2.4.1    yamt #  THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     16  1.2.4.1    yamt #  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     17  1.2.4.1    yamt #  TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     18  1.2.4.1    yamt #  PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     19  1.2.4.1    yamt #  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     20  1.2.4.1    yamt #  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     21  1.2.4.1    yamt #  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     22  1.2.4.1    yamt #  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     23  1.2.4.1    yamt #  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     24  1.2.4.1    yamt #  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     25  1.2.4.1    yamt #  POSSIBILITY OF SUCH DAMAGE.
     26  1.2.4.1    yamt #
     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.2.4.1    yamt 
     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