[Ocfs2-test-devel] [PATCH 1/1] Ocfs2-tests: Add additional func tests for xattr v2.
Tristan Ye
tristan.ye at oracle.com
Mon Dec 8 01:06:20 PST 2008
>From v1 to v2:
Add testcases for inline-data & inline-xattr combination test
1) Filling-up test: inline-data consume less than (or equal to) max_inline_data - 256,
inline-xattr consume less or equal than 256
2) Disable inline-xattr test: inline-data consume more than max_inline_data - 256,which cause
inline-xattr disabled.
3) Disable inline-xattr test: shrink inline-data size to less than(or equal to) max_inline_data -
256, which re-enable the inline-xattr.
4) Inline xattr reservation test: add inline-xattr entry first(to reserve the last 256 bytes), then try
to fill the inodes with inline-data to see if inline-xattr will get affected.
Tao,tiger,
I will push this into ocfs2-test.git until tiger's xattr support for debugfs.ocfs2 get offically released.
currently, you can use this enhanced xattr single-node testing tools for testing when you posting new
patches set.
Signed-off-by: Tristan Ye <tristan.ye at oracle.com>
---
programs/xattr_tests/xattr-single-run.sh | 566 +++++++++++++++++++++++++++++-
1 files changed, 559 insertions(+), 7 deletions(-)
diff --git a/programs/xattr_tests/xattr-single-run.sh b/programs/xattr_tests/xattr-single-run.sh
index 4a54caa..e404a74 100755
--- a/programs/xattr_tests/xattr-single-run.sh
+++ b/programs/xattr_tests/xattr-single-run.sh
@@ -32,9 +32,11 @@ SUDO="`which sudo` -u root"
RM="`which rm`"
MKDIR="`which mkdir`"
TOUCH_BIN="`which touch`"
+DD_BIN="`which dd`"
MOUNT_BIN="`which sudo` -u root `which mount`"
UMOUNT_BIN="`which sudo` -u root `which umount`"
MKFS_BIN="`which sudo` -u root `which mkfs.ocfs2`"
+DEBUGFS_BIN="`which sudo` -u root `which debugfs.ocfs2`"
XATTR_TEST_BIN="`which sudo` -u root ${BINDIR}/xattr-test"
DEFAULT_LOG="xattr-test-logs"
@@ -48,17 +50,24 @@ BLOCKSIZE=
CLUSTERSIZE=
BLOCKNUMS=
-
WORKPLACE=
-EXECUTE=1
-KILL_TEST=0
-GET_STATUS=0
+COMBIN_TEST=
+declare -i MAX_SMALL_INLINE_XATTR
+declare -i MAX_LARGE_INLINE_XATTR
+declare -i MAX_SMALL_BLOCK_XATTR
+declare -i MAX_LARGE_BLOCK_XATTR
+
+declare -i MAX_INLINE_DATA
+declare -i MAX_INLINE_XATTR
+
declare -i ITERATIONS
declare -i EA_NUMS
declare -i EA_NAME_LEN
declare -i EA_VALUE_SIZE
+declare -i i
+
set -o pipefail
BOOTUP=color
@@ -117,7 +126,8 @@ exit_or_not()
################################################################################
f_usage()
{
- echo "usage: `basename ${0}` [-o output_log_dir] <-d <device>> <mountpoint path>"
+ echo "usage: `basename ${0}` [-c] [-o output_log_dir] <-d <device>> <mountpoint path>"
+ echo " -c enable the combination test for inline-data and inline-xattr."
echo " -o output directory for the logs"
echo " -d specify the device which has been formated as an ocfs2 volume."
echo " <mountpoint path> path of mountpoint where the ocfs2 volume will be mounted on."
@@ -132,8 +142,9 @@ f_getoptions()
exit 1
fi
- while getopts "i:x:n:l:s:ko:d:" options; do
+ while getopts "cho:d:" options; do
case $options in
+ c ) COMBIN_TEST="1";;
o ) LOG_OUT_DIR="$OPTARG";;
d ) OCFS2_DEVICE="$OPTARG";;
h ) f_usage
@@ -186,7 +197,11 @@ f_do_mkfs_and_mount()
{
echo -n "Mkfsing device:"|tee -a ${RUN_LOG_FILE}
- echo y|${MKFS_BIN} --fs-features=xattr -b ${BLOCKSIZE} -C ${CLUSTERSIZE} -N 4 ${OCFS2_DEVICE} ${BLOCKNUMS}>>${RUN_LOG_FILE} 2>&1
+ if [ -z "${COMBIN_TEST}" ];then
+ echo y|${MKFS_BIN} --fs-features=xattr -b ${BLOCKSIZE} -C ${CLUSTERSIZE} -N 4 ${OCFS2_DEVICE} ${BLOCKNUMS}>>${RUN_LOG_FILE} 2>&1
+ else
+ echo y|${MKFS_BIN} --fs-features=xattr,inline-data -b ${BLOCKSIZE} -C ${CLUSTERSIZE} -N 4 ${OCFS2_DEVICE} ${BLOCKNUMS}>>${RUN_LOG_FILE} 2>&1
+ fi
RET=$?
echo_status ${RET} |tee -a ${RUN_LOG_FILE}
exit_or_not ${RET}
@@ -218,6 +233,516 @@ f_do_umount()
exit_or_not ${RET}
}
+f_is_xattr_inlined()
+{
+ #${1} is test file
+ #${2} is target volume
+
+ ${DEBUGFS_BIN} -R "xattr ${1}" ${2}|grep -qi "block" || {
+ return 0
+ }
+
+ return 1
+}
+
+f_is_xattr_bucketed()
+{
+ #${1} is test file
+ #${2} is target volume
+
+ ${DEBUGFS_BIN} -R "xattr ${1}" ${2}|grep -qi "bucket" || {
+ return 0
+ }
+
+ return 1
+}
+
+#
+# Insert xattr entries with given number and mode
+# ${1} specify entry type(small or large)
+# ${2} specify file name
+# ${3} specify entry number
+#
+f_insert_xattrs()
+{
+ local XATTR_NAME_PREFIX=
+ local XATTR_VALUE_PREFIX=
+ local FILENAME=${2}
+ local ENTRY_NUM=${3}
+ local XATTR_NAME=
+ local XATTR_VALUE=
+ local LARGE_VALUE_LESS_THAN_80="largelargelargelargelargelargelargelargelargelargelargelargelargelargelarge."
+
+
+ if [ "x${1}" = "xsmall" ];then
+ XATTR_NAME_PREFIX="user."
+ XATTR_VALUE_PREFIX=""
+ else
+ XATTR_NAME_PREFIX="user.large."
+ XATTR_VALUE_PREFIX=${LARGE_VALUE_LESS_THAN_80}
+
+ fi
+
+ for i in $(seq ${ENTRY_NUM});do
+ XATTR_NAME="${XATTR_NAME_PREFIX}${i}"
+ XATTR_VALUE="${XATTR_VALUE_PREFIX}${i}"
+ ${SETXATTR} -n ${XATTR_NAME} -v ${XATTR_VALUE} ${FILENAME} >>${DETAIL_LOG_FILE} 2>&1
+ exit_or_not $?
+ done
+
+ return $?
+
+}
+
+#
+# Make inline-xattr firstly extented with small or large files increasing.
+# ${1} stands for entry type(small or large)
+# ${2} stands for file name
+# ${3} should be block or bucket
+# block: extend inlined xattr to block.
+# xattr: extend block to bucket.
+#
+f_extend_xattr()
+{
+ local XATTR_NAME_PREFIX=
+ local XATTR_VALUE_PREFIX=
+ local FILENAME=${2}
+ local EXTEND_TYPE=${3}
+ local XATTR_NAME=
+ local XATTR_VALUE=
+ local LARGE_VALUE_LESS_THAN_80="largelargelargelargelargelargelargelargelargelargelargelargelargelargelarge."
+
+
+ if [ "x${1}" = "xsmall" ];then
+ XATTR_NAME_PREFIX="user."
+ XATTR_VALUE_PREFIX=""
+ else
+ XATTR_NAME_PREFIX="user.large."
+ XATTR_VALUE_PREFIX=${LARGE_VALUE_LESS_THAN_80}
+
+ fi
+
+ i=1
+ while : ;do
+ XATTR_NAME="${XATTR_NAME_PREFIX}${i}"
+ XATTR_VALUE="${XATTR_VALUE_PREFIX}${i}"
+ ${SETXATTR} -n ${XATTR_NAME} -v ${XATTR_VALUE} ${FILENAME} >>${DETAIL_LOG_FILE} 2>&1
+ exit_or_not $?
+ sync
+
+ if [ "x${EXTEND_TYPE}" = "xblock" ];then
+ f_is_xattr_inlined ${DEBUG_TEST_FILE} ${OCFS2_DEVICE} || {
+ break
+ }
+ else
+
+ f_is_xattr_bucketed ${DEBUG_TEST_FILE} ${OCFS2_DEVICE} || {
+ break
+ }
+
+ fi
+
+ ((i++))
+ done
+
+ return $?
+}
+
+f_get_max_inline_size()
+{
+ TMP_FILE=${MOUNT_POINT}/.xattr-inline-data-tmp-file.$$
+ DEBUG_TMP_FILE=/.xattr-inline-data-tmp-file.$$
+
+ ${TOUCH_BIN} ${TMP_FILE}
+
+ ${DD_BIN} if=/dev/zero of=${TMP_FILE} bs=1 count=1 &>/dev/null
+ sync
+
+ MAX_INLINE_DATA=`${DEBUGFS_BIN} -R "stat ${DEBUG_TMP_FILE}" ${OCFS2_DEVICE} | grep -i inline | grep -i data | grep -i max | awk '{print $4}'`
+
+ ${SETXATTR} -n "user.test" -v "test" ${TMP_FILE}
+ sync
+
+ MAX_INLINE_XATTR=`${DEBUGFS_BIN} -R "stat ${DEBUG_TMP_FILE}" ${OCFS2_DEVICE} | grep Xattr | grep Inline | grep -i size | awk '{print $7}'`
+
+ ${RM} -rf ${TMP_FILE}
+}
+
+f_combin_test()
+{
+ SUB_TESTNO=1
+ TEST_FILE=${WORKPLACE}/xattr-inline-data-combin-test-file
+ DEBUG_TEST_FILE=/xattr_test_place/xattr-inline-data-combin-test-file
+
+ LARGE_VALUE_LESS_THAN_80="largelargelargelargelargelargelargelargelargelargelargelargelargelargelarge"
+ LARGE_VALUE_MORE_THAN_80="largelargelargelargelargelargelargelargelargelargelargelargelargelargelargelargelarge"
+
+ echo "Test ${SUB_TESTNO}: Inline Data&Xattr Filling Up Test." >>${DETAIL_LOG_FILE}
+ f_get_max_inline_size
+ ${TOUCH_BIN} ${TEST_FILE}
+
+ ${DD_BIN} if=/dev/zero of=${TEST_FILE} bs=1 count=$((${MAX_INLINE_DATA}-${MAX_INLINE_XATTR})) 2>>${DETAIL_LOG_FILE} >/dev/null
+ exit_or_not $?
+
+ f_insert_xattrs "small" ${TEST_FILE} ${MAX_SMALL_INLINE_XATTR}
+ exit_or_not $?
+
+ # Extend the inline-xattr and inline-data
+ echo "e">>${TEST_FILE}
+ ${SETXATTR} -n "user.small" -v "SMALL" ${TEST_FILE}
+ exit_or_not $?
+
+ #Delete last EA entry to shrink.
+ ${SETXATTR} -x "user.small" ${TEST_FILE}
+ exit_or_not $?
+
+ #Truncate inline-data to shrink.
+ ${DD_BIN} if=/dev/zero of=${TEST_FILE} bs=1 count=$((${MAX_INLINE_DATA}-${MAX_INLINE_XATTR})) 2>>${DETAIL_LOG_FILE} >/dev/null
+ exit_or_not $?
+
+ #Replace last EA entry to extend.
+ XATTR_NAME="user.${i}"
+ ${SETXATTR} -n "${XATTR_NAME}" -v "${LARGE_VALUE_LESS_THAN_80}" ${TEST_FILE}
+ exit_or_not $?
+
+ ${RM} -rf ${TEST_FILE}
+ ${TOUCH_BIN} ${TEST_FILE}
+ ((SUB_TESTNO++))
+
+ echo "Test ${SUB_TESTNO}: Disable&Enable Inline Xattr Test." >>${DETAIL_LOG_FILE}
+ ${DD_BIN} if=/dev/zero of=${TEST_FILE} bs=1 count=$((${MAX_INLINE_DATA}-${MAX_INLINE_XATTR}+1)) 2>>${DETAIL_LOG_FILE} >/dev/null
+ ${SETXATTR} -n "user.small" -v "SMALL" ${TEST_FILE}
+ exit_or_not $?
+
+ sync
+ ${DEBUGFS_BIN} -R "xattr ${DEBUG_TEST_FILE}" ${OCFS2_DEVICE}|grep -qi block || {
+ echo "Xattr entry inserted here should be extended into outside block.">>${DETAIL_LOG_FILE}
+ return 1
+ }
+
+ ${DD_BIN} if=/dev/zero of=${TEST_FILE} bs=1 count=$((${MAX_INLINE_DATA}-${MAX_INLINE_XATTR})) 2>>${DETAIL_LOG_FILE} >/dev/null
+ ${SETXATTR} -n "user.small" -v "SMALL" ${TEST_FILE}
+ exit_or_not $?
+
+ sync
+ ${DEBUGFS_BIN} -R "stat ${DEBUG_TEST_FILE}" ${OCFS2_DEVICE}|grep -qi InlineXattr || {
+ echo "Xattr entry inserted here should be inlined.">>${DETAIL_LOG_FILE}
+ return 1
+ }
+
+ ${RM} -rf ${TEST_FILE}
+ ${TOUCH_BIN} ${TEST_FILE}
+ ((SUB_TESTNO++))
+
+ echo "Test ${SUB_TESTNO}: Inline Xattr Reservation Test." >>${DETAIL_LOG_FILE}
+ # Reserve 256 bytes for inline-xattr
+ ${SETXATTR} -n "user.small" -v "SMALL" ${TEST_FILE}
+ exit_or_not $?
+
+ ${DD_BIN} if=/dev/zero of=${TEST_FILE} bs=1 count=$((${MAX_INLINE_DATA}-${MAX_INLINE_XATTR})) 2>>${DETAIL_LOG_FILE} >/dev/null
+ echo "a" >> ${TEST_FILE}
+
+ sync
+ ${DEBUGFS_BIN} -R "stat ${DEBUG_TEST_FILE}" ${OCFS2_DEVICE}|grep -qi InlineData && {
+ echo "Inline data should not invade reserved inline-xattr space.xxxxx">>${DETAIL_LOG_FILE}
+ return 1
+ }
+
+ ${RM} -rf ${TEST_FILE}
+ ${TOUCH_BIN} ${TEST_FILE}
+
+ ${SETXATTR} -n "user.small" -v "SMALL" ${TEST_FILE}
+ exit_or_not $?
+
+ ${SETXATTR} -x "user.small" ${TEST_FILE}
+ exit_or_not $?
+
+ ${DD_BIN} if=/dev/zero of=${TEST_FILE} bs=1 count=$((${MAX_INLINE_DATA}-${MAX_INLINE_XATTR}+1)) 2>>${DETAIL_LOG_FILE} >/dev/null
+ exit_or_not $?
+
+ sync
+ ${DEBUGFS_BIN} -R "stat ${DEBUG_TEST_FILE}" ${OCFS2_DEVICE}|grep -i InlineData && {
+ echo "Inline data should not invade reserved inline-xattr space.yyyy">>${DETAIL_LOG_FILE}
+ retun 1
+ }
+
+ ${RM} -rf ${TEST_FILE}
+ ((SUB_TESTNO++))
+
+ return 0
+}
+
+f_add_func_test()
+{
+ SUB_TESTNO=1
+ TEST_FILE=${WORKPLACE}/additional-func-test-file
+ DEBUG_TEST_FILE=/xattr_test_place/additional-func-test-file
+ LARGE_VALUE_LESS_THAN_80="largelargelargelargelargelargelargelargelargelargelargelargelargelargelarge"
+ LARGE_VALUE_MORE_THAN_80="largelargelargelargelargelargelargelargelargelargelargelargelargelargelargelargelarge"
+
+ ${TOUCH_BIN} ${TEST_FILE}
+
+ echo "Test ${SUB_TESTNO}: None Xattr Test.">>${DETAIL_LOG_FILE}
+
+ DUMMY_NAME="user.dummy"
+ EMPTY_NAME=" "
+ INVALID_NAME="user."
+
+ for ea_name in ${DUMMY_NAME} ${EMPTY_NAME} ${INVALID_NAME};do
+ ${GETXATTR} -n ${ea_name} ${TEST_FILE} >>${DETAIL_LOG_FILE} 2>&1
+ RET=$?
+ #if [ "${RET}" = "0" ];then
+ # echo "Should not get a entry from a None-xattr file.">>${DETAIL_LOG_FILE} 2>&1
+ # echo_failure | tee -a ${RUN_LOG_FILE}
+ # echo | tee -a ${RUN_LOG_FILE}
+ # exit 1
+
+ #fi
+ done;
+
+ ((SUB_TESTNO++))
+
+ echo "Test ${SUB_TESTNO}: Simple In-inode-xattr Test.">>${DETAIL_LOG_FILE}
+ # Add a small ea in inode
+ XATTR_NAME="user.small"
+ XATTR_VALUE="smallvalue"
+
+ ${SETXATTR} -n ${XATTR_NAME} -v ${XATTR_VALUE} ${TEST_FILE} >>${DETAIL_LOG_FILE} 2>&1
+ exit_or_not $?
+
+ ${SETXATTR} -x ${XATTR_NAME} ${TEST_FILE} >>${DETAIL_LOG_FILE} 2>&1
+ exit_or_not $?
+
+ # Add a large ea in inode
+ XATTR_NAME="user.large"
+ XATTR_VALUE=${LARGE_VALUE_LESS_THAN_80}
+
+ ${SETXATTR} -n ${XATTR_NAME} -v ${XATTR_VALUE} ${TEST_FILE} >>${DETAIL_LOG_FILE} 2>&1
+ exit_or_not $?
+
+ ${SETXATTR} -x ${XATTR_NAME} ${TEST_FILE} >>${DETAIL_LOG_FILE} 2>&1
+ exit_or_not $?
+
+ ((SUB_TESTNO++))
+
+ echo "Test ${SUB_TESTNO}: In inode EA extension test.">>${DETAIL_LOG_FILE}
+ # Get very ready for extension after a small ea insertion
+ f_extend_xattr "small" ${TEST_FILE} "block"
+ MAX_SMALL_INLINE_XATTR=$((${i}-1))
+ exit_or_not $?
+
+ ${RM} -rf ${TEST_FILE}
+ ${TOUCH_BIN} ${TEST_FILE}
+
+ # Get very ready for extension after a large ea insertion
+ f_extend_xattr "large" ${TEST_FILE} "block"
+ MAX_LARGE_INLINE_XATTR=$((${i}-1))
+ exit_or_not $?
+
+ ${RM} -rf ${TEST_FILE}
+ ${TOUCH_BIN} ${TEST_FILE}
+
+ # Replace a small ea to a large one to extend
+ f_extend_xattr "small" ${TEST_FILE} "block"
+ exit_or_not $?
+
+ XATTR_NAME="user.${i}"
+
+ ${SETXATTR} -x ${XATTR_NAME} ${TEST_FILE} >>${DETAIL_LOG_FILE} 2>&1
+ exit_or_not $?
+
+ #Large xattr value less than 80
+ XATTR_VALUE=${LARGE_VALUE_LESS_THAN_80}${i}
+
+ ${SETXATTR} -n ${XATTR_NAME} -v ${XATTR_VALUE} ${TEST_FILE} >>${DETAIL_LOG_FILE} 2>&1
+ exit_or_not $?
+
+ ${RM} -rf ${TEST_FILE}
+ ${TOUCH_BIN} ${TEST_FILE}
+
+ f_extend_xattr "small" ${TEST_FILE} "block"
+ exit_or_not $?
+
+ XATTR_NAME="user.${i}"
+
+ ${SETXATTR} -x ${XATTR_NAME} ${TEST_FILE} >>${DETAIL_LOG_FILE} 2>&1
+ exit_or_not $?
+
+ #Large xattr value more than 80
+ XATTR_VALUE=${LARGE_VALUE_MORE_THAN_80}${i}
+ ${SETXATTR} -n ${XATTR_NAME} -v ${XATTR_VALUE} ${TEST_FILE} >>${DETAIL_LOG_FILE} 2>&1
+ exit_or_not $?
+
+ ${RM} -rf ${TEST_FILE}
+ ${TOUCH_BIN} ${TEST_FILE}
+
+ ((SUB_TESTNO++))
+
+ echo "Test ${SUB_TESTNO}: Outside Xattr Shrink Test.">>${DETAIL_LOG_FILE}
+ f_extend_xattr "small" ${TEST_FILE} "block"
+ exit_or_not $?
+
+ # Add a small ea in external block
+ XATTR_NAME="user.small"
+ XATTR_VALUE="SMALL"
+
+ ${SETXATTR} -n ${XATTR_NAME} -v ${XATTR_VALUE} ${TEST_FILE} >>${DETAIL_LOG_FILE} 2>&1
+ exit_or_not $?
+
+ # Add a large ea in external block
+ XATTR_NAME="user.large"
+ XATTR_VALUE=${LARGE_VALUE_LESS_THAN_80}
+
+ ${SETXATTR} -n ${XATTR_NAME} -v ${XATTR_VALUE} ${TEST_FILE} >>${DETAIL_LOG_FILE} 2>&1
+ exit_or_not $?
+
+ ${RM} -rf ${TEST_FILE}
+ ${TOUCH_BIN} ${TEST_FILE}
+
+ # Replace a large entry with a small one to shrink
+ f_extend_xattr "large" ${TEST_FILE} "block"
+
+ # Here we verify a bug when updating a boundary entry without shrinking.
+ XATTR_NAME="user.large.${i}"
+ XATTR_VALUE="${LARGE_VALUE_LESS_THAN_80}.${i}"
+
+ ${SETXATTR} -n ${XATTR_NAME} -v ${XATTR_VALUE} ${TEST_FILE} >>${DETAIL_LOG_FILE} 2>&1
+ exit_or_not $?
+
+ XATTR_NAME="user.large.${i}"
+ XATTR_VALUE="${i}"
+
+ ${SETXATTR} -n ${XATTR_NAME} -v ${XATTR_VALUE} ${TEST_FILE} >>${DETAIL_LOG_FILE} 2>&1
+ exit_or_not $?
+
+ ${RM} -rf ${TEST_FILE}
+ ${TOUCH_BIN} ${TEST_FILE}
+
+ # Replace a large entry with also a large one(value size > 80) to shrink
+ # Since it should reserve the space on inode more the 48 bytes, we need more elaborate operations.
+ ${SETXATTR} -n "user.1" -v "1" ${TEST_FILE}
+ ${SETXATTR} -n "user.2" -v "2" ${TEST_FILE}
+ ${SETXATTR} -n "user.large.1" -v ${LARGE_VALUE_LESS_THAN_80} ${TEST_FILE}
+ ${SETXATTR} -n "user.large.2" -v ${LARGE_VALUE_LESS_THAN_80} ${TEST_FILE}
+ exit_or_not $?
+
+ XATTR_NAME="user.large.2"
+ # Make value size more than 80 here
+ XATTR_VALUE=${LARGE_VALUE_MORE_THAN_80}
+
+ ${SETXATTR} -n ${XATTR_NAME} -v ${XATTR_VALUE} ${TEST_FILE} >>${DETAIL_LOG_FILE} 2>&1
+ exit_or_not $?
+
+ ${RM} -rf ${TEST_FILE}
+ ${TOUCH_BIN} ${TEST_FILE}
+
+ ((SUB_TESTNO++))
+
+ echo "Test ${SUB_TESTNO}: Basic Bucket Extension Test.">>${DETAIL_LOG_FILE}
+ f_extend_xattr "small" ${TEST_FILE} "bucket"
+ MAX_SMALL_BLOCK_XATTR=$((${i}-1))
+ exit_or_not $?
+
+ ${RM} -rf ${TEST_FILE}
+ ${TOUCH_BIN} ${TEST_FILE}
+
+ f_extend_xattr "large" ${TEST_FILE} "bucket"
+ MAX_LARGE_BLOCK_XATTR=$((${i}-1))
+ exit_or_not $?
+
+ ${RM} -rf ${TEST_FILE}
+ ${TOUCH_BIN} ${TEST_FILE}
+
+ # Get very ready to extend block to bucket.
+ f_insert_xattrs "small" ${TEST_FILE} ${MAX_SMALL_BLOCK_XATTR}
+ exit_or_not $?
+
+ # Replace a small entry with a large one,less than 80
+ XATTR_NAME=user.${i}
+ XATTR_VALUE=${LARGE_VALUE_LESS_THAN_80}
+
+ ${SETXATTR} -n ${XATTR_NAME} -v ${XATTR_VALUE} ${TEST_FILE} >>${DETAIL_LOG_FILE} 2>&1
+ exit_or_not $?
+
+ ${RM} -rf ${TEST_FILE}
+ ${TOUCH_BIN} ${TEST_FILE}
+
+ f_insert_xattrs "small" ${TEST_FILE} ${MAX_SMALL_BLOCK_XATTR}
+ exit_or_not $?
+
+ # Replace a small entry with a large one, more than 80
+ XATTR_NAME=user.${i}
+ XATTR_VALUE=${LARGE_VALUE_MORE_THAN_80}
+
+ ${SETXATTR} -n ${XATTR_NAME} -v ${XATTR_VALUE} ${TEST_FILE} >>${DETAIL_LOG_FILE} 2>&1
+ exit_or_not $?
+
+ ${RM} -rf ${TEST_FILE}
+ ${TOUCH_BIN} ${TEST_FILE}
+
+ ((SUB_TESTNO++))
+
+ echo "Test ${SUB_TESTNO}: Basic Bucket Insert & Shrink Test.">>${DETAIL_LOG_FILE}
+
+ f_extend_xattr "small" ${TEST_FILE} "bucket"
+ exit_or_not $?
+
+ XATTR_NAME="user.small"
+ XATTR_VALUE="SMALL"
+
+ ${SETXATTR} -n ${XATTR_NAME} -v ${XATTR_VALUE} ${TEST_FILE} >>${DETAIL_LOG_FILE} 2>&1
+ exit_or_not $?
+
+ XATTR_NAME="user.large"
+ XATTR_VALUE=${LARGE_VALUE_LESS_THAN_80}
+
+ ${SETXATTR} -n ${XATTR_NAME} -v ${XATTR_VALUE} ${TEST_FILE} >>${DETAIL_LOG_FILE} 2>&1
+ exit_or_not $?
+
+ ${RM} -rf ${TEST_FILE}
+ ${TOUCH_BIN} ${TEST_FILE}
+
+ f_extend_xattr "large" ${TEST_FILE} "bucket"
+ exit_or_not $?
+
+ # Remove one random entry in inode-block to leave space for further replacing
+ RANDOM_SLOT=$((${RANDOM}%${MAX_LARGE_INLINE_XATTR}+1))
+ XATTR_NAME=user.large.${RANDOM_SLOT}
+
+ ${SETXATTR} -x ${XATTR_NAME} ${TEST_FILE} >>${DETAIL_LOG_FILE} 2>&1
+ exit_or_not $?
+
+ # Replace a large xattr with small one in bucket to make it stored in inode-block.
+ RANDOM_SLOT=$((${RANDOM}%$((${MAX_LARGE_BLOCK_XATTR}-${MAX_LARGE_INLINE_XATTR}+1))+${MAX_LARGE_INLINE_XATTR}))
+ XATTR_NAME=user.large.${RANDOM_SLOT}
+ XATTR_VALUE="SMALL"
+
+ ${SETXATTR} -n ${XATTR_NAME} -v ${XATTR_VALUE} ${TEST_FILE} >>${DETAIL_LOG_FILE} 2>&1
+ exit_or_not $?
+
+ ${RM} -rf ${TEST_FILE}
+ ${TOUCH_BIN} ${TEST_FILE}
+
+ f_extend_xattr "large" ${TEST_FILE} "bucket"
+ exit_or_not $?
+
+ RANDOM_SLOT=$((${RANDOM}%${MAX_LARGE_INLINE_XATTR}+1))
+ XATTR_NAME=user.large.${RANDOM_SLOT}
+
+ ${SETXATTR} -x ${XATTR_NAME} ${TEST_FILE} >>${DETAIL_LOG_FILE} 2>&1
+ exit_or_not $?
+
+ # Replace a large xattr with large one(more than 80) in bucket to make it stored in inode-block.
+ RANDOM_SLOT=$((${RANDOM}%$((${MAX_LARGE_BLOCK_XATTR}-${MAX_LARGE_INLINE_XATTR}+1))+${MAX_LARGE_INLINE_XATTR}))
+ XATTR_NAME=user.large.${RANDOM_SLOT}
+ XATTR_VALUE=${LARGE_VALUE_MORE_THAN_80}
+
+ ${SETXATTR} -n ${XATTR_NAME} -v ${XATTR_VALUE} ${TEST_FILE} >>${DETAIL_LOG_FILE} 2>&1
+ exit_or_not $?
+
+ return $?
+}
+
f_runtest()
{
echo >>${DETAIL_LOG_FILE}
@@ -264,6 +789,33 @@ f_runtest()
fi
${RM} -rf ${WORKPLACE}/* || exit 1
+ echo >>${DETAIL_LOG_FILE}
+ echo "==========================================================">>${DETAIL_LOG_FILE}
+ echo -ne "Perform Additional Func Test:"|tee -a ${RUN_LOG_FILE}
+ echo -ne "Perform Additional Func Test::">>${DETAIL_LOG_FILE}
+ echo >>${DETAIL_LOG_FILE}
+ echo "==========================================================">>${DETAIL_LOG_FILE}
+ if [ ! ${BLOCKSIZE} -eq 512 ];then
+ f_add_func_test
+ fi
+ RET=$?
+ echo_status ${RET} |tee -a ${RUN_LOG_FILE}
+ exit_or_not ${RET}
+ ${RM} -rf ${WORKPLACE}/* || exit 1
+
+ echo >>${DETAIL_LOG_FILE}
+ echo "==========================================================">>${DETAIL_LOG_FILE}
+ echo -ne "Perform Inline Data&Xattr Combination Test:"|tee -a ${RUN_LOG_FILE}
+ echo -ne "Perform Inline Data&Xattr Combination Test::">>${DETAIL_LOG_FILE}
+ echo >>${DETAIL_LOG_FILE}
+ echo "==========================================================">>${DETAIL_LOG_FILE}
+ if [ ! -z "${COMBIN_TEST}" ] && [ ! ${BLOCKSIZE} -eq 512 ];then
+ f_combin_test
+ fi
+ RET=$?
+ echo_status ${RET}|tee -a ${RUN_LOG_FILE}
+ exit_or_not ${RET}
+ ${RM} -rf ${WORKPLACE}/* || exit 1
echo >>${DETAIL_LOG_FILE}
echo "==========================================================">>${DETAIL_LOG_FILE}
--
1.5.5
More information about the Ocfs2-test-devel
mailing list