[Ocfs2-test-devel] [PATCH 1/1] Xattr_test: Add a corner testcase for xattr_tests.

Tristan Ye tristan.ye at oracle.com
Mon Mar 22 01:46:35 PDT 2010


Add a corner testcase to expose the bug as following patch described:
http://oss.oracle.com/pipermail/ocfs2-devel/2010-March/006101.html

I'm going to to add a new subtest of xattr_test called miscellaneous test,
where all kinds of testcases to expose some corner bugs can be continuely
kept here without hurting existing testing framework. it's goal is for
verifying known bugs.

Signed-off-by: Tristan Ye <tristan.ye at oracle.com>
---
 programs/xattr_tests/xattr-single-run.sh |   69 ++++++++++++++++++++++++++++++
 1 files changed, 69 insertions(+), 0 deletions(-)

diff --git a/programs/xattr_tests/xattr-single-run.sh b/programs/xattr_tests/xattr-single-run.sh
index 4991273..46d3ef5 100755
--- a/programs/xattr_tests/xattr-single-run.sh
+++ b/programs/xattr_tests/xattr-single-run.sh
@@ -789,6 +789,61 @@ f_add_func_test()
 	return $?
 }
 
+f_get_random_ea_value_size()
+{
+	BASE_SIZE=${1}
+
+	if [ -z "${BASE_SIZE}" ] || [ "${BASE_SIZE}" = "0" ];then
+		BASE_SIZE=65536
+	fi
+
+	VALUE_SZ=$((${RANDOM}%${BASE_SIZE}))
+
+	echo $((${VALUE_SZ}+1))
+}
+
+f_gen_ea_value()
+{
+	VALUE_STR=
+	VALUE_SIZE=${1}
+
+	if [ -z "${VALUE_SIZE}" ] || [ "${VALUE_SIZE}" = "0" ];then
+		VALUE_SIZE=80
+	fi
+
+	for i in `seq ${VALUE_SIZE}`;do
+		VALUE_STR="${VALUE_STR}a"
+	done
+
+	echo ${VALUE_STR}
+}
+
+f_miscellaneous_test()
+{
+	SUB_TESTNO=1
+	TEST_FILE=${WORKPLACE}/miscellaneous-test-file
+	XATTR_REPLACE_TIME=100
+
+	echo "Test ${SUB_TESTNO}: Multiple Replace Test.">>${DETAIL_LOG_FILE}
+
+	${TOUCH_BIN} ${TEST_FILE}
+
+	XATTR_NAME="user.XXXX"
+	for i in `seq ${XATTR_REPLACE_TIME}`;do
+		XATTR_VALUE_SIZE=`f_get_random_ea_value_size 1000`
+		XATTR_VALUE=`f_gen_ea_value ${XATTR_VALUE_SIZE}`
+		echo XATTR_VALUE=${XATTR_VALUE}
+		${SETXATTR} -n ${XATTR_NAME} -v ${XATTR_VALUE} ${TEST_FILE} >>${DETAIL_LOG_FILE} 2>&1
+		exit_or_not $?
+	done
+
+	${RM} -rf ${TEST_FILE}
+
+	return $?
+}
+
+
+
 f_runtest()
 {
 	((TEST_NO++))
@@ -870,6 +925,20 @@ f_runtest()
 	((TEST_PASS++))
 
 	((TEST_NO++))
+	echo >>${DETAIL_LOG_FILE}
+	echo "==========================================================">>${DETAIL_LOG_FILE}
+	echo -ne "[${TEST_NO}] Perform Miscellaneous Test:"|tee -a ${RUN_LOG_FILE}
+	echo -ne "[${TEST_NO}] Perform Miscellaneous Test:">>${DETAIL_LOG_FILE}
+	echo >>${DETAIL_LOG_FILE}
+	echo "==========================================================">>${DETAIL_LOG_FILE}
+	f_miscellaneous_test
+	RET=$?
+	echo_status ${RET} |tee -a ${RUN_LOG_FILE}
+	exit_or_not ${RET}
+	${RM} -rf ${WORKPLACE}/* || exit 1
+	((TEST_PASS++))
+
+	((TEST_NO++))
         echo >>${DETAIL_LOG_FILE}
 	echo "==========================================================">>${DETAIL_LOG_FILE}
 	echo -ne "[${TEST_NO}] Check Utility of SingleNode Xattr on Ocfs2:"|tee -a ${RUN_LOG_FILE}
-- 
1.5.5




More information about the Ocfs2-test-devel mailing list