Home | History | Annotate | Line # | Download | only in fsck_ffs
quotas_common.sh revision 1.2
      1  1.2  bouyer # $NetBSD: quotas_common.sh,v 1.2 2011/03/06 17:08:41 bouyer Exp $ 
      2  1.2  bouyer 
      3  1.2  bouyer create_with_quotas()
      4  1.2  bouyer {
      5  1.2  bouyer 	local endian=$1; shift
      6  1.2  bouyer 	local vers=$1; shift
      7  1.2  bouyer 	local uid=$(id -u)
      8  1.2  bouyer 	local gid=$(id -g)
      9  1.2  bouyer 
     10  1.2  bouyer 	atf_check -o ignore -e ignore newfs -B ${endian} -O ${vers} \
     11  1.2  bouyer 		-s 4000 -F ${IMG}
     12  1.2  bouyer 	atf_check -o ignore -e ignore tunefs -q user -q group -F ${IMG}
     13  1.2  bouyer 	atf_check -s exit:0 -o 'match:NO USER QUOTA INODE \(CREATED\)' \
     14  1.2  bouyer 	    -o 'match:USER QUOTA MISMATCH FOR ID '${uid}': 0/0 SHOULD BE 1/1' \
     15  1.2  bouyer 	    -o 'match:GROUP QUOTA MISMATCH FOR ID '${gid}': 0/0 SHOULD BE 1/1' \
     16  1.2  bouyer 	    fsck_ffs -p -F ${IMG}
     17  1.2  bouyer }
     18  1.2  bouyer 
     19  1.2  bouyer # from tests/ipf/h_common.sh via tests/sbin/resize_ffs
     20  1.2  bouyer test_case()
     21  1.2  bouyer {
     22  1.2  bouyer 	local name="${1}"; shift
     23  1.2  bouyer 	local check_function="${1}"; shift
     24  1.2  bouyer 	local descr="${1}"; shift
     25  1.2  bouyer 	
     26  1.2  bouyer 	atf_test_case "${name}"
     27  1.2  bouyer 
     28  1.2  bouyer 	eval "${name}_head() { \
     29  1.2  bouyer 		atf_set "descr" "Checks ${descr} quotas inodes"
     30  1.2  bouyer 	}"
     31  1.2  bouyer 	eval "${name}_body() { \
     32  1.2  bouyer 		${check_function} " "${@}" "; \
     33  1.2  bouyer 	}"
     34  1.2  bouyer 	tests="${tests} ${name}"
     35  1.2  bouyer }
     36  1.2  bouyer 
     37  1.2  bouyer atf_init_test_cases()
     38  1.2  bouyer {
     39  1.2  bouyer 	IMG=fsimage
     40  1.2  bouyer 	DIR=target
     41  1.2  bouyer 	for i in ${tests}; do
     42  1.2  bouyer 		atf_add_test_case $i
     43  1.2  bouyer 	done
     44  1.2  bouyer }
     45