Perform quoting of variable expansions, etc correctly. That includes
(some) removing of quotes from where they're useless (superstition). This should be NFC for these tests, as the data being quoted doesn't happen to require it, but depending upon the data not altering, or the code not being copied to a different environment is unwise, when it is so easy to simply do it correctly. A few line wrapping and white space changes as well. Nothing changed here is intended to alter the way that the tests run, or results generated.
This commit is contained in:
parent
87f7d0994d
commit
5ae58755a4
|
@ -1,4 +1,4 @@
|
||||||
# $NetBSD: quotas_common.sh,v 1.2 2011/03/06 17:08:41 bouyer Exp $
|
# $NetBSD: quotas_common.sh,v 1.3 2023/09/26 12:15:44 kre Exp $
|
||||||
|
|
||||||
create_with_quotas()
|
create_with_quotas()
|
||||||
{
|
{
|
||||||
|
@ -7,13 +7,13 @@ create_with_quotas()
|
||||||
local uid=$(id -u)
|
local uid=$(id -u)
|
||||||
local gid=$(id -g)
|
local gid=$(id -g)
|
||||||
|
|
||||||
atf_check -o ignore -e ignore newfs -B ${endian} -O ${vers} \
|
atf_check -o ignore -e ignore newfs -B "${endian}" -O "${vers}" \
|
||||||
-s 4000 -F ${IMG}
|
-s 4000 -F "${IMG}"
|
||||||
atf_check -o ignore -e ignore tunefs -q user -q group -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\)' \
|
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: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' \
|
-o "match:GROUP QUOTA MISMATCH FOR ID ${gid}: 0/0 SHOULD BE 1/1" \
|
||||||
fsck_ffs -p -F ${IMG}
|
fsck_ffs -p -F "${IMG}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# from tests/ipf/h_common.sh via tests/sbin/resize_ffs
|
# from tests/ipf/h_common.sh via tests/sbin/resize_ffs
|
||||||
|
@ -25,20 +25,23 @@ test_case()
|
||||||
|
|
||||||
atf_test_case "${name}"
|
atf_test_case "${name}"
|
||||||
|
|
||||||
eval "${name}_head() { \
|
eval "${name}_head() {
|
||||||
atf_set "descr" "Checks ${descr} quotas inodes"
|
atf_set descr 'Checks ${descr} quotas inodes'
|
||||||
}"
|
}"
|
||||||
eval "${name}_body() { \
|
eval "${name}_body() {
|
||||||
${check_function} " "${@}" "; \
|
${check_function} $*
|
||||||
}"
|
}"
|
||||||
tests="${tests} ${name}"
|
tests="${tests} '${name}'"
|
||||||
}
|
}
|
||||||
|
|
||||||
atf_init_test_cases()
|
atf_init_test_cases()
|
||||||
{
|
{
|
||||||
IMG=fsimage
|
IMG=fsimage
|
||||||
DIR=target
|
DIR=target
|
||||||
for i in ${tests}; do
|
|
||||||
atf_add_test_case $i
|
eval "set -- ${tests}"
|
||||||
|
for i
|
||||||
|
do
|
||||||
|
atf_add_test_case "$i"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# $NetBSD: t_check_quotas.sh,v 1.2 2011/03/06 17:08:41 bouyer Exp $
|
# $NetBSD: t_check_quotas.sh,v 1.3 2023/09/26 12:15:44 kre Exp $
|
||||||
#
|
#
|
||||||
# Copyright (c) 2011 Manuel Bouyer
|
# Copyright (c) 2011 Manuel Bouyer
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
|
@ -27,27 +27,29 @@
|
||||||
|
|
||||||
for e in le be; do
|
for e in le be; do
|
||||||
for v in 1 2; do
|
for v in 1 2; do
|
||||||
test_case corrupt_list_${e}_${v} corrupt_list \
|
test_case "corrupt_list_${e}_${v}" corrupt_list \
|
||||||
"recovery of corrupted free list in" ${e} ${v}
|
"recovery of corrupted free list in" "${e}" "${v}"
|
||||||
test_case expand1_list_${e}_${v} expand_list \
|
test_case "expand1_list_${e}_${v}" expand_list \
|
||||||
"allocation of direct block in" 40 ${e} ${v}
|
"allocation of direct block in" 40 "${e}" "${v}"
|
||||||
test_case expand2_list_${e}_${v} expand_list \
|
test_case "expand2_list_${e}_${v}" expand_list \
|
||||||
"allocation of indirect block in" 1000 ${e} ${v}
|
"allocation of indirect block in" 1000 "${e}" "${v}"
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
corrupt_list()
|
corrupt_list()
|
||||||
{
|
{
|
||||||
create_with_quotas $*
|
create_with_quotas "$@"
|
||||||
local blkno=$(printf "inode 3\nblks\n" | /sbin/fsdb -nF -f ${IMG} | awk '$1 == "0:" {print $2}')
|
local blkno=$(printf "inode 3\nblks\n" |
|
||||||
|
/sbin/fsdb -nF -f "${IMG}" |
|
||||||
|
awk '$1 == "0:" {print $2}')
|
||||||
blkno=$(($blkno * 512 + 104))
|
blkno=$(($blkno * 512 + 104))
|
||||||
#clear the free list
|
#clear the free list
|
||||||
atf_check -o ignore -e ignore dd if=/dev/zero of=${IMG} bs=1 \
|
atf_check -o ignore -e ignore dd if=/dev/zero "of=${IMG}" bs=1 \
|
||||||
count=8 seek=${blkno} conv=notrunc
|
count=8 "seek=${blkno}" conv=notrunc
|
||||||
atf_check -s exit:0 \
|
atf_check -s exit:0 \
|
||||||
-o "match:QUOTA ENTRY NOT IN LIST \(FIXED\)" \
|
-o "match:QUOTA ENTRY NOT IN LIST \(FIXED\)" \
|
||||||
fsck_ffs -fp -F ${IMG}
|
fsck_ffs -fp -F "${IMG}"
|
||||||
atf_check -s exit:0 -o "match:3 files" fsck_ffs -nf -F ${IMG}
|
atf_check -s exit:0 -o "match:3 files" fsck_ffs -nf -F "${IMG}"
|
||||||
}
|
}
|
||||||
|
|
||||||
expand_list()
|
expand_list()
|
||||||
|
@ -57,17 +59,17 @@ expand_list()
|
||||||
echo "/set uid=0 gid=0" > spec
|
echo "/set uid=0 gid=0" > spec
|
||||||
echo ". type=dir mode=0755" >> spec
|
echo ". type=dir mode=0755" >> spec
|
||||||
mkdir ${DIR}
|
mkdir ${DIR}
|
||||||
for i in $(seq ${nuid}); do
|
for i in $(seq "${nuid}"); do
|
||||||
touch ${DIR}/f${i}
|
touch "${DIR}/f${i}"
|
||||||
echo "./f$i type=file mode=0600 uid=$i gid=$i" >> spec
|
echo "./f$i type=file mode=0600 uid=$i gid=$i" >> spec
|
||||||
done
|
done
|
||||||
|
|
||||||
atf_check -o ignore -e ignore makefs -B $1 -o version=$2 \
|
atf_check -o ignore -e ignore makefs -B "$1" -o "version=$2" \
|
||||||
-F spec -s 4000b ${IMG} ${DIR}
|
-F spec -s 4000b "${IMG}" "${DIR}"
|
||||||
atf_check -o ignore -e ignore tunefs -q user -F ${IMG}
|
atf_check -o ignore -e ignore tunefs -q user -F "${IMG}"
|
||||||
atf_check -s exit:0 -o 'match:NO USER QUOTA INODE \(CREATED\)' \
|
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' \
|
-o 'match:USER QUOTA MISMATCH FOR ID 10: 0/0 SHOULD BE 0/1' \
|
||||||
fsck_ffs -p -F ${IMG}
|
fsck_ffs -p -F "${IMG}"
|
||||||
atf_check -s exit:0 -o "match:${expected_files} files" \
|
atf_check -s exit:0 -o "match:${expected_files} files" \
|
||||||
fsck_ffs -nf -F ${IMG}
|
fsck_ffs -nf -F "${IMG}"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# $NetBSD: t_enable_quotas.sh,v 1.3 2021/09/16 22:19:12 andvar Exp $
|
# $NetBSD: t_enable_quotas.sh,v 1.4 2023/09/26 12:15:44 kre Exp $
|
||||||
#
|
#
|
||||||
# Copyright (c) 2011 Manuel Bouyer
|
# Copyright (c) 2011 Manuel Bouyer
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
|
@ -27,79 +27,84 @@
|
||||||
|
|
||||||
for e in le be; do
|
for e in le be; do
|
||||||
for v in 1 2; do
|
for v in 1 2; do
|
||||||
test_case disable_${e}_${v} disable_quotas "creation/removal of" ${e} ${v}
|
test_case "disable_${e}_${v}" disable_quotas \
|
||||||
test_case corrupt_${e}_${v} corrupt_quotas "repair of corrupted" ${e} ${v}
|
"creation/removal of" "${e}" "${v}"
|
||||||
test_case unallocated_${e}_${v} unallocated_quotas \
|
test_case "corrupt_${e}_${v}" corrupt_quotas \
|
||||||
"recovery of unallocated" ${e} ${v}
|
"repair of corrupted" "${e}" "${v}"
|
||||||
test_case dir1_${e}_${v} dir1_quotas \
|
test_case "unallocated_${e}_${v}" unallocated_quotas \
|
||||||
"successful clear of wrong type of" ${e} ${v}
|
"recovery of unallocated" "${e}" "${v}"
|
||||||
test_case notreg_${e}_${v} notreg_quotas \
|
test_case "dir1_${e}_${v}" dir1_quotas \
|
||||||
"successful clear of wrong type of" ${e} ${v}
|
"successful clear of wrong type of" "${e}" "${v}"
|
||||||
|
test_case "notreg_${e}_${v}" notreg_quotas \
|
||||||
|
"successful clear of wrong type of" "${e}" "${v}"
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
disable_quotas()
|
disable_quotas()
|
||||||
{
|
{
|
||||||
create_with_quotas $*
|
create_with_quotas "$@"
|
||||||
|
|
||||||
# check that the quota inode creation didn't corrupt the filesystem
|
# check that the quota inode creation didn't corrupt the filesystem
|
||||||
atf_check -s exit:0 -o "match:already clean" -o "match:3 files" \
|
atf_check -s exit:0 -o "match:already clean" -o "match:3 files" \
|
||||||
fsck_ffs -nf -F ${IMG}
|
fsck_ffs -nf -F "${IMG}"
|
||||||
#now check fsck can properly clear the quota inode when quota flags are
|
#now check fsck can properly clear the quota inode when quota flags are
|
||||||
# cleared
|
# cleared
|
||||||
atf_check -o ignore -e ignore tunefs -q nouser -q nogroup -F ${IMG}
|
atf_check -o ignore -e ignore tunefs -q nouser -q nogroup -F "${IMG}"
|
||||||
atf_check -s exit:0 -o "match:SUPERBLOCK QUOTA FLAG CLEARED" \
|
atf_check -s exit:0 -o "match:SUPERBLOCK QUOTA FLAG CLEARED" \
|
||||||
fsck_ffs -fp -F ${IMG}
|
fsck_ffs -fp -F "${IMG}"
|
||||||
atf_check -s exit:0 -o "match:1 files, 1 used" fsck_ffs -nf -F ${IMG}
|
atf_check -s exit:0 -o "match:1 files, 1 used" fsck_ffs -nf -F "${IMG}"
|
||||||
}
|
}
|
||||||
|
|
||||||
corrupt_quotas()
|
corrupt_quotas()
|
||||||
{
|
{
|
||||||
create_with_quotas $*
|
create_with_quotas "$@"
|
||||||
|
|
||||||
local blkno=$(printf "inode 3\nblks\n" | /sbin/fsdb -nF -f ${IMG} | awk '$1 == "0:" {print $2}')
|
local blkno=$(printf "inode 3\nblks\n" |
|
||||||
atf_check -o ignore -e ignore dd if=/dev/zero of=${IMG} bs=512 \
|
/sbin/fsdb -nF -f "${IMG}" |
|
||||||
count=1 seek=${blkno} conv=notrunc
|
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 \
|
atf_check -s exit:0 \
|
||||||
-o "match:CORRUPTED USER QUOTA INODE 3 \(CLEARED\)" \
|
-o "match:CORRUPTED USER QUOTA INODE 3 \(CLEARED\)" \
|
||||||
-o "match:NO USER QUOTA INODE \(CREATED\)" \
|
-o "match:NO USER QUOTA INODE \(CREATED\)" \
|
||||||
fsck_ffs -fp -F ${IMG}
|
fsck_ffs -fp -F "${IMG}"
|
||||||
atf_check -s exit:0 -o "match:3 files" fsck_ffs -nf -F ${IMG}
|
atf_check -s exit:0 -o "match:3 files" fsck_ffs -nf -F "${IMG}"
|
||||||
}
|
}
|
||||||
|
|
||||||
unallocated_quotas()
|
unallocated_quotas()
|
||||||
{
|
{
|
||||||
create_with_quotas $*
|
create_with_quotas "$@"
|
||||||
|
|
||||||
atf_check -o ignore -e ignore clri ${IMG} 3
|
atf_check -o ignore -e ignore clri "${IMG}" 3
|
||||||
atf_check -s exit:0 \
|
atf_check -s exit:0 \
|
||||||
-o "match:UNALLOCATED USER QUOTA INODE 3 \(CLEARED\)" \
|
-o "match:UNALLOCATED USER QUOTA INODE 3 \(CLEARED\)" \
|
||||||
-o "match:NO USER QUOTA INODE \(CREATED\)" \
|
-o "match:NO USER QUOTA INODE \(CREATED\)" \
|
||||||
fsck_ffs -fp -F ${IMG}
|
fsck_ffs -fp -F "${IMG}"
|
||||||
atf_check -s exit:0 -o "match:3 files" fsck_ffs -nf -F ${IMG}
|
atf_check -s exit:0 -o "match:3 files" fsck_ffs -nf -F "${IMG}"
|
||||||
}
|
}
|
||||||
|
|
||||||
dir1_quotas()
|
dir1_quotas()
|
||||||
{
|
{
|
||||||
create_with_quotas $*
|
create_with_quotas "$@"
|
||||||
|
|
||||||
atf_check -s exit:255 -o ignore -e ignore -x \
|
atf_check -s exit:255 -o ignore -e ignore -x \
|
||||||
"printf 'inode 3\nchtype dir\nexit\n' | fsdb -F -f ${IMG}"
|
"printf 'inode 3\nchtype dir\nexit\n' | fsdb -F -f '${IMG}'"
|
||||||
atf_check -s exit:0 \
|
atf_check -s exit:0 \
|
||||||
-o "match:DIR I=3 CONNECTED. PARENT WAS I=0" \
|
-o "match:DIR I=3 CONNECTED. PARENT WAS I=0" \
|
||||||
-o "match:USER QUOTA INODE 3 IS A DIRECTORY" \
|
-o "match:USER QUOTA INODE 3 IS A DIRECTORY" \
|
||||||
fsck_ffs -y -F ${IMG}
|
fsck_ffs -y -F "${IMG}"
|
||||||
}
|
}
|
||||||
|
|
||||||
notreg_quotas()
|
notreg_quotas()
|
||||||
{
|
{
|
||||||
create_with_quotas $*
|
create_with_quotas "$@"
|
||||||
|
|
||||||
atf_check -s exit:255 -o ignore -e ignore -x \
|
atf_check -s exit:255 -o ignore -e ignore -x \
|
||||||
"printf 'inode 3\nchtype fifo\nexit\n' | fsdb -F -f ${IMG}"
|
"printf 'inode 3\nchtype fifo\nexit\n' | fsdb -F -f '${IMG}'"
|
||||||
atf_check -s exit:0 \
|
atf_check -s exit:0 \
|
||||||
-o "match:WRONG TYPE 4096 for USER QUOTA INODE 3 \(CLEARED\)" \
|
-o "match:WRONG TYPE 4096 for USER QUOTA INODE 3 \(CLEARED\)" \
|
||||||
-o "match:NO USER QUOTA INODE \(CREATED\)" \
|
-o "match:NO USER QUOTA INODE \(CREATED\)" \
|
||||||
fsck_ffs -p -F ${IMG}
|
fsck_ffs -p -F "${IMG}"
|
||||||
atf_check -s exit:0 -o "match:3 files" fsck_ffs -nf -F ${IMG}
|
atf_check -s exit:0 -o "match:3 files" fsck_ffs -nf -F "${IMG}"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# $NetBSD: t_extattr.sh,v 1.4 2022/11/30 07:20:36 martin Exp $
|
# $NetBSD: t_extattr.sh,v 1.5 2023/09/26 12:15:44 kre Exp $
|
||||||
#
|
#
|
||||||
# Copyright (c) 2021 The NetBSD Foundation, Inc.
|
# Copyright (c) 2021 The NetBSD Foundation, Inc.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
|
@ -38,8 +38,8 @@ atf_test_case fsck_extattr_disable cleanup
|
||||||
cleanup()
|
cleanup()
|
||||||
{
|
{
|
||||||
echo in cleanup
|
echo in cleanup
|
||||||
umount -f ${MNT} > /dev/null 2>&1 || true
|
umount -f "${MNT}" > /dev/null 2>&1 || true
|
||||||
vnconfig -u ${VND} > /dev/null 2>&1 || true
|
vnconfig -u "${VND}" > /dev/null 2>&1 || true
|
||||||
}
|
}
|
||||||
|
|
||||||
fsck_extattr_enable_head()
|
fsck_extattr_enable_head()
|
||||||
|
@ -50,32 +50,32 @@ fsck_extattr_enable_head()
|
||||||
|
|
||||||
fsck_extattr_enable_body()
|
fsck_extattr_enable_body()
|
||||||
{
|
{
|
||||||
atf_check mkdir -p ${MNT}
|
atf_check mkdir -p "${MNT}"
|
||||||
|
|
||||||
atf_check -o ignore newfs -O2 -s 4m -F ${IMG}
|
atf_check -o ignore newfs -O2 -s 4m -F "${IMG}"
|
||||||
atf_check vnconfig ${VND} ${IMG}
|
atf_check vnconfig "${VND}" "${IMG}"
|
||||||
|
|
||||||
# Verify that extattrs are disabled.
|
# Verify that extattrs are disabled.
|
||||||
atf_check -o ignore -e 'match:POSIX1e ACLs not supported by this fs' \
|
atf_check -o ignore -e 'match:POSIX1e ACLs not supported by this fs' \
|
||||||
tunefs -p enable ${CDEV}
|
tunefs -p enable "${CDEV}"
|
||||||
atf_check mount -t ffs ${BDEV} ${MNT}
|
atf_check mount -t ffs "${BDEV}" "${MNT}"
|
||||||
atf_check touch ${MNT}/file
|
atf_check touch "${MNT}/file"
|
||||||
atf_check -s exit:1 -e ignore setextattr user name1 value1 ${MNT}/file
|
atf_check -s exit:1 -e ignore setextattr user name1 value1 "${MNT}/file"
|
||||||
atf_check umount ${MNT}
|
atf_check umount "${MNT}"
|
||||||
|
|
||||||
# Enable extattrs.
|
# Enable extattrs.
|
||||||
atf_check -o 'match:ENABLING EXTATTR SUPPORT' \
|
atf_check -o 'match:ENABLING EXTATTR SUPPORT' \
|
||||||
fsck_ffs -c ea ${CDEV}
|
fsck_ffs -c ea "${CDEV}"
|
||||||
|
|
||||||
# Verify that extattrs are now enabled.
|
# Verify that extattrs are now enabled.
|
||||||
atf_check -o 'match:POSIX1e ACLs set' -e ignore \
|
atf_check -o 'match:POSIX1e ACLs set' -e ignore \
|
||||||
tunefs -p enable ${CDEV}
|
tunefs -p enable "${CDEV}"
|
||||||
atf_check mount -t ffs ${BDEV} ${MNT}
|
atf_check mount -t ffs "${BDEV}" "${MNT}"
|
||||||
atf_check touch ${MNT}/file
|
atf_check touch "${MNT}/file"
|
||||||
atf_check setextattr user testname testvalue ${MNT}/file
|
atf_check setextattr user testname testvalue "${MNT}/file"
|
||||||
atf_check -o 'match:testvalue' getextattr user testname ${MNT}/file
|
atf_check -o 'match:testvalue' getextattr user testname "${MNT}/file"
|
||||||
atf_check umount ${MNT}
|
atf_check umount "${MNT}"
|
||||||
atf_check vnconfig -u ${VND}
|
atf_check vnconfig -u "${VND}"
|
||||||
}
|
}
|
||||||
|
|
||||||
fsck_extattr_enable_cleanup()
|
fsck_extattr_enable_cleanup()
|
||||||
|
@ -91,49 +91,55 @@ fsck_extattr_enable_corrupted_head()
|
||||||
|
|
||||||
fsck_extattr_enable_corrupted_body()
|
fsck_extattr_enable_corrupted_body()
|
||||||
{
|
{
|
||||||
atf_check mkdir -p ${MNT}
|
atf_check mkdir -p "${MNT}"
|
||||||
|
|
||||||
# Create an fs with extattrs enabled and set an extattr on the test file.
|
# Create an fs with extattrs enabled and set an extattr on the test file.
|
||||||
atf_check -o ignore newfs -O2ea -b 8k -f 1k -s 4m -F ${IMG}
|
atf_check -o ignore newfs -O2ea -b 8k -f 1k -s 4m -F "${IMG}"
|
||||||
atf_check vnconfig ${VND} ${IMG}
|
atf_check vnconfig "${VND}" "${IMG}"
|
||||||
|
|
||||||
atf_check mount -t ffs ${BDEV} ${MNT}
|
atf_check mount -t ffs "${BDEV}" "${MNT}"
|
||||||
atf_check touch ${MNT}/file
|
atf_check touch "${MNT}/file"
|
||||||
atf_check setextattr user testname testvalue ${MNT}/file
|
atf_check setextattr user testname testvalue "${MNT}/file"
|
||||||
atf_check -o 'match:testvalue' getextattr user testname ${MNT}/file
|
atf_check -o 'match:testvalue' getextattr user testname "${MNT}/file"
|
||||||
atf_check umount ${MNT}
|
atf_check umount "${MNT}"
|
||||||
|
|
||||||
# Find the location and size of the extattr block.
|
# Find the location and size of the extattr block.
|
||||||
extb0=$(printf 'cd file\niptrs\n' | fsdb -n $CDEV | grep 'di_extb 0' |
|
extb0=$(printf 'cd file\niptrs\n' |
|
||||||
|
fsdb -n "$CDEV" |
|
||||||
|
grep 'di_extb 0' |
|
||||||
awk '{print $3}')
|
awk '{print $3}')
|
||||||
extsize=$(printf 'cd file\n' | fsdb -n $CDEV | grep EXTSIZE | tail -1 |
|
extsize=$(printf 'cd file\n' |
|
||||||
awk '{print $4}' | sed 's,.*=,,')
|
fsdb -n "$CDEV" |
|
||||||
atf_check [ $extb0 != 0 ]
|
grep EXTSIZE |
|
||||||
atf_check [ $extsize != 0 ]
|
tail -n 1 |
|
||||||
|
awk '{print $4}' |
|
||||||
|
sed 's,.*=,,')
|
||||||
|
atf_check [ "$extb0" != 0 ]
|
||||||
|
atf_check [ "$extsize" != 0 ]
|
||||||
|
|
||||||
# Recreate the fs with extattrs disabled and set the extattr block
|
# Recreate the fs with extattrs disabled and set the extattr block
|
||||||
# size/location of the new test file to the same values as the old
|
# size/location of the new test file to the same values as the old
|
||||||
# test file. This simulates extattrs having been created in a
|
# test file. This simulates extattrs having been created in a
|
||||||
# UFS2-non-ea file system before UFS2ea was invented.
|
# UFS2-non-ea file system before UFS2ea was invented.
|
||||||
atf_check -o ignore newfs -O2 -b 8k -f 1k -s 4m -F ${IMG}
|
atf_check -o ignore newfs -O2 -b 8k -f 1k -s 4m -F "${IMG}"
|
||||||
atf_check mount -t ffs ${BDEV} ${MNT}
|
atf_check mount -t ffs "${BDEV}" "${MNT}"
|
||||||
atf_check touch ${MNT}/file
|
atf_check touch "${MNT}/file"
|
||||||
atf_check umount ${MNT}
|
atf_check umount "${MNT}"
|
||||||
printf "cd file\nchextb 0 $extb0\n" | fsdb -N $CDEV
|
printf "cd file\nchextb 0 $extb0\n" | fsdb -N "$CDEV"
|
||||||
printf "cd file\nchextsize $extsize\n" | fsdb -N $CDEV
|
printf "cd file\nchextsize $extsize\n" | fsdb -N "$CDEV"
|
||||||
|
|
||||||
# Convert to enable extattrs.
|
# Convert to enable extattrs.
|
||||||
atf_check -o 'match:CLEAR EXTATTR FIELDS' \
|
atf_check -o 'match:CLEAR EXTATTR FIELDS' \
|
||||||
-o 'match:ENABLING EXTATTR SUPPORT' \
|
-o 'match:ENABLING EXTATTR SUPPORT' \
|
||||||
fsck_ffs -y -c ea ${CDEV}
|
fsck_ffs -y -c ea "${CDEV}"
|
||||||
|
|
||||||
# Verify that the test file does not have the extattr.
|
# Verify that the test file does not have the extattr.
|
||||||
atf_check -o ignore fsck_ffs -n ${CDEV}
|
atf_check -o ignore fsck_ffs -n "${CDEV}"
|
||||||
atf_check mount -t ffs ${BDEV} ${MNT}
|
atf_check mount -t ffs "${BDEV}" "${MNT}"
|
||||||
atf_check -s exit:1 -e 'match:Attribute not found' \
|
atf_check -s exit:1 -e 'match:Attribute not found' \
|
||||||
getextattr user testname ${MNT}/file
|
getextattr user testname "${MNT}/file"
|
||||||
atf_check umount ${MNT}
|
atf_check umount "${MNT}"
|
||||||
atf_check vnconfig -u ${VND}
|
atf_check vnconfig -u "${VND}"
|
||||||
}
|
}
|
||||||
|
|
||||||
fsck_extattr_enable_corrupted_cleanup()
|
fsck_extattr_enable_corrupted_cleanup()
|
||||||
|
@ -149,42 +155,43 @@ fsck_extattr_disable_head()
|
||||||
|
|
||||||
fsck_extattr_disable_body()
|
fsck_extattr_disable_body()
|
||||||
{
|
{
|
||||||
atf_check mkdir -p ${MNT}
|
atf_check mkdir -p "${MNT}"
|
||||||
|
|
||||||
# Create an fs with extattrs enabled and set an extattr on the test file.
|
# Create an fs with extattrs enabled and set an extattr on the test file.
|
||||||
atf_check -o ignore newfs -O2ea -b 8k -f 1k -s 4m -F ${IMG}
|
atf_check -o ignore newfs -O2ea -b 8k -f 1k -s 4m -F "${IMG}"
|
||||||
atf_check vnconfig ${VND} ${IMG}
|
atf_check vnconfig "${VND}" "${IMG}"
|
||||||
|
|
||||||
atf_check mount -t ffs ${BDEV} ${MNT}
|
atf_check mount -t ffs "${BDEV}" "${MNT}"
|
||||||
atf_check touch ${MNT}/file
|
atf_check touch "${MNT}/file"
|
||||||
atf_check setextattr user testname testvalue ${MNT}/file
|
atf_check setextattr user testname testvalue "${MNT}/file"
|
||||||
atf_check -o 'match:testvalue' getextattr user testname ${MNT}/file
|
atf_check -o 'match:testvalue' getextattr user testname "${MNT}/file"
|
||||||
atf_check umount ${MNT}
|
atf_check umount "${MNT}"
|
||||||
|
|
||||||
# Convert to disable extattrs.
|
# Convert to disable extattrs.
|
||||||
atf_check -o 'match:CLEAR EXTATTR FIELDS' \
|
atf_check -o 'match:CLEAR EXTATTR FIELDS' \
|
||||||
-o 'match:DISABLING EXTATTR SUPPORT' \
|
-o 'match:DISABLING EXTATTR SUPPORT' \
|
||||||
fsck_ffs -y -c no-ea ${CDEV}
|
fsck_ffs -y -c no-ea "${CDEV}"
|
||||||
|
|
||||||
# Verify that the test file does not have the test extattr.
|
# Verify that the test file does not have the test extattr.
|
||||||
atf_check -o ignore fsck_ffs -n ${CDEV}
|
atf_check -o ignore fsck_ffs -n "${CDEV}"
|
||||||
atf_check mount -t ffs ${BDEV} ${MNT}
|
atf_check mount -t ffs "${BDEV}" "${MNT}"
|
||||||
atf_check -s exit:1 -e 'match:getextattr: mnt/file: failed: Operation not supported' \
|
atf_check -s exit:1 \
|
||||||
getextattr user testname ${MNT}/file
|
-e 'match:getextattr: mnt/file: failed: Operation not supported' \
|
||||||
atf_check umount ${MNT}
|
getextattr user testname "${MNT}/file"
|
||||||
|
atf_check umount "${MNT}"
|
||||||
|
|
||||||
# Convert to enable extattrs again.
|
# Convert to enable extattrs again.
|
||||||
atf_check -o 'match:ENABLING EXTATTR SUPPORT' \
|
atf_check -o 'match:ENABLING EXTATTR SUPPORT' \
|
||||||
fsck_ffs -y -c ea ${CDEV}
|
fsck_ffs -y -c ea ${CDEV}
|
||||||
|
|
||||||
# Verify that the test extattr is still gone.
|
# Verify that the test extattr is still gone.
|
||||||
atf_check -o ignore fsck_ffs -n ${CDEV}
|
atf_check -o ignore fsck_ffs -n "${CDEV}"
|
||||||
atf_check mount -t ffs ${BDEV} ${MNT}
|
atf_check mount -t ffs "${BDEV}" "${MNT}"
|
||||||
atf_check -s exit:1 -e 'match:Attribute not found' \
|
atf_check -s exit:1 -e 'match:Attribute not found' \
|
||||||
getextattr user testname ${MNT}/file
|
getextattr user testname "${MNT}/file"
|
||||||
atf_check umount ${MNT}
|
atf_check umount "${MNT}"
|
||||||
|
|
||||||
atf_check vnconfig -u ${VND}
|
atf_check vnconfig -u "${VND}"
|
||||||
}
|
}
|
||||||
|
|
||||||
fsck_extattr_disable_cleanup()
|
fsck_extattr_disable_cleanup()
|
||||||
|
|
Loading…
Reference in New Issue