Importing NetBSD "Kyua" test framework
To do so, a few dependencies have been imported: * external/bsd/lutok * external/mit/lua * external/public-domain/sqlite * external/public-domain/xz The Kyua framework is the new generation of ATF (Automated Test Framework), it is composed of: * external/bsd/atf * external/bsd/kyua-atf-compat * external/bsd/kyua-cli * external/bsd/kyua-tester * tests Kyua/ATF being written in C++, it depends on libstdc++ which is provided by GCC. As this is not part of the sources, Kyua is only compiled when the native GCC utils are installed. To install Kyua do the following: * In a cross-build enviromnent, add the following to the build.sh commandline: -V MKBINUTILS=yes -V MKGCCCMDS=yes WARNING: At this point the import is still experimental, and not supported on native builds (a.k.a make build). Change-Id: I26aee23c5bbd2d64adcb7c1beb98fe0d479d7ada
This commit is contained in:
10
tests/sbin/Makefile
Normal file
10
tests/sbin/Makefile
Normal file
@@ -0,0 +1,10 @@
|
||||
# $NetBSD: Makefile,v 1.6 2012/07/28 16:08:40 njoly Exp $
|
||||
#
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
TESTSDIR= ${TESTSBASE}/sbin
|
||||
|
||||
TESTS_SUBDIRS+= fsck_ffs ifconfig newfs newfs_msdos resize_ffs route sysctl
|
||||
|
||||
.include <bsd.test.mk>
|
||||
1
tests/sbin/Makefile.inc
Normal file
1
tests/sbin/Makefile.inc
Normal file
@@ -0,0 +1 @@
|
||||
.include "../Makefile.inc"
|
||||
12
tests/sbin/fsck_ffs/Makefile
Normal file
12
tests/sbin/fsck_ffs/Makefile
Normal file
@@ -0,0 +1,12 @@
|
||||
# $NetBSD: Makefile,v 1.2 2011/03/06 17:08:41 bouyer Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
TESTSDIR= ${TESTSBASE}/sbin/fsck_ffs
|
||||
|
||||
.for name in t_enable_quotas t_check_quotas
|
||||
TESTS_SH+= ${name}
|
||||
TESTS_SH_SRC_${name}= quotas_common.sh ${name}.sh
|
||||
.endfor
|
||||
|
||||
.include <bsd.test.mk>
|
||||
44
tests/sbin/fsck_ffs/quotas_common.sh
Normal file
44
tests/sbin/fsck_ffs/quotas_common.sh
Normal file
@@ -0,0 +1,44 @@
|
||||
# $NetBSD: quotas_common.sh,v 1.2 2011/03/06 17:08:41 bouyer Exp $
|
||||
|
||||
create_with_quotas()
|
||||
{
|
||||
local endian=$1; shift
|
||||
local vers=$1; shift
|
||||
local uid=$(id -u)
|
||||
local gid=$(id -g)
|
||||
|
||||
atf_check -o ignore -e ignore newfs -B ${endian} -O ${vers} \
|
||||
-s 4000 -F ${IMG}
|
||||
atf_check -o ignore -e ignore tunefs -q user -q group -F ${IMG}
|
||||
atf_check -s exit:0 -o 'match:NO USER QUOTA INODE \(CREATED\)' \
|
||||
-o 'match:USER QUOTA MISMATCH FOR ID '${uid}': 0/0 SHOULD BE 1/1' \
|
||||
-o 'match:GROUP QUOTA MISMATCH FOR ID '${gid}': 0/0 SHOULD BE 1/1' \
|
||||
fsck_ffs -p -F ${IMG}
|
||||
}
|
||||
|
||||
# from tests/ipf/h_common.sh via tests/sbin/resize_ffs
|
||||
test_case()
|
||||
{
|
||||
local name="${1}"; shift
|
||||
local check_function="${1}"; shift
|
||||
local descr="${1}"; shift
|
||||
|
||||
atf_test_case "${name}"
|
||||
|
||||
eval "${name}_head() { \
|
||||
atf_set "descr" "Checks ${descr} quotas inodes"
|
||||
}"
|
||||
eval "${name}_body() { \
|
||||
${check_function} " "${@}" "; \
|
||||
}"
|
||||
tests="${tests} ${name}"
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
IMG=fsimage
|
||||
DIR=target
|
||||
for i in ${tests}; do
|
||||
atf_add_test_case $i
|
||||
done
|
||||
}
|
||||
73
tests/sbin/fsck_ffs/t_check_quotas.sh
Normal file
73
tests/sbin/fsck_ffs/t_check_quotas.sh
Normal file
@@ -0,0 +1,73 @@
|
||||
# $NetBSD: t_check_quotas.sh,v 1.2 2011/03/06 17:08:41 bouyer Exp $
|
||||
#
|
||||
# Copyright (c) 2011 Manuel Bouyer
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
for e in le be; do
|
||||
for v in 1 2; do
|
||||
test_case corrupt_list_${e}_${v} corrupt_list \
|
||||
"recovery of corrupted free list in" ${e} ${v}
|
||||
test_case expand1_list_${e}_${v} expand_list \
|
||||
"allocation of direct block in" 40 ${e} ${v}
|
||||
test_case expand2_list_${e}_${v} expand_list \
|
||||
"allocation of indirect block in" 1000 ${e} ${v}
|
||||
done
|
||||
done
|
||||
|
||||
corrupt_list()
|
||||
{
|
||||
create_with_quotas $*
|
||||
local blkno=$(printf "inode 3\nblks\n" | /sbin/fsdb -nF -f ${IMG} | awk '$1 == "0:" {print $2}')
|
||||
blkno=$(($blkno * 512 + 104))
|
||||
#clear the free list
|
||||
atf_check -o ignore -e ignore dd if=/dev/zero of=${IMG} bs=1 \
|
||||
count=8 seek=${blkno} conv=notrunc
|
||||
atf_check -s exit:0 \
|
||||
-o "match:QUOTA ENTRY NOT IN LIST \(FIXED\)" \
|
||||
fsck_ffs -fp -F ${IMG}
|
||||
atf_check -s exit:0 -o "match:3 files" fsck_ffs -nf -F ${IMG}
|
||||
}
|
||||
|
||||
expand_list()
|
||||
{
|
||||
local nuid=$1; shift
|
||||
local expected_files=$((nuid + 2))
|
||||
echo "/set uid=0 gid=0" > spec
|
||||
echo ". type=dir mode=0755" >> spec
|
||||
mkdir ${DIR}
|
||||
for i in $(seq ${nuid}); do
|
||||
touch ${DIR}/f${i}
|
||||
echo "./f$i type=file mode=0600 uid=$i gid=$i" >> spec
|
||||
done
|
||||
|
||||
atf_check -o ignore -e ignore makefs -B $1 -o version=$2 \
|
||||
-F spec -s 4000b ${IMG} ${DIR}
|
||||
atf_check -o ignore -e ignore tunefs -q user -F ${IMG}
|
||||
atf_check -s exit:0 -o 'match:NO USER QUOTA INODE \(CREATED\)' \
|
||||
-o 'match:USER QUOTA MISMATCH FOR ID 10: 0/0 SHOULD BE 0/1' \
|
||||
fsck_ffs -p -F ${IMG}
|
||||
atf_check -s exit:0 -o "match:${expected_files} files" \
|
||||
fsck_ffs -nf -F ${IMG}
|
||||
}
|
||||
105
tests/sbin/fsck_ffs/t_enable_quotas.sh
Normal file
105
tests/sbin/fsck_ffs/t_enable_quotas.sh
Normal file
@@ -0,0 +1,105 @@
|
||||
# $NetBSD: t_enable_quotas.sh,v 1.2 2011/03/06 17:08:41 bouyer Exp $
|
||||
#
|
||||
# Copyright (c) 2011 Manuel Bouyer
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
for e in le be; do
|
||||
for v in 1 2; do
|
||||
test_case disable_${e}_${v} disable_quotas "creation/removal of" ${e} ${v}
|
||||
test_case corrupt_${e}_${v} corrupt_quotas "repair of corrupted" ${e} ${v}
|
||||
test_case unallocated_${e}_${v} unallocated_quotas \
|
||||
"recovery of unallocated" ${e} ${v}
|
||||
test_case dir1_${e}_${v} dir1_quotas \
|
||||
"successfull clear of wrong type of" ${e} ${v}
|
||||
test_case notreg_${e}_${v} notreg_quotas \
|
||||
"successfull clear of wrong type of" ${e} ${v}
|
||||
done
|
||||
done
|
||||
|
||||
disable_quotas()
|
||||
{
|
||||
create_with_quotas $*
|
||||
|
||||
# check that the quota inode creation didn't corrupt the filesystem
|
||||
atf_check -s exit:0 -o "match:already clean" -o "match:3 files" \
|
||||
fsck_ffs -nf -F ${IMG}
|
||||
#now check fsck can properly clear the quota inode when quota flags are
|
||||
# cleared
|
||||
atf_check -o ignore -e ignore tunefs -q nouser -q nogroup -F ${IMG}
|
||||
atf_check -s exit:0 -o "match:SUPERBLOCK QUOTA FLAG CLEARED" \
|
||||
fsck_ffs -fp -F ${IMG}
|
||||
atf_check -s exit:0 -o "match:1 files, 1 used" fsck_ffs -nf -F ${IMG}
|
||||
}
|
||||
|
||||
corrupt_quotas()
|
||||
{
|
||||
create_with_quotas $*
|
||||
|
||||
local blkno=$(printf "inode 3\nblks\n" | /sbin/fsdb -nF -f ${IMG} | awk '$1 == "0:" {print $2}')
|
||||
atf_check -o ignore -e ignore dd if=/dev/zero of=${IMG} bs=512 \
|
||||
count=1 seek=${blkno} conv=notrunc
|
||||
atf_check -s exit:0 \
|
||||
-o "match:CORRUPTED USER QUOTA INODE 3 \(CLEARED\)" \
|
||||
-o "match:NO USER QUOTA INODE \(CREATED\)" \
|
||||
fsck_ffs -fp -F ${IMG}
|
||||
atf_check -s exit:0 -o "match:3 files" fsck_ffs -nf -F ${IMG}
|
||||
}
|
||||
|
||||
unallocated_quotas()
|
||||
{
|
||||
create_with_quotas $*
|
||||
|
||||
atf_check -o ignore -e ignore clri ${IMG} 3
|
||||
atf_check -s exit:0 \
|
||||
-o "match:UNALLOCATED USER QUOTA INODE 3 \(CLEARED\)" \
|
||||
-o "match:NO USER QUOTA INODE \(CREATED\)" \
|
||||
fsck_ffs -fp -F ${IMG}
|
||||
atf_check -s exit:0 -o "match:3 files" fsck_ffs -nf -F ${IMG}
|
||||
}
|
||||
|
||||
dir1_quotas()
|
||||
{
|
||||
create_with_quotas $*
|
||||
|
||||
atf_check -s exit:255 -o ignore -e ignore -x \
|
||||
"printf 'inode 3\nchtype dir\nexit\n' | fsdb -F -f ${IMG}"
|
||||
atf_check -s exit:0 \
|
||||
-o "match:DIR I=3 CONNECTED. PARENT WAS I=0" \
|
||||
-o "match:USER QUOTA INODE 3 IS A DIRECTORY" \
|
||||
fsck_ffs -y -F ${IMG}
|
||||
}
|
||||
|
||||
notreg_quotas()
|
||||
{
|
||||
create_with_quotas $*
|
||||
|
||||
atf_check -s exit:255 -o ignore -e ignore -x \
|
||||
"printf 'inode 3\nchtype fifo\nexit\n' | fsdb -F -f ${IMG}"
|
||||
atf_check -s exit:0 \
|
||||
-o "match:WRONG TYPE 4096 for USER QUOTA INODE 3 \(CLEARED\)" \
|
||||
-o "match:NO USER QUOTA INODE \(CREATED\)" \
|
||||
fsck_ffs -p -F ${IMG}
|
||||
atf_check -s exit:0 -o "match:3 files" fsck_ffs -nf -F ${IMG}
|
||||
}
|
||||
9
tests/sbin/ifconfig/Makefile
Normal file
9
tests/sbin/ifconfig/Makefile
Normal file
@@ -0,0 +1,9 @@
|
||||
# $NetBSD: Makefile,v 1.1 2011/05/03 06:13:06 jruoho Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
TESTSDIR= ${TESTSBASE}/sbin/ifconfig
|
||||
|
||||
TESTS_SH= t_nonexistent
|
||||
|
||||
.include <bsd.test.mk>
|
||||
45
tests/sbin/ifconfig/t_nonexistent.sh
Normal file
45
tests/sbin/ifconfig/t_nonexistent.sh
Normal file
@@ -0,0 +1,45 @@
|
||||
# $NetBSD: t_nonexistent.sh,v 1.4 2012/03/18 09:46:50 jruoho Exp $
|
||||
#
|
||||
# Copyright (c) 2011 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This code is derived from software contributed to The NetBSD Foundation
|
||||
# by Jukka Ruohonen.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
atf_test_case nonexistent
|
||||
nonexistent_head() {
|
||||
atf_set "descr" "Check ifconfig(8) with " \
|
||||
"a nonexistent interface (PR bin/43141)"
|
||||
}
|
||||
|
||||
nonexistent_body() {
|
||||
|
||||
atf_check -s not-exit:0 -e ignore \
|
||||
ifconfig nonexistent0 1.2.3.4/24
|
||||
}
|
||||
|
||||
atf_init_test_cases() {
|
||||
atf_add_test_case nonexistent
|
||||
}
|
||||
12
tests/sbin/newfs/Makefile
Normal file
12
tests/sbin/newfs/Makefile
Normal file
@@ -0,0 +1,12 @@
|
||||
# $NetBSD: Makefile,v 1.2 2011/03/06 17:08:41 bouyer Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
TESTSDIR= ${TESTSBASE}/sbin/newfs
|
||||
|
||||
.for name in t_enable_quotas
|
||||
TESTS_SH+= ${name}
|
||||
TESTS_SH_SRC_${name}= quotas_common.sh ${name}.sh
|
||||
.endfor
|
||||
|
||||
.include <bsd.test.mk>
|
||||
68
tests/sbin/newfs/quotas_common.sh
Normal file
68
tests/sbin/newfs/quotas_common.sh
Normal file
@@ -0,0 +1,68 @@
|
||||
# $NetBSD: quotas_common.sh,v 1.3 2012/03/18 09:31:50 jruoho Exp $
|
||||
|
||||
# Copyright (c) 2011 Manuel Bouyer
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
create_with_quotas()
|
||||
{
|
||||
local endian=$1; shift
|
||||
local vers=$1; shift
|
||||
local type=$1; shift
|
||||
local op;
|
||||
if [ ${type} = "both" ]; then
|
||||
op="-q user -q group"
|
||||
else
|
||||
op="-q ${type}"
|
||||
fi
|
||||
atf_check -o ignore -e ignore newfs ${op} \
|
||||
-B ${endian} -O ${vers} -s 4000 -F ${IMG}
|
||||
}
|
||||
|
||||
# from tests/ipf/h_common.sh via tests/sbin/resize_ffs
|
||||
test_case()
|
||||
{
|
||||
local name="${1}"; shift
|
||||
local check_function="${1}"; shift
|
||||
local descr="${1}"; shift
|
||||
|
||||
atf_test_case "${name}"
|
||||
|
||||
eval "${name}_head() { \
|
||||
atf_set "descr" "Checks ${descr} quotas inodes"
|
||||
}"
|
||||
eval "${name}_body() { \
|
||||
${check_function} " "${@}" "; \
|
||||
}"
|
||||
tests="${tests} ${name}"
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
IMG=fsimage
|
||||
DIR=target
|
||||
for i in ${tests}; do
|
||||
atf_add_test_case $i
|
||||
done
|
||||
}
|
||||
57
tests/sbin/newfs/t_enable_quotas.sh
Normal file
57
tests/sbin/newfs/t_enable_quotas.sh
Normal file
@@ -0,0 +1,57 @@
|
||||
# $NetBSD: t_enable_quotas.sh,v 1.3 2012/03/18 09:31:50 jruoho Exp $
|
||||
#
|
||||
# Copyright (c) 2011 Manuel Bouyer
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
for e in le be; do
|
||||
for v in 1 2; do
|
||||
for q in "user" "group"; do
|
||||
test_case enabled_${e}_${v}_${q} quota_enabled_single \
|
||||
"creation of" ${e} ${v} ${q}
|
||||
done
|
||||
test_case enabled_${e}_${v}_"both" quota_enabled_both \
|
||||
"creation of" ${e} ${v} "both"
|
||||
done
|
||||
done
|
||||
|
||||
quota_enabled_single()
|
||||
{
|
||||
create_with_quotas $*
|
||||
|
||||
# check that the quota inode creation didn't corrupt the filesystem
|
||||
atf_check -s exit:0 -o "match:already clean" -o "match:2 files" \
|
||||
-o "match:Phase 6 - Check Quotas" \
|
||||
fsck_ffs -nf -F ${IMG}
|
||||
}
|
||||
|
||||
quota_enabled_both()
|
||||
{
|
||||
create_with_quotas $*
|
||||
|
||||
# check that the quota inode creation didn't corrupt the filesystem
|
||||
atf_check -s exit:0 -o "match:already clean" -o "match:3 files" \
|
||||
-o "match:Phase 6 - Check Quotas" \
|
||||
fsck_ffs -nf -F ${IMG}
|
||||
}
|
||||
9
tests/sbin/newfs_msdos/Makefile
Normal file
9
tests/sbin/newfs_msdos/Makefile
Normal file
@@ -0,0 +1,9 @@
|
||||
# $NetBSD: Makefile,v 1.1 2012/07/28 16:08:40 njoly Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
TESTSDIR= ${TESTSBASE}/sbin/newfs_msdos
|
||||
|
||||
TESTS_SH= t_create
|
||||
|
||||
.include <bsd.test.mk>
|
||||
44
tests/sbin/newfs_msdos/t_create.sh
Normal file
44
tests/sbin/newfs_msdos/t_create.sh
Normal file
@@ -0,0 +1,44 @@
|
||||
# $NetBSD: t_create.sh,v 1.2 2012/09/06 12:51:47 njoly Exp $
|
||||
#
|
||||
# Copyright (c) 2012 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
atf_test_case validfat32
|
||||
validfat32_head() {
|
||||
atf_set "descr" "Verifies that fat32 created filesystems are valid"
|
||||
}
|
||||
validfat32_body() {
|
||||
|
||||
atf_check -s eq:0 -o ignore -e ignore \
|
||||
newfs_msdos -b 512 -C 33m -F 32 msdos.img
|
||||
atf_expect_fail "PR bin/46743"
|
||||
atf_check -s eq:0 -o not-match:FIXED -e empty fsck_msdos -p msdos.img
|
||||
atf_expect_pass
|
||||
}
|
||||
|
||||
|
||||
atf_init_test_cases() {
|
||||
atf_add_test_case validfat32
|
||||
}
|
||||
16
tests/sbin/resize_ffs/Makefile
Normal file
16
tests/sbin/resize_ffs/Makefile
Normal file
@@ -0,0 +1,16 @@
|
||||
# $NetBSD: Makefile,v 1.3 2011/01/05 02:25:27 riz Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
TESTSDIR= ${TESTSBASE}/sbin/resize_ffs
|
||||
|
||||
.for name in t_grow t_shrink t_grow_swapped t_shrink_swapped
|
||||
TESTS_SH+= ${name}
|
||||
TESTS_SH_SRC_${name}= common.sh ${name}.sh
|
||||
.endfor
|
||||
|
||||
FILESDIR= ${TESTSDIR}
|
||||
FILES= testdata.tar.gz.base64
|
||||
FILES+= testdata.md5
|
||||
|
||||
.include <bsd.test.mk>
|
||||
159
tests/sbin/resize_ffs/common.sh
Normal file
159
tests/sbin/resize_ffs/common.sh
Normal file
@@ -0,0 +1,159 @@
|
||||
|
||||
# Common settings and functions for the various resize_ffs tests.
|
||||
#
|
||||
|
||||
# called from atf_init_test_cases
|
||||
setupvars()
|
||||
{
|
||||
IMG=fsimage
|
||||
TDBASE64=$(atf_get_srcdir)/testdata.tar.gz.base64
|
||||
GOODMD5=$(atf_get_srcdir)/testdata.md5
|
||||
# set BYTESWAP to opposite-endian.
|
||||
if [ $(sysctl -n hw.byteorder) = "1234" ]; then
|
||||
BYTESWAP=be
|
||||
else
|
||||
BYTESWAP=le
|
||||
fi
|
||||
}
|
||||
|
||||
# test_case() taken from the tests/ipf/h_common.sh
|
||||
# Used to declare the atf goop for a test.
|
||||
test_case()
|
||||
{
|
||||
local name="${1}"; shift
|
||||
local check_function="${1}"; shift
|
||||
|
||||
atf_test_case "${name}" cleanup
|
||||
eval "${name}_head() { \
|
||||
atf_set "require.user" "root" ; \
|
||||
atf_set "require.progs" "rump_ffs" ; \
|
||||
}"
|
||||
eval "${name}_body() { \
|
||||
${check_function} " "${@}" "; \
|
||||
}"
|
||||
eval "${name}_cleanup() { \
|
||||
umount -f mnt ; \
|
||||
: reset error ; \
|
||||
}"
|
||||
}
|
||||
|
||||
# Used to declare the atf goop for a test expected to fail.
|
||||
test_case_xfail()
|
||||
{
|
||||
local name="${1}"; shift
|
||||
local reason="${1}"; shift
|
||||
local check_function="${1}"; shift
|
||||
|
||||
atf_test_case "${name}" cleanup
|
||||
eval "${name}_head() { \
|
||||
atf_set "require.user" "root" ; \
|
||||
}"
|
||||
eval "${name}_body() { \
|
||||
atf_expect_fail "${reason}" ; \
|
||||
${check_function} " "${@}" "; \
|
||||
}"
|
||||
eval "${name}_cleanup() { \
|
||||
umount -f mnt ; \
|
||||
: reset error ; \
|
||||
}"
|
||||
}
|
||||
|
||||
# copy_data requires the mount already done; makes one copy of the test data
|
||||
copy_data ()
|
||||
{
|
||||
uudecode -p ${TDBASE64} | (cd mnt; tar xzf - -s/testdata/TD$1/)
|
||||
}
|
||||
|
||||
copy_multiple ()
|
||||
{
|
||||
local i
|
||||
for i in $(seq $1); do
|
||||
copy_data $i
|
||||
done
|
||||
}
|
||||
|
||||
# remove_data removes one directory worth of test data; the purpose
|
||||
# is to ensure data exists near the end of the fs under test.
|
||||
remove_data ()
|
||||
{
|
||||
rm -rf mnt/TD$1
|
||||
}
|
||||
|
||||
remove_multiple ()
|
||||
{
|
||||
local i
|
||||
for i in $(seq $1); do
|
||||
remove_data $i
|
||||
done
|
||||
}
|
||||
|
||||
# verify that the data in a particular directory is still OK
|
||||
# generated md5 file doesn't need explicit cleanup thanks to ATF
|
||||
check_data ()
|
||||
{
|
||||
(cd mnt/TD$1 && md5 *) > TD$1.md5
|
||||
atf_check diff -u ${GOODMD5} TD$1.md5
|
||||
}
|
||||
|
||||
# supply begin and end arguments
|
||||
check_data_range ()
|
||||
{
|
||||
local i
|
||||
for i in $(seq $1 $2); do
|
||||
check_data $i
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
resize_ffs()
|
||||
{
|
||||
echo "in resize_ffs:" ${@}
|
||||
local bs=$1
|
||||
local fragsz=$2
|
||||
local osize=$3
|
||||
local nsize=$4
|
||||
local fslevel=$5
|
||||
local numdata=$6
|
||||
local swap=$7
|
||||
mkdir -p mnt
|
||||
echo "bs is ${bs} numdata is ${numdata}"
|
||||
echo "****resizing fs with blocksize ${bs}"
|
||||
|
||||
# we want no more than 16K/inode to allow test files to copy.
|
||||
local fpi=$((fragsz * 4))
|
||||
local i
|
||||
if [ $fpi -gt 16384 ]; then
|
||||
i="-i 16384"
|
||||
fi
|
||||
if [ x$swap != x ]; then
|
||||
newfs -B ${BYTESWAP} -O${fslevel} -b ${bs} -f ${fragsz} \
|
||||
-s ${osize} ${i} -F ${IMG}
|
||||
else
|
||||
newfs -O${fslevel} -b ${bs} -f ${fragsz} -s ${osize} ${i} \
|
||||
-F ${IMG}
|
||||
fi
|
||||
|
||||
# we're specifying relative paths, so rump_ffs warns - ignore.
|
||||
atf_check -s exit:0 -e ignore rump_ffs ${IMG} mnt
|
||||
copy_multiple ${numdata}
|
||||
|
||||
if [ ${nsize} -lt ${osize} ]; then
|
||||
# how much data to remove so fs can be shrunk
|
||||
local remove=$((numdata-numdata*nsize/osize))
|
||||
local dataleft=$((numdata-remove))
|
||||
echo remove is $remove dataleft is $dataleft
|
||||
remove_multiple ${remove}
|
||||
fi
|
||||
|
||||
umount mnt
|
||||
atf_check -s exit:0 -o ignore resize_ffs -y -s ${nsize} ${IMG}
|
||||
atf_check -s exit:0 -o ignore fsck_ffs -f -n -F ${IMG}
|
||||
atf_check -s exit:0 -e ignore rump_ffs ${IMG} mnt
|
||||
if [ ${nsize} -lt ${osize} ]; then
|
||||
check_data_range $((remove + 1)) ${numdata}
|
||||
else
|
||||
# checking everything because we don't delete on grow
|
||||
check_data_range 1 ${numdata}
|
||||
fi
|
||||
umount mnt
|
||||
}
|
||||
221
tests/sbin/resize_ffs/t_grow.sh
Normal file
221
tests/sbin/resize_ffs/t_grow.sh
Normal file
@@ -0,0 +1,221 @@
|
||||
# $NetBSD: t_grow.sh,v 1.8 2011/01/11 00:50:02 riz Exp $
|
||||
#
|
||||
# Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This code is derived from software contributed to The NetBSD Foundation
|
||||
# by Jeffrey C. Rizzo.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
|
||||
# resize_ffs params as follows:
|
||||
# resize_ffs blocksize fragsize fssize newfssize level numdata swap
|
||||
# where 'numdata' is the number of data directories to copy - this is
|
||||
# determined manually based on the maximum number that will fit in the
|
||||
# created fs. 'level' is the fs-level (-O 0,1,2) passed to newfs.
|
||||
# If 'swap' is included, byteswap the fs
|
||||
|
||||
# v0 == newfs -O0 (4.3BSD layout, ffsv1 superblock)
|
||||
test_case grow_16M_v0_4096 resize_ffs 4096 512 32768 131072 0 28
|
||||
test_case grow_16M_v0_8192 resize_ffs 8192 1024 32768 131072 0 28
|
||||
test_case grow_16M_v0_16384 resize_ffs 16384 2048 32768 131072 0 29
|
||||
test_case grow_16M_v0_32768 resize_ffs 32768 4096 32768 131072 0 28
|
||||
test_case grow_16M_v0_65536 resize_ffs 65536 8192 32768 131072 0 26
|
||||
# these grow_24M grow a smaller amount; sometimes there's different issues
|
||||
test_case grow_24M_v0_4096 resize_ffs 4096 512 49152 65536 0 41
|
||||
test_case grow_24M_v0_8192 resize_ffs 8192 1024 49152 65536 0 42
|
||||
test_case grow_24M_v0_16384 resize_ffs 16384 2048 49152 65536 0 43
|
||||
test_case grow_24M_v0_32768 resize_ffs 32768 4096 49152 65536 0 42
|
||||
test_case grow_24M_v0_65536 resize_ffs 65536 8192 49152 65536 0 38
|
||||
test_case grow_32M_v0_4096 resize_ffs 4096 512 65536 131072 0 55
|
||||
test_case grow_32M_v0_8192 resize_ffs 8192 1024 65536 131072 0 56
|
||||
test_case grow_32M_v0_16384 resize_ffs 16384 2048 65536 131072 0 58
|
||||
test_case grow_32M_v0_32768 resize_ffs 32768 4096 65536 131072 0 56
|
||||
test_case grow_32M_v0_65536 resize_ffs 65536 8192 65536 131072 0 51
|
||||
test_case grow_48M_v0_4096 resize_ffs 4096 512 98304 131072 0 82
|
||||
test_case grow_48M_v0_8192 resize_ffs 8192 1024 98304 131072 0 84
|
||||
test_case grow_48M_v0_16384 resize_ffs 16384 2048 98304 131072 0 87
|
||||
test_case grow_48M_v0_32768 resize_ffs 32768 4096 98304 131072 0 83
|
||||
test_case grow_48M_v0_65536 resize_ffs 65536 8192 98304 131072 0 76
|
||||
test_case grow_64M_v0_4096 resize_ffs 4096 512 131072 262144 0 109
|
||||
test_case grow_64M_v0_8192 resize_ffs 8192 1024 131072 262144 0 111
|
||||
test_case grow_64M_v0_16384 resize_ffs 16384 2048 131072 262144 0 115
|
||||
test_case grow_64M_v0_32768 resize_ffs 32768 4096 131072 262144 0 111
|
||||
test_case grow_64M_v0_65536 resize_ffs 65536 8192 131072 262144 0 101
|
||||
|
||||
# v1 == newfs -O1 (FFSv1, v2 superblock layout)
|
||||
test_case grow_16M_v1_4096 resize_ffs 4096 512 32768 131072 1 28
|
||||
test_case grow_16M_v1_8192 resize_ffs 8192 1024 32768 131072 1 28
|
||||
test_case grow_16M_v1_16384 resize_ffs 16384 2048 32768 131072 1 29
|
||||
test_case grow_16M_v1_32768 resize_ffs 32768 4096 32768 131072 1 28
|
||||
test_case grow_16M_v1_65536 resize_ffs 65536 8192 32768 131072 1 26
|
||||
# these grow_24M grow a smaller amount; sometimes there's different issues
|
||||
test_case grow_24M_v1_4096 resize_ffs 4096 512 49152 65536 1 41
|
||||
test_case grow_24M_v1_8192 resize_ffs 8192 1024 49152 65536 1 42
|
||||
test_case grow_24M_v1_16384 resize_ffs 16384 2048 49152 65536 1 43
|
||||
test_case grow_24M_v1_32768 resize_ffs 32768 4096 49152 65536 1 42
|
||||
test_case grow_24M_v1_65536 resize_ffs 65536 8192 49152 65536 1 38
|
||||
test_case grow_32M_v1_4096 resize_ffs 4096 512 65536 131072 1 55
|
||||
test_case grow_32M_v1_8192 resize_ffs 8192 1024 65536 131072 1 56
|
||||
test_case grow_32M_v1_16384 resize_ffs 16384 2048 65536 131072 1 58
|
||||
test_case grow_32M_v1_32768 resize_ffs 32768 4096 65536 131072 1 56
|
||||
test_case grow_32M_v1_65536 resize_ffs 65536 8192 65536 131072 1 51
|
||||
test_case grow_48M_v1_4096 resize_ffs 4096 512 98304 131072 1 82
|
||||
test_case grow_48M_v1_8192 resize_ffs 8192 1024 98304 131072 1 84
|
||||
test_case grow_48M_v1_16384 resize_ffs 16384 2048 98304 131072 1 87
|
||||
test_case grow_48M_v1_32768 resize_ffs 32768 4096 98304 131072 1 83
|
||||
test_case grow_48M_v1_65536 resize_ffs 65536 8192 98304 131072 1 76
|
||||
test_case grow_64M_v1_4096 resize_ffs 4096 512 131072 262144 1 109
|
||||
test_case grow_64M_v1_8192 resize_ffs 8192 1024 131072 262144 1 111
|
||||
test_case grow_64M_v1_16384 resize_ffs 16384 2048 131072 262144 1 115
|
||||
test_case grow_64M_v1_32768 resize_ffs 32768 4096 131072 262144 1 111
|
||||
test_case grow_64M_v1_65536 resize_ffs 65536 8192 131072 262144 1 101
|
||||
test_case grow_16M_v2_4096 resize_ffs 4096 512 32768 131072 2 26
|
||||
test_case grow_16M_v2_8192 resize_ffs 8192 1024 32768 131072 2 28
|
||||
test_case grow_16M_v2_16384 resize_ffs 16384 2048 32768 131072 2 29
|
||||
test_case grow_16M_v2_32768 resize_ffs 32768 4096 32768 131072 2 28
|
||||
test_case grow_16M_v2_65536 resize_ffs 65536 8192 32768 131072 2 25
|
||||
test_case grow_24M_v2_4096 resize_ffs 4096 512 49152 65536 2 40
|
||||
test_case grow_24M_v2_8192 resize_ffs 8192 1024 49152 65536 2 42
|
||||
test_case grow_24M_v2_16384 resize_ffs 16384 2048 49152 65536 2 43
|
||||
test_case grow_24M_v2_32768 resize_ffs 32768 4096 49152 65536 2 42
|
||||
test_case grow_24M_v2_65536 resize_ffs 65536 8192 49152 65536 2 38
|
||||
test_case grow_32M_v2_4096 resize_ffs 4096 512 65536 131072 2 53
|
||||
test_case grow_32M_v2_8192 resize_ffs 8192 1024 65536 131072 2 56
|
||||
test_case grow_32M_v2_16384 resize_ffs 16384 2048 65536 131072 2 58
|
||||
test_case grow_32M_v2_32768 resize_ffs 32768 4096 65536 131072 2 56
|
||||
test_case grow_32M_v2_65536 resize_ffs 65536 8192 65536 131072 2 51
|
||||
test_case grow_48M_v2_4096 resize_ffs 4096 512 98304 131072 2 80
|
||||
test_case grow_48M_v2_8192 resize_ffs 8192 1024 98304 131072 2 84
|
||||
test_case grow_48M_v2_16384 resize_ffs 16384 2048 98304 131072 2 87
|
||||
test_case grow_48M_v2_32768 resize_ffs 32768 4096 98304 131072 2 83
|
||||
test_case grow_48M_v2_65536 resize_ffs 65536 8192 98304 131072 2 76
|
||||
test_case grow_64M_v2_4096 resize_ffs 4096 512 131072 262144 2 107
|
||||
test_case grow_64M_v2_8192 resize_ffs 8192 1024 131072 262144 2 111
|
||||
test_case grow_64M_v2_16384 resize_ffs 16384 2048 131072 262144 2 115
|
||||
test_case grow_64M_v2_32768 resize_ffs 32768 4096 131072 262144 2 111
|
||||
test_case grow_64M_v2_65536 resize_ffs 65536 8192 131072 262144 2 101
|
||||
|
||||
atf_test_case grow_ffsv1_partial_cg
|
||||
grow_ffsv1_partial_cg_head()
|
||||
{
|
||||
atf_set "descr" "Checks successful ffsv1 growth by less" \
|
||||
"than a cylinder group"
|
||||
}
|
||||
grow_ffsv1_partial_cg_body()
|
||||
{
|
||||
echo "***resize_ffs grow test"
|
||||
|
||||
# resize_ffs only supports ffsv1 at the moment
|
||||
atf_check -o ignore -e ignore newfs -V1 -s 4000 -F ${IMG}
|
||||
|
||||
# size to grow to is chosen to cause partial cg
|
||||
atf_check -s exit:0 -o ignore resize_ffs -y -s 5760 ${IMG}
|
||||
atf_check -s exit:0 -o ignore fsck_ffs -f -n -F ${IMG}
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
setupvars
|
||||
atf_add_test_case grow_16M_v0_8192
|
||||
atf_add_test_case grow_16M_v1_16384
|
||||
atf_add_test_case grow_16M_v2_32768
|
||||
if [ "${RESIZE_FFS_ALL_TESTS-X}" != "X" ]; then
|
||||
atf_add_test_case grow_16M_v0_4096
|
||||
atf_add_test_case grow_16M_v0_16384
|
||||
atf_add_test_case grow_16M_v0_32768
|
||||
atf_add_test_case grow_16M_v0_65536
|
||||
atf_add_test_case grow_16M_v1_4096
|
||||
atf_add_test_case grow_16M_v1_8192
|
||||
atf_add_test_case grow_16M_v1_32768
|
||||
atf_add_test_case grow_16M_v1_65536
|
||||
atf_add_test_case grow_16M_v2_4096
|
||||
atf_add_test_case grow_16M_v2_8192
|
||||
atf_add_test_case grow_16M_v2_16384
|
||||
atf_add_test_case grow_16M_v2_65536
|
||||
atf_add_test_case grow_24M_v0_4096
|
||||
atf_add_test_case grow_24M_v0_8192
|
||||
atf_add_test_case grow_24M_v0_16384
|
||||
atf_add_test_case grow_24M_v0_32768
|
||||
atf_add_test_case grow_24M_v0_65536
|
||||
atf_add_test_case grow_32M_v0_4096
|
||||
atf_add_test_case grow_32M_v0_8192
|
||||
atf_add_test_case grow_32M_v0_16384
|
||||
atf_add_test_case grow_32M_v0_32768
|
||||
atf_add_test_case grow_32M_v0_65536
|
||||
atf_add_test_case grow_48M_v0_4096
|
||||
atf_add_test_case grow_48M_v0_8192
|
||||
atf_add_test_case grow_48M_v0_16384
|
||||
atf_add_test_case grow_48M_v0_32768
|
||||
atf_add_test_case grow_48M_v0_65536
|
||||
atf_add_test_case grow_64M_v0_4096
|
||||
atf_add_test_case grow_64M_v0_8192
|
||||
atf_add_test_case grow_64M_v0_16384
|
||||
atf_add_test_case grow_64M_v0_32768
|
||||
atf_add_test_case grow_64M_v0_65536
|
||||
|
||||
atf_add_test_case grow_24M_v1_4096
|
||||
atf_add_test_case grow_24M_v1_8192
|
||||
atf_add_test_case grow_24M_v1_16384
|
||||
atf_add_test_case grow_24M_v1_32768
|
||||
atf_add_test_case grow_24M_v1_65536
|
||||
atf_add_test_case grow_32M_v1_4096
|
||||
atf_add_test_case grow_32M_v1_8192
|
||||
atf_add_test_case grow_32M_v1_16384
|
||||
atf_add_test_case grow_32M_v1_32768
|
||||
atf_add_test_case grow_32M_v1_65536
|
||||
atf_add_test_case grow_48M_v1_4096
|
||||
atf_add_test_case grow_48M_v1_8192
|
||||
atf_add_test_case grow_48M_v1_16384
|
||||
atf_add_test_case grow_48M_v1_32768
|
||||
atf_add_test_case grow_48M_v1_65536
|
||||
atf_add_test_case grow_64M_v1_4096
|
||||
atf_add_test_case grow_64M_v1_8192
|
||||
atf_add_test_case grow_64M_v1_16384
|
||||
atf_add_test_case grow_64M_v1_32768
|
||||
atf_add_test_case grow_64M_v1_65536
|
||||
|
||||
atf_add_test_case grow_24M_v2_4096
|
||||
atf_add_test_case grow_24M_v2_8192
|
||||
atf_add_test_case grow_24M_v2_16384
|
||||
atf_add_test_case grow_24M_v2_32768
|
||||
atf_add_test_case grow_24M_v2_65536
|
||||
atf_add_test_case grow_32M_v2_4096
|
||||
atf_add_test_case grow_32M_v2_8192
|
||||
atf_add_test_case grow_32M_v2_16384
|
||||
atf_add_test_case grow_32M_v2_32768
|
||||
atf_add_test_case grow_32M_v2_65536
|
||||
atf_add_test_case grow_48M_v2_4096
|
||||
atf_add_test_case grow_48M_v2_8192
|
||||
atf_add_test_case grow_48M_v2_16384
|
||||
atf_add_test_case grow_48M_v2_32768
|
||||
atf_add_test_case grow_48M_v2_65536
|
||||
atf_add_test_case grow_64M_v2_4096
|
||||
atf_add_test_case grow_64M_v2_8192
|
||||
atf_add_test_case grow_64M_v2_16384
|
||||
atf_add_test_case grow_64M_v2_32768
|
||||
atf_add_test_case grow_64M_v2_65536
|
||||
fi
|
||||
atf_add_test_case grow_ffsv1_partial_cg
|
||||
}
|
||||
220
tests/sbin/resize_ffs/t_grow_swapped.sh
Normal file
220
tests/sbin/resize_ffs/t_grow_swapped.sh
Normal file
@@ -0,0 +1,220 @@
|
||||
# $NetBSD: t_grow_swapped.sh,v 1.2 2011/01/11 00:50:02 riz Exp $
|
||||
#
|
||||
# Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This code is derived from software contributed to The NetBSD Foundation
|
||||
# by Jeffrey C. Rizzo.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
|
||||
# resize_ffs params as follows:
|
||||
# resize_ffs blocksize fragsize fssize newfssize level numdata swap
|
||||
# where 'numdata' is the number of data directories to copy - this is
|
||||
# determined manually based on the maximum number that will fit in the
|
||||
# created fs. 'level' is the fs-level (-O 0,1,2) passed to newfs.
|
||||
# If 'swap' is included, byteswap the fs
|
||||
|
||||
# v0 == newfs -O0 (4.3BSD layout, ffsv1 superblock)
|
||||
test_case grow_16M_v0_4096 resize_ffs 4096 512 32768 131072 0 28 swap
|
||||
test_case grow_16M_v0_8192 resize_ffs 8192 1024 32768 131072 0 28 swap
|
||||
test_case grow_16M_v0_16384 resize_ffs 16384 2048 32768 131072 0 29 swap
|
||||
test_case grow_16M_v0_32768 resize_ffs 32768 4096 32768 131072 0 28 swap
|
||||
test_case grow_16M_v0_65536 resize_ffs 65536 8192 32768 131072 0 26 swap
|
||||
# these grow_24M grow a smaller amount; sometimes there's different issues
|
||||
test_case grow_24M_v0_4096 resize_ffs 4096 512 49152 65536 0 41 swap
|
||||
test_case grow_24M_v0_8192 resize_ffs 8192 1024 49152 65536 0 42 swap
|
||||
test_case grow_24M_v0_16384 resize_ffs 16384 2048 49152 65536 0 43 swap
|
||||
test_case grow_24M_v0_32768 resize_ffs 32768 4096 49152 65536 0 42 swap
|
||||
test_case grow_24M_v0_65536 resize_ffs 65536 8192 49152 65536 0 38 swap
|
||||
test_case grow_32M_v0_4096 resize_ffs 4096 512 65536 131072 0 55 swap
|
||||
test_case grow_32M_v0_8192 resize_ffs 8192 1024 65536 131072 0 56 swap
|
||||
test_case grow_32M_v0_16384 resize_ffs 16384 2048 65536 131072 0 58 swap
|
||||
test_case grow_32M_v0_32768 resize_ffs 32768 4096 65536 131072 0 56 swap
|
||||
test_case grow_32M_v0_65536 resize_ffs 65536 8192 65536 131072 0 51 swap
|
||||
test_case grow_48M_v0_4096 resize_ffs 4096 512 98304 131072 0 82 swap
|
||||
test_case grow_48M_v0_8192 resize_ffs 8192 1024 98304 131072 0 84 swap
|
||||
test_case grow_48M_v0_16384 resize_ffs 16384 2048 98304 131072 0 87 swap
|
||||
test_case grow_48M_v0_32768 resize_ffs 32768 4096 98304 131072 0 83 swap
|
||||
test_case grow_48M_v0_65536 resize_ffs 65536 8192 98304 131072 0 76 swap
|
||||
test_case grow_64M_v0_4096 resize_ffs 4096 512 131072 262144 0 109 swap
|
||||
test_case grow_64M_v0_8192 resize_ffs 8192 1024 131072 262144 0 111 swap
|
||||
test_case grow_64M_v0_16384 resize_ffs 16384 2048 131072 262144 0 115 swap
|
||||
test_case grow_64M_v0_32768 resize_ffs 32768 4096 131072 262144 0 111 swap
|
||||
test_case grow_64M_v0_65536 resize_ffs 65536 8192 131072 262144 0 101 swap
|
||||
|
||||
# v1 == newfs -O1 (FFSv1, v2 superblock layout)
|
||||
test_case grow_16M_v1_4096 resize_ffs 4096 512 32768 131072 1 28 swap
|
||||
test_case grow_16M_v1_8192 resize_ffs 8192 1024 32768 131072 1 28 swap
|
||||
test_case grow_16M_v1_16384 resize_ffs 16384 2048 32768 131072 1 29 swap
|
||||
test_case grow_16M_v1_32768 resize_ffs 32768 4096 32768 131072 1 28 swap
|
||||
test_case grow_16M_v1_65536 resize_ffs 65536 8192 32768 131072 1 26 swap
|
||||
# these grow_24M grow a smaller amount; sometimes there's different issues
|
||||
test_case grow_24M_v1_4096 resize_ffs 4096 512 49152 65536 1 41 swap
|
||||
test_case grow_24M_v1_8192 resize_ffs 8192 1024 49152 65536 1 42 swap
|
||||
test_case grow_24M_v1_16384 resize_ffs 16384 2048 49152 65536 1 43 swap
|
||||
test_case grow_24M_v1_32768 resize_ffs 32768 4096 49152 65536 1 42 swap
|
||||
test_case grow_24M_v1_65536 resize_ffs 65536 8192 49152 65536 1 38 swap
|
||||
test_case grow_32M_v1_4096 resize_ffs 4096 512 65536 131072 1 55 swap
|
||||
test_case grow_32M_v1_8192 resize_ffs 8192 1024 65536 131072 1 56 swap
|
||||
test_case grow_32M_v1_16384 resize_ffs 16384 2048 65536 131072 1 58 swap
|
||||
test_case grow_32M_v1_32768 resize_ffs 32768 4096 65536 131072 1 56 swap
|
||||
test_case grow_32M_v1_65536 resize_ffs 65536 8192 65536 131072 1 51 swap
|
||||
test_case grow_48M_v1_4096 resize_ffs 4096 512 98304 131072 1 82 swap
|
||||
test_case grow_48M_v1_8192 resize_ffs 8192 1024 98304 131072 1 84 swap
|
||||
test_case grow_48M_v1_16384 resize_ffs 16384 2048 98304 131072 1 87 swap
|
||||
test_case grow_48M_v1_32768 resize_ffs 32768 4096 98304 131072 1 83 swap
|
||||
test_case grow_48M_v1_65536 resize_ffs 65536 8192 98304 131072 1 76 swap
|
||||
test_case grow_64M_v1_4096 resize_ffs 4096 512 131072 262144 1 109 swap
|
||||
test_case grow_64M_v1_8192 resize_ffs 8192 1024 131072 262144 1 111 swap
|
||||
test_case grow_64M_v1_16384 resize_ffs 16384 2048 131072 262144 1 115 swap
|
||||
test_case grow_64M_v1_32768 resize_ffs 32768 4096 131072 262144 1 111 swap
|
||||
test_case grow_64M_v1_65536 resize_ffs 65536 8192 131072 262144 1 101 swap
|
||||
test_case grow_16M_v2_4096 resize_ffs 4096 512 32768 131072 2 26 swap
|
||||
test_case grow_16M_v2_8192 resize_ffs 8192 1024 32768 131072 2 28 swap
|
||||
test_case grow_16M_v2_16384 resize_ffs 16384 2048 32768 131072 2 29 swap
|
||||
test_case grow_16M_v2_32768 resize_ffs 32768 4096 32768 131072 2 28 swap
|
||||
test_case grow_16M_v2_65536 resize_ffs 65536 8192 32768 131072 2 25 swap
|
||||
test_case grow_24M_v2_4096 resize_ffs 4096 512 49152 65536 2 40 swap
|
||||
test_case grow_24M_v2_8192 resize_ffs 8192 1024 49152 65536 2 42 swap
|
||||
test_case grow_24M_v2_16384 resize_ffs 16384 2048 49152 65536 2 43 swap
|
||||
test_case grow_24M_v2_32768 resize_ffs 32768 4096 49152 65536 2 42 swap
|
||||
test_case grow_24M_v2_65536 resize_ffs 65536 8192 49152 65536 2 38 swap
|
||||
test_case grow_32M_v2_4096 resize_ffs 4096 512 65536 131072 2 53 swap
|
||||
test_case grow_32M_v2_8192 resize_ffs 8192 1024 65536 131072 2 56 swap
|
||||
test_case grow_32M_v2_16384 resize_ffs 16384 2048 65536 131072 2 58 swap
|
||||
test_case grow_32M_v2_32768 resize_ffs 32768 4096 65536 131072 2 56 swap
|
||||
test_case grow_32M_v2_65536 resize_ffs 65536 8192 65536 131072 2 51 swap
|
||||
test_case grow_48M_v2_4096 resize_ffs 4096 512 98304 131072 2 80 swap
|
||||
test_case grow_48M_v2_8192 resize_ffs 8192 1024 98304 131072 2 84 swap
|
||||
test_case grow_48M_v2_16384 resize_ffs 16384 2048 98304 131072 2 87 swap
|
||||
test_case grow_48M_v2_32768 resize_ffs 32768 4096 98304 131072 2 83 swap
|
||||
test_case grow_48M_v2_65536 resize_ffs 65536 8192 98304 131072 2 76 swap
|
||||
test_case grow_64M_v2_4096 resize_ffs 4096 512 131072 262144 2 107 swap
|
||||
test_case grow_64M_v2_8192 resize_ffs 8192 1024 131072 262144 2 111 swap
|
||||
test_case grow_64M_v2_16384 resize_ffs 16384 2048 131072 262144 2 115 swap
|
||||
test_case grow_64M_v2_32768 resize_ffs 32768 4096 131072 262144 2 111 swap
|
||||
test_case grow_64M_v2_65536 resize_ffs 65536 8192 131072 262144 2 101 swap
|
||||
|
||||
atf_test_case grow_ffsv1_partial_cg
|
||||
grow_ffsv1_partial_cg_head()
|
||||
{
|
||||
atf_set "descr" "Checks successful ffsv1 growth by less" \
|
||||
"than a cylinder group"
|
||||
}
|
||||
grow_ffsv1_partial_cg_body()
|
||||
{
|
||||
echo "***resize_ffs grow test"
|
||||
|
||||
atf_check -o ignore -e ignore newfs -B be -V1 -s 4000 -F ${IMG}
|
||||
|
||||
# size to grow to is chosen to cause partial cg
|
||||
atf_check -s exit:0 -o ignore resize_ffs -y -s 5760 ${IMG}
|
||||
atf_check -s exit:0 -o ignore fsck_ffs -f -n -F ${IMG}
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
setupvars
|
||||
atf_add_test_case grow_16M_v0_65536
|
||||
atf_add_test_case grow_16M_v1_4096
|
||||
atf_add_test_case grow_16M_v2_8192
|
||||
if [ "${RESIZE_FFS_ALL_TESTS-X}" != "X" ]; then
|
||||
atf_add_test_case grow_16M_v0_4096
|
||||
atf_add_test_case grow_16M_v0_8192
|
||||
atf_add_test_case grow_16M_v0_16384
|
||||
atf_add_test_case grow_16M_v0_32768
|
||||
atf_add_test_case grow_16M_v1_8192
|
||||
atf_add_test_case grow_16M_v1_16384
|
||||
atf_add_test_case grow_16M_v1_32768
|
||||
atf_add_test_case grow_16M_v1_65536
|
||||
atf_add_test_case grow_16M_v2_4096
|
||||
atf_add_test_case grow_16M_v2_16384
|
||||
atf_add_test_case grow_16M_v2_32768
|
||||
atf_add_test_case grow_16M_v2_65536
|
||||
atf_add_test_case grow_24M_v0_4096
|
||||
atf_add_test_case grow_24M_v0_8192
|
||||
atf_add_test_case grow_24M_v0_16384
|
||||
atf_add_test_case grow_24M_v0_32768
|
||||
atf_add_test_case grow_24M_v0_65536
|
||||
atf_add_test_case grow_32M_v0_4096
|
||||
atf_add_test_case grow_32M_v0_8192
|
||||
atf_add_test_case grow_32M_v0_16384
|
||||
atf_add_test_case grow_32M_v0_32768
|
||||
atf_add_test_case grow_32M_v0_65536
|
||||
atf_add_test_case grow_48M_v0_4096
|
||||
atf_add_test_case grow_48M_v0_8192
|
||||
atf_add_test_case grow_48M_v0_16384
|
||||
atf_add_test_case grow_48M_v0_32768
|
||||
atf_add_test_case grow_48M_v0_65536
|
||||
atf_add_test_case grow_64M_v0_4096
|
||||
atf_add_test_case grow_64M_v0_8192
|
||||
atf_add_test_case grow_64M_v0_16384
|
||||
atf_add_test_case grow_64M_v0_32768
|
||||
atf_add_test_case grow_64M_v0_65536
|
||||
|
||||
atf_add_test_case grow_24M_v1_4096
|
||||
atf_add_test_case grow_24M_v1_8192
|
||||
atf_add_test_case grow_24M_v1_16384
|
||||
atf_add_test_case grow_24M_v1_32768
|
||||
atf_add_test_case grow_24M_v1_65536
|
||||
atf_add_test_case grow_32M_v1_4096
|
||||
atf_add_test_case grow_32M_v1_8192
|
||||
atf_add_test_case grow_32M_v1_16384
|
||||
atf_add_test_case grow_32M_v1_32768
|
||||
atf_add_test_case grow_32M_v1_65536
|
||||
atf_add_test_case grow_48M_v1_4096
|
||||
atf_add_test_case grow_48M_v1_8192
|
||||
atf_add_test_case grow_48M_v1_16384
|
||||
atf_add_test_case grow_48M_v1_32768
|
||||
atf_add_test_case grow_48M_v1_65536
|
||||
atf_add_test_case grow_64M_v1_4096
|
||||
atf_add_test_case grow_64M_v1_8192
|
||||
atf_add_test_case grow_64M_v1_16384
|
||||
atf_add_test_case grow_64M_v1_32768
|
||||
atf_add_test_case grow_64M_v1_65536
|
||||
|
||||
atf_add_test_case grow_24M_v2_4096
|
||||
atf_add_test_case grow_24M_v2_8192
|
||||
atf_add_test_case grow_24M_v2_16384
|
||||
atf_add_test_case grow_24M_v2_32768
|
||||
atf_add_test_case grow_24M_v2_65536
|
||||
atf_add_test_case grow_32M_v2_4096
|
||||
atf_add_test_case grow_32M_v2_8192
|
||||
atf_add_test_case grow_32M_v2_16384
|
||||
atf_add_test_case grow_32M_v2_32768
|
||||
atf_add_test_case grow_32M_v2_65536
|
||||
atf_add_test_case grow_48M_v2_4096
|
||||
atf_add_test_case grow_48M_v2_8192
|
||||
atf_add_test_case grow_48M_v2_16384
|
||||
atf_add_test_case grow_48M_v2_32768
|
||||
atf_add_test_case grow_48M_v2_65536
|
||||
atf_add_test_case grow_64M_v2_4096
|
||||
atf_add_test_case grow_64M_v2_8192
|
||||
atf_add_test_case grow_64M_v2_16384
|
||||
atf_add_test_case grow_64M_v2_32768
|
||||
atf_add_test_case grow_64M_v2_65536
|
||||
fi
|
||||
atf_add_test_case grow_ffsv1_partial_cg
|
||||
}
|
||||
185
tests/sbin/resize_ffs/t_shrink.sh
Normal file
185
tests/sbin/resize_ffs/t_shrink.sh
Normal file
@@ -0,0 +1,185 @@
|
||||
# $NetBSD: t_shrink.sh,v 1.7 2011/01/05 02:25:27 riz Exp $
|
||||
#
|
||||
# Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This code is derived from software contributed to The NetBSD Foundation
|
||||
# by Jeffrey C. Rizzo.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
|
||||
# resize_ffs params as follows:
|
||||
# resize_ffs blocksize fragsize fssize newfssize level numdata swap
|
||||
# where 'numdata' is the number of data directories to copy - this is
|
||||
# determined manually based on the maximum number that will fit in the
|
||||
# created fs. 'level' is the fs-level (-O 0,1,2) passed to newfs.
|
||||
# If 'swap' is included, byteswap the fs
|
||||
test_case shrink_24M_16M_v0_4096 resize_ffs 4096 512 49152 32768 0 41
|
||||
test_case shrink_24M_16M_v0_8192 resize_ffs 8192 1024 49152 32768 0 42
|
||||
test_case shrink_24M_16M_v0_16384 resize_ffs 16384 2048 49152 32768 0 43
|
||||
test_case shrink_24M_16M_v0_32768 resize_ffs 32768 4096 49152 32768 0 42
|
||||
test_case shrink_24M_16M_v0_65536 resize_ffs 65536 8192 49152 32768 0 38
|
||||
test_case shrink_32M_24M_v0_4096 resize_ffs 4096 512 65536 49152 0 55
|
||||
test_case shrink_32M_24M_v0_8192 resize_ffs 8192 1024 65536 49152 0 56
|
||||
test_case shrink_32M_24M_v0_16384 resize_ffs 16384 2048 65536 49152 0 58
|
||||
test_case shrink_32M_24M_v0_32768 resize_ffs 32768 4096 65536 49152 0 56
|
||||
test_case_xfail shrink_32M_24M_v0_65536 "PR bin/44204" resize_ffs 65536 8192 65536 49152 0 51
|
||||
test_case shrink_48M_16M_v0_4096 resize_ffs 4096 512 98304 32768 0 82
|
||||
test_case shrink_48M_16M_v0_8192 resize_ffs 8192 1024 98304 32768 0 84
|
||||
test_case shrink_48M_16M_v0_16384 resize_ffs 16384 2048 98304 32768 0 87
|
||||
test_case shrink_48M_16M_v0_32768 resize_ffs 32768 4096 98304 32768 0 83
|
||||
test_case shrink_48M_16M_v0_65536 resize_ffs 65536 8192 98304 32768 0 76
|
||||
test_case shrink_64M_48M_v0_4096 resize_ffs 4096 512 131072 98304 0 109
|
||||
test_case shrink_64M_48M_v0_8192 resize_ffs 8192 1024 131072 98304 0 111
|
||||
test_case shrink_64M_48M_v0_16384 resize_ffs 16384 2048 131072 98304 0 115
|
||||
test_case shrink_64M_48M_v0_32768 resize_ffs 32768 4096 131072 98304 0 111
|
||||
test_case shrink_64M_48M_v0_65536 resize_ffs 65536 8192 131072 98304 0 101
|
||||
|
||||
test_case shrink_24M_16M_v1_4096 resize_ffs 4096 512 49152 32768 1 41
|
||||
test_case shrink_24M_16M_v1_8192 resize_ffs 8192 1024 49152 32768 1 42
|
||||
test_case shrink_24M_16M_v1_16384 resize_ffs 16384 2048 49152 32768 1 43
|
||||
test_case shrink_24M_16M_v1_32768 resize_ffs 32768 4096 49152 32768 1 42
|
||||
test_case shrink_24M_16M_v1_65536 resize_ffs 65536 8192 49152 32768 1 38
|
||||
test_case shrink_32M_24M_v1_4096 resize_ffs 4096 512 65536 49152 1 55
|
||||
test_case shrink_32M_24M_v1_8192 resize_ffs 8192 1024 65536 49152 1 56
|
||||
test_case shrink_32M_24M_v1_16384 resize_ffs 16384 2048 65536 49152 1 58
|
||||
test_case shrink_32M_24M_v1_32768 resize_ffs 32768 4096 65536 49152 1 56
|
||||
test_case_xfail shrink_32M_24M_v1_65536 "PR bin/44204" resize_ffs 65536 8192 65536 49152 1 51
|
||||
test_case shrink_48M_16M_v1_4096 resize_ffs 4096 512 98304 32768 1 82
|
||||
test_case shrink_48M_16M_v1_8192 resize_ffs 8192 1024 98304 32768 1 84
|
||||
test_case shrink_48M_16M_v1_16384 resize_ffs 16384 2048 98304 32768 1 87
|
||||
test_case shrink_48M_16M_v1_32768 resize_ffs 32768 4096 98304 32768 1 83
|
||||
test_case shrink_48M_16M_v1_65536 resize_ffs 65536 8192 98304 32768 1 76
|
||||
test_case shrink_64M_48M_v1_4096 resize_ffs 4096 512 131072 98304 1 109
|
||||
test_case shrink_64M_48M_v1_8192 resize_ffs 8192 1024 131072 98304 1 111
|
||||
test_case shrink_64M_48M_v1_16384 resize_ffs 16384 2048 131072 98304 1 115
|
||||
test_case shrink_64M_48M_v1_32768 resize_ffs 32768 4096 131072 98304 1 111
|
||||
test_case shrink_64M_48M_v1_65536 resize_ffs 65536 8192 131072 98304 1 101
|
||||
|
||||
test_case_xfail shrink_24M_16M_v2_4096 "PR bin/44205" resize_ffs 4096 512 49152 32768 2 41
|
||||
test_case_xfail shrink_24M_16M_v2_8192 "PR bin/44205" resize_ffs 8192 1024 49152 32768 2 42
|
||||
test_case_xfail shrink_24M_16M_v2_16384 "PR bin/44205" resize_ffs 16384 2048 49152 32768 2 43
|
||||
test_case_xfail shrink_24M_16M_v2_32768 "PR bin/44205" resize_ffs 32768 4096 49152 32768 2 42
|
||||
test_case_xfail shrink_24M_16M_v2_65536 "PR bin/44205" resize_ffs 65536 8192 49152 32768 2 38
|
||||
test_case_xfail shrink_32M_24M_v2_4096 "PR bin/44205" resize_ffs 4096 512 65536 49152 2 55
|
||||
test_case_xfail shrink_32M_24M_v2_8192 "PR bin/44205" resize_ffs 8192 1024 65536 49152 2 56
|
||||
test_case_xfail shrink_32M_24M_v2_16384 "PR bin/44205" resize_ffs 16384 2048 65536 49152 2 58
|
||||
test_case_xfail shrink_32M_24M_v2_32768 "PR bin/44205" resize_ffs 32768 4096 65536 49152 2 56
|
||||
test_case_xfail shrink_32M_24M_v2_65536 "PR bin/44204" resize_ffs 65536 8192 65536 49152 2 51
|
||||
test_case_xfail shrink_48M_16M_v2_4096 "PR bin/44205" resize_ffs 4096 512 98304 32768 2 82
|
||||
test_case_xfail shrink_48M_16M_v2_8192 "PR bin/44205" resize_ffs 8192 1024 98304 32768 2 84
|
||||
test_case_xfail shrink_48M_16M_v2_16384 "PR bin/44205" resize_ffs 16384 2048 98304 32768 2 87
|
||||
test_case_xfail shrink_48M_16M_v2_32768 "PR bin/44205" resize_ffs 32768 4096 98304 32768 2 83
|
||||
test_case_xfail shrink_48M_16M_v2_65536 "PR bin/44205" resize_ffs 65536 8192 98304 32768 2 76
|
||||
test_case_xfail shrink_64M_48M_v2_4096 "PR bin/44205" resize_ffs 4096 512 131072 98304 2 109
|
||||
test_case_xfail shrink_64M_48M_v2_8192 "PR bin/44205" resize_ffs 8192 1024 131072 98304 2 111
|
||||
test_case_xfail shrink_64M_48M_v2_16384 "PR bin/44205" resize_ffs 16384 2048 131072 98304 2 115
|
||||
test_case_xfail shrink_64M_48M_v2_32768 "PR bin/44205" resize_ffs 32768 4096 131072 98304 2 111
|
||||
test_case_xfail shrink_64M_48M_v2_65536 "PR bin/44205" resize_ffs 65536 8192 131072 98304 2 101
|
||||
|
||||
|
||||
atf_test_case shrink_ffsv1_partial_cg
|
||||
shrink_ffsv1_partial_cg_head()
|
||||
{
|
||||
atf_set "descr" "Checks successful shrinkage of ffsv1 by" \
|
||||
"less than a cylinder group"
|
||||
}
|
||||
shrink_ffsv1_partial_cg_body()
|
||||
{
|
||||
echo "*** resize_ffs shrinkage partial cg test"
|
||||
|
||||
atf_check -o ignore -e ignore newfs -V1 -F -s 5760 ${IMG}
|
||||
|
||||
# shrink so there's a partial cg at the end
|
||||
atf_check -s exit:0 resize_ffs -s 4000 -y ${IMG}
|
||||
atf_check -s exit:0 -o ignore fsck_ffs -f -n -F ${IMG}
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
setupvars
|
||||
atf_add_test_case shrink_24M_16M_v0_32768
|
||||
atf_add_test_case shrink_24M_16M_v1_65536
|
||||
atf_add_test_case shrink_24M_16M_v2_4096
|
||||
if [ "${RESIZE_FFS_ALL_TESTS-X}" != "X" ]; then
|
||||
atf_add_test_case shrink_24M_16M_v0_4096
|
||||
atf_add_test_case shrink_24M_16M_v0_8192
|
||||
atf_add_test_case shrink_24M_16M_v0_16384
|
||||
atf_add_test_case shrink_24M_16M_v0_65536
|
||||
atf_add_test_case shrink_24M_16M_v1_4096
|
||||
atf_add_test_case shrink_24M_16M_v1_8192
|
||||
atf_add_test_case shrink_24M_16M_v1_16384
|
||||
atf_add_test_case shrink_24M_16M_v1_32768
|
||||
atf_add_test_case shrink_24M_16M_v2_8192
|
||||
atf_add_test_case shrink_24M_16M_v2_16384
|
||||
atf_add_test_case shrink_24M_16M_v2_32768
|
||||
atf_add_test_case shrink_24M_16M_v2_65536
|
||||
atf_add_test_case shrink_32M_24M_v0_4096
|
||||
atf_add_test_case shrink_32M_24M_v0_8192
|
||||
atf_add_test_case shrink_32M_24M_v0_16384
|
||||
atf_add_test_case shrink_32M_24M_v0_32768
|
||||
atf_add_test_case shrink_32M_24M_v0_65536
|
||||
atf_add_test_case shrink_48M_16M_v0_4096
|
||||
atf_add_test_case shrink_48M_16M_v0_8192
|
||||
atf_add_test_case shrink_48M_16M_v0_16384
|
||||
atf_add_test_case shrink_48M_16M_v0_32768
|
||||
atf_add_test_case shrink_48M_16M_v0_65536
|
||||
atf_add_test_case shrink_64M_48M_v0_4096
|
||||
atf_add_test_case shrink_64M_48M_v0_8192
|
||||
atf_add_test_case shrink_64M_48M_v0_16384
|
||||
atf_add_test_case shrink_64M_48M_v0_32768
|
||||
atf_add_test_case shrink_64M_48M_v0_65536
|
||||
atf_add_test_case shrink_32M_24M_v1_4096
|
||||
atf_add_test_case shrink_32M_24M_v1_8192
|
||||
atf_add_test_case shrink_32M_24M_v1_16384
|
||||
atf_add_test_case shrink_32M_24M_v1_32768
|
||||
atf_add_test_case shrink_32M_24M_v1_65536
|
||||
atf_add_test_case shrink_48M_16M_v1_4096
|
||||
atf_add_test_case shrink_48M_16M_v1_8192
|
||||
atf_add_test_case shrink_48M_16M_v1_16384
|
||||
atf_add_test_case shrink_48M_16M_v1_32768
|
||||
atf_add_test_case shrink_48M_16M_v1_65536
|
||||
atf_add_test_case shrink_64M_48M_v1_4096
|
||||
atf_add_test_case shrink_64M_48M_v1_8192
|
||||
atf_add_test_case shrink_64M_48M_v1_16384
|
||||
atf_add_test_case shrink_64M_48M_v1_32768
|
||||
atf_add_test_case shrink_64M_48M_v1_65536
|
||||
atf_add_test_case shrink_32M_24M_v2_4096
|
||||
atf_add_test_case shrink_32M_24M_v2_8192
|
||||
atf_add_test_case shrink_32M_24M_v2_16384
|
||||
atf_add_test_case shrink_32M_24M_v2_32768
|
||||
atf_add_test_case shrink_32M_24M_v2_65536
|
||||
atf_add_test_case shrink_48M_16M_v2_4096
|
||||
atf_add_test_case shrink_48M_16M_v2_8192
|
||||
atf_add_test_case shrink_48M_16M_v2_16384
|
||||
atf_add_test_case shrink_48M_16M_v2_32768
|
||||
atf_add_test_case shrink_48M_16M_v2_65536
|
||||
atf_add_test_case shrink_64M_48M_v2_4096
|
||||
atf_add_test_case shrink_64M_48M_v2_8192
|
||||
atf_add_test_case shrink_64M_48M_v2_16384
|
||||
atf_add_test_case shrink_64M_48M_v2_32768
|
||||
atf_add_test_case shrink_64M_48M_v2_65536
|
||||
fi
|
||||
atf_add_test_case shrink_ffsv1_partial_cg
|
||||
}
|
||||
185
tests/sbin/resize_ffs/t_shrink_swapped.sh
Normal file
185
tests/sbin/resize_ffs/t_shrink_swapped.sh
Normal file
@@ -0,0 +1,185 @@
|
||||
# $NetBSD: t_shrink_swapped.sh,v 1.1 2011/01/05 02:25:27 riz Exp $
|
||||
#
|
||||
# Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This code is derived from software contributed to The NetBSD Foundation
|
||||
# by Jeffrey C. Rizzo.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
|
||||
# resize_ffs params as follows:
|
||||
# resize_ffs blocksize fragsize fssize newfssize level numdata swap
|
||||
# where 'numdata' is the number of data directories to copy - this is
|
||||
# determined manually based on the maximum number that will fit in the
|
||||
# created fs. 'level' is the fs-level (-O 0,1,2) passed to newfs.
|
||||
# If 'swap' is included, byteswap the fs
|
||||
test_case shrink_24M_16M_v0_4096 resize_ffs 4096 512 49152 32768 0 41 swap
|
||||
test_case shrink_24M_16M_v0_8192 resize_ffs 8192 1024 49152 32768 0 42 swap
|
||||
test_case shrink_24M_16M_v0_16384 resize_ffs 16384 2048 49152 32768 0 43 swap
|
||||
test_case shrink_24M_16M_v0_32768 resize_ffs 32768 4096 49152 32768 0 42 swap
|
||||
test_case shrink_24M_16M_v0_65536 resize_ffs 65536 8192 49152 32768 0 38 swap
|
||||
test_case shrink_32M_24M_v0_4096 resize_ffs 4096 512 65536 49152 0 55 swap
|
||||
test_case shrink_32M_24M_v0_8192 resize_ffs 8192 1024 65536 49152 0 56 swap
|
||||
test_case shrink_32M_24M_v0_16384 resize_ffs 16384 2048 65536 49152 0 58 swap
|
||||
test_case shrink_32M_24M_v0_32768 resize_ffs 32768 4096 65536 49152 0 56 swap
|
||||
test_case_xfail shrink_32M_24M_v0_65536 "PR bin/44204" resize_ffs 65536 8192 65536 49152 0 51 swap
|
||||
test_case shrink_48M_16M_v0_4096 resize_ffs 4096 512 98304 32768 0 82 swap
|
||||
test_case shrink_48M_16M_v0_8192 resize_ffs 8192 1024 98304 32768 0 84 swap
|
||||
test_case shrink_48M_16M_v0_16384 resize_ffs 16384 2048 98304 32768 0 87 swap
|
||||
test_case shrink_48M_16M_v0_32768 resize_ffs 32768 4096 98304 32768 0 83 swap
|
||||
test_case shrink_48M_16M_v0_65536 resize_ffs 65536 8192 98304 32768 0 76 swap
|
||||
test_case shrink_64M_48M_v0_4096 resize_ffs 4096 512 131072 98304 0 109 swap
|
||||
test_case shrink_64M_48M_v0_8192 resize_ffs 8192 1024 131072 98304 0 111 swap
|
||||
test_case shrink_64M_48M_v0_16384 resize_ffs 16384 2048 131072 98304 0 115 swap
|
||||
test_case shrink_64M_48M_v0_32768 resize_ffs 32768 4096 131072 98304 0 111 swap
|
||||
test_case shrink_64M_48M_v0_65536 resize_ffs 65536 8192 131072 98304 0 101 swap
|
||||
|
||||
test_case shrink_24M_16M_v1_4096 resize_ffs 4096 512 49152 32768 1 41 swap
|
||||
test_case shrink_24M_16M_v1_8192 resize_ffs 8192 1024 49152 32768 1 42 swap
|
||||
test_case shrink_24M_16M_v1_16384 resize_ffs 16384 2048 49152 32768 1 43 swap
|
||||
test_case shrink_24M_16M_v1_32768 resize_ffs 32768 4096 49152 32768 1 42 swap
|
||||
test_case shrink_24M_16M_v1_65536 resize_ffs 65536 8192 49152 32768 1 38 swap
|
||||
test_case shrink_32M_24M_v1_4096 resize_ffs 4096 512 65536 49152 1 55 swap
|
||||
test_case shrink_32M_24M_v1_8192 resize_ffs 8192 1024 65536 49152 1 56 swap
|
||||
test_case shrink_32M_24M_v1_16384 resize_ffs 16384 2048 65536 49152 1 58 swap
|
||||
test_case shrink_32M_24M_v1_32768 resize_ffs 32768 4096 65536 49152 1 56 swap
|
||||
test_case_xfail shrink_32M_24M_v1_65536 "PR bin/44204" resize_ffs 65536 8192 65536 49152 1 51 swap
|
||||
test_case shrink_48M_16M_v1_4096 resize_ffs 4096 512 98304 32768 1 82 swap
|
||||
test_case shrink_48M_16M_v1_8192 resize_ffs 8192 1024 98304 32768 1 84 swap
|
||||
test_case shrink_48M_16M_v1_16384 resize_ffs 16384 2048 98304 32768 1 87 swap
|
||||
test_case shrink_48M_16M_v1_32768 resize_ffs 32768 4096 98304 32768 1 83 swap
|
||||
test_case shrink_48M_16M_v1_65536 resize_ffs 65536 8192 98304 32768 1 76 swap
|
||||
test_case shrink_64M_48M_v1_4096 resize_ffs 4096 512 131072 98304 1 109 swap
|
||||
test_case shrink_64M_48M_v1_8192 resize_ffs 8192 1024 131072 98304 1 111 swap
|
||||
test_case shrink_64M_48M_v1_16384 resize_ffs 16384 2048 131072 98304 1 115 swap
|
||||
test_case shrink_64M_48M_v1_32768 resize_ffs 32768 4096 131072 98304 1 111 swap
|
||||
test_case shrink_64M_48M_v1_65536 resize_ffs 65536 8192 131072 98304 1 101 swap
|
||||
|
||||
test_case_xfail shrink_24M_16M_v2_4096 "PR bin/44205" resize_ffs 4096 512 49152 32768 2 41 swap
|
||||
test_case_xfail shrink_24M_16M_v2_8192 "PR bin/44205" resize_ffs 8192 1024 49152 32768 2 42 swap
|
||||
test_case_xfail shrink_24M_16M_v2_16384 "PR bin/44205" resize_ffs 16384 2048 49152 32768 2 43 swap
|
||||
test_case_xfail shrink_24M_16M_v2_32768 "PR bin/44205" resize_ffs 32768 4096 49152 32768 2 42 swap
|
||||
test_case_xfail shrink_24M_16M_v2_65536 "PR bin/44205" resize_ffs 65536 8192 49152 32768 2 38 swap
|
||||
test_case_xfail shrink_32M_24M_v2_4096 "PR bin/44205" resize_ffs 4096 512 65536 49152 2 55 swap
|
||||
test_case_xfail shrink_32M_24M_v2_8192 "PR bin/44205" resize_ffs 8192 1024 65536 49152 2 56 swap
|
||||
test_case_xfail shrink_32M_24M_v2_16384 "PR bin/44205" resize_ffs 16384 2048 65536 49152 2 58 swap
|
||||
test_case_xfail shrink_32M_24M_v2_32768 "PR bin/44205" resize_ffs 32768 4096 65536 49152 2 56 swap
|
||||
test_case_xfail shrink_32M_24M_v2_65536 "PR bin/44204" resize_ffs 65536 8192 65536 49152 2 51 swap
|
||||
test_case_xfail shrink_48M_16M_v2_4096 "PR bin/44205" resize_ffs 4096 512 98304 32768 2 82 swap
|
||||
test_case_xfail shrink_48M_16M_v2_8192 "PR bin/44205" resize_ffs 8192 1024 98304 32768 2 84 swap
|
||||
test_case_xfail shrink_48M_16M_v2_16384 "PR bin/44205" resize_ffs 16384 2048 98304 32768 2 87 swap
|
||||
test_case_xfail shrink_48M_16M_v2_32768 "PR bin/44205" resize_ffs 32768 4096 98304 32768 2 83 swap
|
||||
test_case_xfail shrink_48M_16M_v2_65536 "PR bin/44205" resize_ffs 65536 8192 98304 32768 2 76 swap
|
||||
test_case_xfail shrink_64M_48M_v2_4096 "PR bin/44205" resize_ffs 4096 512 131072 98304 2 109 swap
|
||||
test_case_xfail shrink_64M_48M_v2_8192 "PR bin/44205" resize_ffs 8192 1024 131072 98304 2 111 swap
|
||||
test_case_xfail shrink_64M_48M_v2_16384 "PR bin/44205" resize_ffs 16384 2048 131072 98304 2 115 swap
|
||||
test_case_xfail shrink_64M_48M_v2_32768 "PR bin/44205" resize_ffs 32768 4096 131072 98304 2 111 swap
|
||||
test_case_xfail shrink_64M_48M_v2_65536 "PR bin/44205" resize_ffs 65536 8192 131072 98304 2 101 swap
|
||||
|
||||
|
||||
atf_test_case shrink_ffsv1_partial_cg
|
||||
shrink_ffsv1_partial_cg_head()
|
||||
{
|
||||
atf_set "descr" "Checks successful shrinkage of ffsv1 by" \
|
||||
"less than a cylinder group"
|
||||
}
|
||||
shrink_ffsv1_partial_cg_body()
|
||||
{
|
||||
echo "*** resize_ffs shrinkage partial cg test"
|
||||
|
||||
atf_check -o ignore -e ignore newfs -V1 -F -s 5760 ${IMG}
|
||||
|
||||
# shrink so there's a partial cg at the end
|
||||
atf_check -s exit:0 resize_ffs -s 4000 -y ${IMG}
|
||||
atf_check -s exit:0 -o ignore fsck_ffs -f -n -F ${IMG}
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
setupvars
|
||||
atf_add_test_case shrink_24M_16M_v0_4096
|
||||
atf_add_test_case shrink_24M_16M_v1_8192
|
||||
atf_add_test_case shrink_24M_16M_v2_16384
|
||||
if [ "${RESIZE_FFS_ALL_TESTS-X}" != "X" ]; then
|
||||
atf_add_test_case shrink_24M_16M_v0_8192
|
||||
atf_add_test_case shrink_24M_16M_v0_16384
|
||||
atf_add_test_case shrink_24M_16M_v0_32768
|
||||
atf_add_test_case shrink_24M_16M_v0_65536
|
||||
atf_add_test_case shrink_24M_16M_v1_4096
|
||||
atf_add_test_case shrink_24M_16M_v1_16384
|
||||
atf_add_test_case shrink_24M_16M_v1_32768
|
||||
atf_add_test_case shrink_24M_16M_v1_65536
|
||||
atf_add_test_case shrink_24M_16M_v2_4096
|
||||
atf_add_test_case shrink_24M_16M_v2_8192
|
||||
atf_add_test_case shrink_24M_16M_v2_32768
|
||||
atf_add_test_case shrink_24M_16M_v2_65536
|
||||
atf_add_test_case shrink_32M_24M_v0_4096
|
||||
atf_add_test_case shrink_32M_24M_v0_8192
|
||||
atf_add_test_case shrink_32M_24M_v0_16384
|
||||
atf_add_test_case shrink_32M_24M_v0_32768
|
||||
atf_add_test_case shrink_32M_24M_v0_65536
|
||||
atf_add_test_case shrink_48M_16M_v0_4096
|
||||
atf_add_test_case shrink_48M_16M_v0_8192
|
||||
atf_add_test_case shrink_48M_16M_v0_16384
|
||||
atf_add_test_case shrink_48M_16M_v0_32768
|
||||
atf_add_test_case shrink_48M_16M_v0_65536
|
||||
atf_add_test_case shrink_64M_48M_v0_4096
|
||||
atf_add_test_case shrink_64M_48M_v0_8192
|
||||
atf_add_test_case shrink_64M_48M_v0_16384
|
||||
atf_add_test_case shrink_64M_48M_v0_32768
|
||||
atf_add_test_case shrink_64M_48M_v0_65536
|
||||
atf_add_test_case shrink_32M_24M_v1_4096
|
||||
atf_add_test_case shrink_32M_24M_v1_8192
|
||||
atf_add_test_case shrink_32M_24M_v1_16384
|
||||
atf_add_test_case shrink_32M_24M_v1_32768
|
||||
atf_add_test_case shrink_32M_24M_v1_65536
|
||||
atf_add_test_case shrink_48M_16M_v1_4096
|
||||
atf_add_test_case shrink_48M_16M_v1_8192
|
||||
atf_add_test_case shrink_48M_16M_v1_16384
|
||||
atf_add_test_case shrink_48M_16M_v1_32768
|
||||
atf_add_test_case shrink_48M_16M_v1_65536
|
||||
atf_add_test_case shrink_64M_48M_v1_4096
|
||||
atf_add_test_case shrink_64M_48M_v1_8192
|
||||
atf_add_test_case shrink_64M_48M_v1_16384
|
||||
atf_add_test_case shrink_64M_48M_v1_32768
|
||||
atf_add_test_case shrink_64M_48M_v1_65536
|
||||
atf_add_test_case shrink_32M_24M_v2_4096
|
||||
atf_add_test_case shrink_32M_24M_v2_8192
|
||||
atf_add_test_case shrink_32M_24M_v2_16384
|
||||
atf_add_test_case shrink_32M_24M_v2_32768
|
||||
atf_add_test_case shrink_32M_24M_v2_65536
|
||||
atf_add_test_case shrink_48M_16M_v2_4096
|
||||
atf_add_test_case shrink_48M_16M_v2_8192
|
||||
atf_add_test_case shrink_48M_16M_v2_16384
|
||||
atf_add_test_case shrink_48M_16M_v2_32768
|
||||
atf_add_test_case shrink_48M_16M_v2_65536
|
||||
atf_add_test_case shrink_64M_48M_v2_4096
|
||||
atf_add_test_case shrink_64M_48M_v2_8192
|
||||
atf_add_test_case shrink_64M_48M_v2_16384
|
||||
atf_add_test_case shrink_64M_48M_v2_32768
|
||||
atf_add_test_case shrink_64M_48M_v2_65536
|
||||
fi
|
||||
atf_add_test_case shrink_ffsv1_partial_cg
|
||||
}
|
||||
18
tests/sbin/resize_ffs/testdata.md5
Normal file
18
tests/sbin/resize_ffs/testdata.md5
Normal file
@@ -0,0 +1,18 @@
|
||||
MD5 (1024) = eadce85bc513cc7b9b46c027ce07ccdb
|
||||
MD5 (1025) = 3cf2a95b3af7377ca81ff08265534334
|
||||
MD5 (131072) = 3bf5f82ad5e1f8878caa699548cc0955
|
||||
MD5 (131073) = 3423d2f10e3abb20e1ceae4b055f5071
|
||||
MD5 (16384) = 933f03c66d4e2da32089ed994c9b34bd
|
||||
MD5 (16385) = d0b296920f44ef298880a2d963066026
|
||||
MD5 (2048) = fb03fb8916dd57f9648f89a06bb46f06
|
||||
MD5 (2049) = f2e489640fc3af5f09352d27717d832e
|
||||
MD5 (32768) = d940d6ccf83aeb00e71b9bbeaf860962
|
||||
MD5 (32769) = 760e060cefd844c082a10b3bef1408f7
|
||||
MD5 (4096) = a04926ee9302f93a322e784a6b044577
|
||||
MD5 (4097) = bf13de3963f43a0ffaadb1c782b71372
|
||||
MD5 (512) = 991ad794ac386e8ba71d9bb64ab4c979
|
||||
MD5 (513) = ede1dc964fe2460dd74c3c87942162ad
|
||||
MD5 (65536) = 1ee304df7275d8f88c5c0650536c842c
|
||||
MD5 (65537) = 964632a8f1a323e31af6cf1297f88041
|
||||
MD5 (8192) = 51ce7789ae9662b2c13195573a447206
|
||||
MD5 (8193) = 35d478bc5fba0d96ffb318748d1035c7
|
||||
10938
tests/sbin/resize_ffs/testdata.tar.gz.base64
Normal file
10938
tests/sbin/resize_ffs/testdata.tar.gz.base64
Normal file
File diff suppressed because it is too large
Load Diff
9
tests/sbin/route/Makefile
Normal file
9
tests/sbin/route/Makefile
Normal file
@@ -0,0 +1,9 @@
|
||||
# $NetBSD: Makefile,v 1.1 2011/05/03 07:56:42 jruoho Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
TESTSDIR= ${TESTSBASE}/sbin/route
|
||||
|
||||
TESTS_SH= t_missing
|
||||
|
||||
.include <bsd.test.mk>
|
||||
45
tests/sbin/route/t_missing.sh
Normal file
45
tests/sbin/route/t_missing.sh
Normal file
@@ -0,0 +1,45 @@
|
||||
# $NetBSD: t_missing.sh,v 1.3 2012/03/17 08:34:55 jruoho Exp $
|
||||
#
|
||||
# Copyright (c) 2011 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This code is derived from software contributed to The NetBSD Foundation
|
||||
# by Jukka Ruohonen.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
atf_test_case missing
|
||||
missing_head() {
|
||||
atf_set "descr" "Check route(8) with a missing argument (PR bin/42179)"
|
||||
}
|
||||
|
||||
missing_body() {
|
||||
|
||||
atf_check -s exit:1 \
|
||||
-e not-inline:"route: writing to routing socket: Invalid argument\n" \
|
||||
route -n get
|
||||
}
|
||||
|
||||
atf_init_test_cases() {
|
||||
atf_add_test_case missing
|
||||
}
|
||||
9
tests/sbin/sysctl/Makefile
Normal file
9
tests/sbin/sysctl/Makefile
Normal file
@@ -0,0 +1,9 @@
|
||||
# $NetBSD: Makefile,v 1.2 2012/04/10 02:39:33 jruoho Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
TESTSDIR= ${TESTSBASE}/sbin/sysctl
|
||||
|
||||
TESTS_SH= t_perm t_sysctl
|
||||
|
||||
.include <bsd.test.mk>
|
||||
209
tests/sbin/sysctl/t_perm.sh
Normal file
209
tests/sbin/sysctl/t_perm.sh
Normal file
@@ -0,0 +1,209 @@
|
||||
# $NetBSD: t_perm.sh,v 1.6 2012/03/18 09:46:50 jruoho Exp $
|
||||
#
|
||||
# Copyright (c) 2011 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This code is derived from software contributed to The NetBSD Foundation
|
||||
# by Jukka Ruohonen.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
file="/tmp/d_sysctl.out"
|
||||
|
||||
clean() {
|
||||
|
||||
if [ -f $file ]; then
|
||||
rm $file
|
||||
fi
|
||||
}
|
||||
|
||||
sysctl_write() {
|
||||
|
||||
deadbeef="3735928559"
|
||||
|
||||
sysctl $1 | cut -d= -f1 > $file
|
||||
|
||||
if [ ! -f $file ]; then
|
||||
atf_fail "sysctl failed"
|
||||
fi
|
||||
|
||||
while read line; do
|
||||
|
||||
node=$(echo $line)
|
||||
|
||||
case $node in
|
||||
|
||||
"$1."*)
|
||||
atf_check -s not-exit:0 -e ignore \
|
||||
-x sysctl -w $node=$deadbeef
|
||||
;;
|
||||
esac
|
||||
|
||||
done < $file
|
||||
|
||||
# A functional verification that $deadbeef
|
||||
# was not actually written to the node.
|
||||
#
|
||||
if [ ! -z $(sysctl $1 | grep $deadbeef) ]; then
|
||||
atf_fail "value was written"
|
||||
fi
|
||||
}
|
||||
|
||||
# ddb.
|
||||
#
|
||||
atf_test_case sysctl_ddb cleanup
|
||||
sysctl_ddb_head() {
|
||||
atf_set "require.user" "unprivileged"
|
||||
atf_set "descr" "Test writing to 'ddb' sysctl node as an user"
|
||||
}
|
||||
|
||||
sysctl_ddb_body() {
|
||||
sysctl_write "ddb"
|
||||
}
|
||||
|
||||
sysctl_ddb_cleanup() {
|
||||
clean
|
||||
}
|
||||
|
||||
# hw.
|
||||
#
|
||||
atf_test_case sysctl_hw cleanup
|
||||
sysctl_hw_head() {
|
||||
atf_set "require.user" "unprivileged"
|
||||
atf_set "descr" "Test writing to 'hw' sysctl node as an user"
|
||||
}
|
||||
|
||||
sysctl_hw_body() {
|
||||
sysctl_write "hw"
|
||||
}
|
||||
|
||||
sysctl_hw_cleanup() {
|
||||
clean
|
||||
}
|
||||
|
||||
# kern.
|
||||
#
|
||||
atf_test_case sysctl_kern cleanup
|
||||
sysctl_kern_head() {
|
||||
atf_set "require.user" "unprivileged"
|
||||
atf_set "descr" "Test writing to 'kern' " \
|
||||
"sysctl node as an user (PR kern/44946)"
|
||||
}
|
||||
|
||||
sysctl_kern_body() {
|
||||
sysctl_write "kern"
|
||||
}
|
||||
|
||||
sysctl_kern_cleanup() {
|
||||
clean
|
||||
}
|
||||
|
||||
# machdep.
|
||||
#
|
||||
atf_test_case sysctl_machdep cleanup
|
||||
sysctl_machdep_head() {
|
||||
atf_set "require.user" "unprivileged"
|
||||
atf_set "descr" "Test writing to 'machdep' sysctl node as an user"
|
||||
}
|
||||
|
||||
sysctl_machdep_body() {
|
||||
sysctl_write "machdep"
|
||||
}
|
||||
|
||||
sysctl_machdep_cleanup() {
|
||||
clean
|
||||
}
|
||||
|
||||
# net.
|
||||
#
|
||||
atf_test_case sysctl_net cleanup
|
||||
sysctl_net_head() {
|
||||
atf_set "require.user" "unprivileged"
|
||||
atf_set "descr" "Test writing to 'net' sysctl node as an user"
|
||||
}
|
||||
|
||||
sysctl_net_body() {
|
||||
sysctl_write "net"
|
||||
}
|
||||
|
||||
sysctl_net_cleanup() {
|
||||
clean
|
||||
}
|
||||
|
||||
# security.
|
||||
#
|
||||
atf_test_case sysctl_security cleanup
|
||||
sysctl_security_head() {
|
||||
atf_set "require.user" "unprivileged"
|
||||
atf_set "descr" "Test writing to 'security' sysctl node as an user"
|
||||
}
|
||||
|
||||
sysctl_security_body() {
|
||||
sysctl_write "security"
|
||||
}
|
||||
|
||||
sysctl_security_cleanup() {
|
||||
clean
|
||||
}
|
||||
|
||||
# vfs.
|
||||
#
|
||||
atf_test_case sysctl_vfs cleanup
|
||||
sysctl_vfs_head() {
|
||||
atf_set "require.user" "unprivileged"
|
||||
atf_set "descr" "Test writing to 'vfs' sysctl node as an user"
|
||||
}
|
||||
|
||||
sysctl_vfs_body() {
|
||||
sysctl_write "vfs"
|
||||
}
|
||||
|
||||
sysctl_vfs_cleanup() {
|
||||
clean
|
||||
}
|
||||
|
||||
# vm.
|
||||
#
|
||||
atf_test_case sysctl_vm cleanup
|
||||
sysctl_vm_head() {
|
||||
atf_set "require.user" "unprivileged"
|
||||
atf_set "descr" "Test writing to 'vm' sysctl node as an user"
|
||||
}
|
||||
|
||||
sysctl_vm_body() {
|
||||
sysctl_write "vm"
|
||||
}
|
||||
|
||||
sysctl_vm_cleanup() {
|
||||
clean
|
||||
}
|
||||
|
||||
atf_init_test_cases() {
|
||||
atf_add_test_case sysctl_ddb
|
||||
atf_add_test_case sysctl_hw
|
||||
atf_add_test_case sysctl_kern
|
||||
atf_add_test_case sysctl_machdep
|
||||
atf_add_test_case sysctl_net
|
||||
atf_add_test_case sysctl_security
|
||||
atf_add_test_case sysctl_vfs
|
||||
atf_add_test_case sysctl_vm
|
||||
}
|
||||
44
tests/sbin/sysctl/t_sysctl.sh
Normal file
44
tests/sbin/sysctl/t_sysctl.sh
Normal file
@@ -0,0 +1,44 @@
|
||||
# $NetBSD: t_sysctl.sh,v 1.1 2012/04/10 02:39:33 jruoho Exp $
|
||||
#
|
||||
# Copyright (c) 2012 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This code is derived from software contributed to The NetBSD Foundation
|
||||
# by Jukka Ruohonen.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
atf_test_case basic
|
||||
basic_head() {
|
||||
atf_set "descr" "Test that sysctl(8) works"
|
||||
}
|
||||
|
||||
basic_body() {
|
||||
|
||||
atf_check -s exit:0 -o ignore -e empty -x "sysctl -a"
|
||||
}
|
||||
|
||||
atf_init_test_cases() {
|
||||
|
||||
atf_add_test_case basic
|
||||
}
|
||||
Reference in New Issue
Block a user