[Ocfs2-test-devel] [PATCH 1/7] single_run: Add single_run-WIP

Sunil Mushran sunil.mushran at oracle.com
Wed Aug 19 18:21:03 PDT 2009


single_run-WIP is a work-in-progress single_run.

Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com>
---
 programs/python_common/Makefile          |    2 +
 programs/python_common/single_run-WIP.sh |  572 ++++++++++++++++++++++++++++++
 vendor/common/ocfs2-test.spec-generic.in |    1 +
 3 files changed, 575 insertions(+), 0 deletions(-)
 create mode 100755 programs/python_common/single_run-WIP.sh

diff --git a/programs/python_common/Makefile b/programs/python_common/Makefile
index b95d675..289b1fd 100644
--- a/programs/python_common/Makefile
+++ b/programs/python_common/Makefile
@@ -14,6 +14,7 @@ DIST_FILES = 	config_py.skel \
 		setup.sh \
 		o2tf.py \
 		single_run.sh \
+		single_run-WIP.sh \
 		multiple_run.sh \
 		remote_mount.py \
 		remote_umount.py \
@@ -24,6 +25,7 @@ BIN_EXTRA = 	config_py.skel \
 		config_shell.skel \
 		o2tf.py \
 		single_run.sh \
+		single_run-WIP.sh \
 		remote_mount.py \
 		remote_umount.py \
 		command.py	\
diff --git a/programs/python_common/single_run-WIP.sh b/programs/python_common/single_run-WIP.sh
new file mode 100755
index 0000000..50ce38c
--- /dev/null
+++ b/programs/python_common/single_run-WIP.sh
@@ -0,0 +1,572 @@
+#!/bin/bash
+#
+
+PATH=$PATH:/sbin	# Add /sbin to the path for ocfs2 tools
+RUNTIME=300		# seconds
+APP=`basename ${0}`
+USERNAME=`/usr/bin/whoami`
+DATE=`which date`
+HOSTNAME=`which hostname`
+SUDO="`which sudo` -u root"
+DEBUGFS_BIN="`which sudo` -u root `which debugfs.ocfs2`"
+TUNEFS_BIN="`which sudo` -u root `which tunefs.ocfs2`"
+MKFS_BIN="`which sudo` -u root `which mkfs.ocfs2`"
+CUT=`which cut`
+AWK=`which awk`
+MOUNT=`which mount`
+UMOUNT=`which umount`
+ECHO=`which echo`
+MKDIR=`which mkdir`
+CAT=`which cat`
+MD5SUM=`which md5sum`
+WGET=`which wget`
+DWNLD_PATH="http://oss.oracle.com/~smushran/ocfs2-test"
+KERNEL_TARBALL="linux-kernel.tar.gz"
+KERNEL_TARBALL_CHECK="${KERNEL_TARBALL}.md5sum"
+
+# log_message message
+log_message()
+{
+	${ECHO} "`${DATE}  +\"%F %H:%M:%S\"` $@" >> ${LOGFILE}
+}
+
+log_start()
+{
+	log_message $@
+	START=$(date +%s)
+}
+
+# log_end $?
+log_end()
+{
+	if [ "$#" -lt "1" ]; then
+      		${ECHO} "Error in log_end()"
+		exit 1
+	fi
+
+	END=$(date +%s)
+	DIFF=$(( ${END} - ${START} ))
+
+	if [ ${1} -ne 0 ]; then
+		log_message "FAILED (${DIFF} secs)"
+	else
+		log_message "PASSED (${DIFF} secs)"
+	fi
+
+	START=0
+}
+
+# get_kernel_source $LOGDIR $DWNLD_PATH $KERNEL_TARBALL $KERNEL_TARBALL_CHECK
+get_kernel_source()
+{
+	if [ "$#" -lt "4" ]; then
+		${ECHO} "Error in get_kernel_source()"
+		exit 1
+	fi
+
+	logdir=$1
+	dwnld_path=$2
+	kernel_tarball=$3
+	kernel_tarball_check=$4
+
+	cd ${logdir}
+	${WGET} ${dwnld_path}/${kernel_tarball_check}
+	if [ $? -ne 0 ]; then
+		${ECHO} "ERROR downloading ${dwnld_path}/${kernel_tarball_check}"
+		cd -
+		exit 1
+	fi
+
+	${WGET} ${dwnld_path}/${kernel_tarball}
+	if [ $? -ne 0 ]; then
+		${ECHO} "ERROR downloading ${dwnld_path}/${kernel_tarball}"
+		cd -
+		exit 1
+	fi
+
+	${MD5SUM} -c ${kernel_tarball_check}
+	if [ $? -ne 0 ]; then
+		${ECHO} "ERROR ${kernel_tarball_check} check failed"
+		cd -
+		exit 1
+	fi
+	cd -
+}
+
+# get_device_info ${DEVICE}
+get_device_info()
+{
+	if [ "$#" -lt "1" ]; then
+		${ECHO} "Error in get_device_info()"
+		exit 1
+	fi
+
+	LABEL=`${TUNEFS_BIN} -q -Q "label=%V\n" ${1}|${CUT} -f2 -d"="`
+	if [ "X${LABEL}" == "X" ]; then
+		LABEL="testlabel"
+	fi
+
+	SLOTS=`${TUNEFS_BIN} -q -Q "slots=%N\n" ${DEVICE}|${CUT} -f2 -d"="`
+
+	CLUSTERSIZE_BITS=`${DEBUGFS_BIN} -R stats ${DEVICE} | grep Bits| ${AWK} -F" " '{print $8}'`
+	BLOCKSIZE_BITS=`${DEBUGFS_BIN} -R stats ${DEVICE} | grep Bits| ${AWK} -F" " '{print $4}'`
+
+	CLUSTERSIZE=`${ECHO} 2^${CLUSTERSIZE_BITS} |bc`
+	BLOCKSIZE=`${ECHO} 2^${BLOCKSIZE_BITS} |bc`
+}
+
+# do_format() ${BLOCKSIZE} ${CLUSTERSIZE} ${FEATURES} ${DEVICE}
+do_format() {
+	if [ "$#" -lt "4" ]; then
+      		${ECHO} "Error in do_format() $@"
+		exit 1
+	fi
+
+	blocksize=$1
+	clustersize=$2
+	features=$3
+	device=$4
+
+#	log_message "format ${device}"
+
+	${MKFS_BIN} -x -b ${blocksize} -C ${clustersize} --fs-features=${features} \
+		-N 1 -L single_run -M local ${device} >/dev/null
+	if [ $? -ne 0 ]; then
+		${ECHO} "ERROR: mkfs.ocfs2 -b ${blocksize} -C ${clustersize} " \
+			"--fs-features=${features} -N 1 -L single_run -M local ${device}"
+		exit 1
+	fi
+
+	get_device_info	${device}
+}
+
+# do_mount ${DEVICE} ${MOUNTPOINT} ${MOUNTOPTS}
+do_mount() {
+	if [ "$#" -lt "3" ]; then
+      		${ECHO} "Error in do_mount()"
+		exit 1
+	fi
+
+	device=$1
+	mountpoint=$2
+	mountopts=$3	
+
+#	log_message "mount ${DEVICE} ${MOUNTPOINT}"
+
+	${MOUNT} -o ${mountopts} ${device} ${mountpoint} >/dev/null
+	if [ $? -ne 0 ]; then
+		${ECHO} "ERROR: mount -o ${mountopts} ${device} ${mountpoint}"
+		exit 1
+	fi
+}
+
+# do_umount ${MOUNTPOINT}
+do_umount() {
+	if [ "$#" -lt "1" ]; then
+		${ECHO} "Error in do_umount()"
+		exit 1
+	fi
+
+	mountpoint=$1
+
+#	log_message "umount ${MOUNTPOINT}"
+
+	${UMOUNT} ${mountpoint}
+	if [ $? -ne 0 ]; then
+		${ECHO} "ERROR: umount ${mountpoint}"
+		exit 1
+	fi
+}
+
+# run_aiostress ${BINDIR} ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+run_aiostress()
+{
+	log_message "run_aiostress" $@
+        if [ "$#" -lt "4" ]; then
+                echo "Error in run_aiostress()"
+                exit 1
+        fi
+
+	bindir=$1
+	logdir=$2
+	device=$3
+	mountpoint=$4
+
+	workdir=${mountpoint}/testme
+	blocksize=4096
+	clustersize=8192
+	features="sparse,unwritten,inline-data"
+
+	for mopt in writeback ordered
+	do
+		mountopts="data=${mopt}"
+
+		log_start "aio-stress" ${mountopts}
+
+		do_format ${blocksize} ${clustersize} ${features} ${device}
+		do_mount ${device} ${mountpoint} ${mountopts}
+		${MKDIR} -p ${workdir}
+
+		F1="${workdir}/aiostress1.dat"
+		F2="${workdir}/aiostress2.dat"
+		F3="${workdir}/aiostress3.dat"
+		F4="${workdir}/aiostress4.dat"
+
+		outlog=${logdir}/aiostress_${mopt}.log
+
+		${bindir}/aio-stress -a 4k -b 32 -i 16 -O -l -L -t 8 -v ${F1} ${F2} ${F3} ${F4} >${outlog} 2>&1
+		RC=$?
+
+		do_umount ${mountpoint}
+	
+		log_end ${RC}
+	done
+}
+
+# run_buildkernel ${BINDIR} ${LOGDIR} ${DEVICE} {MOUNTPOINT} ${KERNELSRC}
+run_buildkernel()
+{
+	log_message "run_buildkernel" $@
+        if [ "$#" -lt "5" ]; then
+                echo "Error in run_buildkernel()"
+                exit 1
+        fi
+
+	bindir=$1
+	logdir=$2
+	device=$3
+	mountpoint=$4
+	kernelsrc=$5
+
+	node=`${HOSTNAME}`
+	workdir=${mountpoint}/testme
+	blocksize=4096
+	clustersize=4096
+	features="sparse,unwritten,inline-data"
+
+	for mopt in writeback ordered
+	do
+		mountopts="data=${mopt}"
+
+		do_format ${blocksize} ${clustersize} ${features} ${device}
+		do_mount ${device} ${mountpoint} ${mountopts}
+		${MKDIR} -p ${workdir}
+
+		log_start "buildkernel" ${mountopts}
+
+		outlog=${logdir}/buildkernel_${mopt}.log
+
+		${bindir}/buildkernel.py -e -d ${workdir} -t ${kernelsrc} -n ${node} -l ${outlog}.1
+		RC=$?
+		if [ ${RC} -eq 0 ]; then
+			${bindir}/buildkernel.py -d ${workdir} -t ${kernelsrc} -n ${node} -l ${outlog}.2
+			RC=$?
+		fi
+
+		do_umount ${mountpoint}
+
+		log_end ${RC}
+	done
+}
+
+# run_filesizelimits ${BINDIR} ${LOGDIR} ${DEVICE} {MOUNTPOINT}
+run_filesizelimits()
+{
+	log_message "run_filesizelimits" $@
+        if [ "$#" -lt "4" ]; then
+                echo "Error in run_filesizelimits()"
+                exit 1
+        fi
+
+	bindir=$1
+	logdir=$2
+	device=$3
+	mountpoint=$4
+
+	mountopts=defaults
+
+	workdir=${mountpoint}/testme
+
+	if [ `uname -m` == "i686" ]; then
+		bitsperlong=32
+	else
+		bitsperlong=64
+	fi
+
+	log_start "check_file_size_limits"
+
+	do_format 4096 4096 sparse,unwritten,inline-data ${device}
+	do_mount ${device} ${mountpoint} ${mountopts}
+	${MKDIR} -p ${workdir}
+
+	file="${workdir}/filesizelimits.dat"
+	outlog=${logdir}/filesizelimits.log
+
+	${bindir}/check_file_size_limits -B ${bitsperlong} -b ${BLOCKSIZE_BITS} \
+		-c ${CLUSTERSIZE_BITS} ${file} >${outlog} 2>&1
+	RC=$?
+
+	do_umount ${mountpoint}
+
+	log_end ${RC}
+}
+
+# run_fillverifyholes ${BINDIR} ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+run_fillverifyholes()
+{
+	log_message "run_fillverifyholes" $@
+        if [ "$#" -lt "4" ]; then
+                echo "Error in run_fillverifyholes()"
+                exit 1
+        fi
+
+	bindir=$1
+	logdir=$2
+	device=$3
+	mountpoint=$4
+
+	workdir=${mountpoint}/testme
+
+	varfile=${logdir}/fillverifyholes.txt
+
+	${CAT} > ${varfile} <<EOF
+2048	4096	nosparse,nounwritten,noinline-data	data=ordered
+2048	65536	sparse,unwritten,inline-data		data=writeback
+4096	4096	sparse,unwritten,inline-data		data=ordered
+4096	8192	nosparse,nounwritten,noinline-data	data=writeback
+4096	131072	nosparse,nounwritten,noinline-data	data=ordered
+4096	1048576	sparse,unwritten,inline-data		data=writeback
+EOF
+	if [ $? != 0 ]; then
+		${ECHO} "ERROR writing ${varfile}"
+		exit 1
+	fi
+
+	i=0
+	${CAT} ${varfile} | while read LINE
+	do
+        	blocksize=`echo ${LINE} | cut -f1 -d' '`
+        	clustersize=`echo ${LINE} | cut -f2 -d' '`
+        	features=`echo ${LINE} | cut -f3 -d' '`
+		mountopts=`echo ${LINE} | cut -f4 -d' '`
+
+		log_start "fill_verify_holes" ${blocksize} ${clustersize} ${features} ${mountopts}
+
+		outlog=${logdir}/fillverifyholes_${i}.log
+		ldir=${logdir}/fillverifyholes_${i}
+		${MKDIR} -p ${ldir}
+
+		do_format ${blocksize} ${clustersize} ${features} ${device}
+		do_mount ${device} ${mountpoint} ${mountopts}
+		${MKDIR} -p ${workdir}
+
+		${bindir}/burn-in.sh -b ${bindir} -l ${ldir} -c 10 -d ${workdir} -i 100 -s 5000000 >${outlog} 2>&1
+		RC=$?
+
+		do_umount ${mountpoint}
+
+		log_end ${RC}
+
+		i=$[$i+1]
+	done
+}
+
+# run_mmaptruncate ${BINDIR} ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+run_mmaptruncate()
+{
+	log_message "run_mmaptruncate" $@
+        if [ "$#" -lt "4" ]; then
+                echo "Error in run_mmaptruncate()"
+                exit 1
+        fi
+
+	bindir=$1
+	logdir=$2
+	device=$3
+	mountpoint=$4
+
+	runtime=300
+	workfile=${mountpoint}/mmaptruncate.txt
+	varfile=${logdir}/mmaptruncate.conf
+
+	${CAT} > ${varfile} <<EOF
+2048	4096	nosparse,nounwritten,noinline-data	data=ordered
+2048	65536	sparse,unwritten,inline-data		data=writeback
+4096	4096	sparse,unwritten,inline-data		data=ordered
+4096	8192	nosparse,nounwritten,noinline-data	data=writeback
+4096	131072	sparse,unwritten,inline-data		data=ordered
+4096	1048576	sparse,unwritten,inline-data		data=writeback
+EOF
+	if [ $? != 0 ]; then
+		${ECHO} "ERROR writing ${varfile}"
+		exit 1
+	fi
+
+	${CAT} ${varfile} | while read LINE
+	do
+        	blocksize=`echo ${LINE} | cut -f1 -d' '`
+        	clustersize=`echo ${LINE} | cut -f2 -d' '`
+        	features=`echo ${LINE} | cut -f3 -d' '`
+		mountopts=`echo ${LINE} | cut -f4 -d' '`
+
+		log_start "mmap_truncate" ${blocksize} ${clustersize} ${features} ${mountopts}
+
+		do_format ${blocksize} ${clustersize} ${features} ${device}
+		do_mount ${device} ${mountpoint} ${mountopts}
+
+		${bindir}/mmap_truncate -c ${CLUSTERSIZE_BITS} -s ${runtime} ${workfile}
+		RC=$?
+
+		sleep 10
+		do_umount ${mountpoint}
+
+		log_end ${RC}
+	done
+}
+
+# run_renamewriterace ${BINDIR} ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+run_renamewriterace()
+{
+	log_message "run_renamewriterace" $@
+        if [ "$#" -lt "4" ]; then
+                echo "Error in run_renamewriterace()"
+                exit 1
+        fi
+
+	bindir=$1
+	logdir=$2
+	device=$3
+	mountpoint=$4
+
+	workdir=${mountpoint}/testme
+	blocksize=4096
+	clustersize=4096
+	features="sparse,unwritten,inline-data"
+
+	for mopt in writeback ordered
+	do
+		mountopts="data=${mopt}"
+
+		log_start "rename_write_race" ${mountopts}
+
+		do_format ${blocksize} ${clustersize} ${features} ${device}
+		do_mount ${device} ${mountpoint} ${mountopts}
+		${MKDIR} -p ${workdir}
+
+                outlog=${logdir}/renamewriterace_${mopt}.log
+
+		${bindir}/rename_write_race.sh -d ${workdir} -i 10000 >${outlog} 2>&1
+		RC=$?
+
+		do_umount ${mountpoint}
+
+		log_end ${RC}
+	done
+}
+
+#
+#
+# MAIN
+#
+#
+
+usage()
+{
+	${ECHO} "usage: ${APP} [-k kerneltarball] -m mountpoint -l logdir -d device"
+	exit 1
+}
+
+while getopts "d:m:k:l:h?" args
+do
+	case "$args" in
+		d) DEVICE="$OPTARG";;
+		m) MOUNTPOINT="$OPTARG";;
+		k) KERNELSRC="$OPTARG";;
+		l) O2TDIR="$OPTARG";;
+    		h) USAGE="yes";;
+    		?) USAGE="yes";;
+  	esac
+done
+
+
+if [ ! -z ${USAGE} ]; then
+	usage
+fi
+
+RUNDATE=`${DATE} +%F_%H:%M`
+
+if [ -f ./config.sh ] ; then
+	. ./config.sh
+else
+#	O2TDIR=/usr/local/ocfs2-test
+	MPIDIR=/usr/lib/openmpi/1.2.7-gcc/bin
+	BINDIR=/usr/local/ocfs2-test/bin/
+#	COMMONDIR=${O2TDIR}/common
+#	WORKFILESDIR=${O2TDIR}/workfiles
+#	LIBDIR=${O2TDIR}/lib
+	LOGDIR=${O2TDIR}/${RUNDATE}
+	LOGFILE=${LOGDIR}/single_run.log
+#	MPIHOSTS=${O2TDIR}/tmp/mpihosts
+#	MPIRUN=${MPIDIR}/mpirun
+#	NPROC=1
+fi
+
+if [ -z ${DEVICE} ] ; then
+	${ECHO} "ERROR: No device"
+	usage
+elif [ ! -b ${DEVICE} ] ; then
+	${ECHO} "ERROR: Invalid device ${DEVICE}"
+	exit 1
+fi
+
+if [ -z ${MOUNTPOINT} ] ; then
+	${ECHO} "ERROR: No mountpoint"
+	usage
+elif [ ! -d ${MOUNTPOINT} ] ; then
+	${ECHO} "ERROR: Invalid mountpoint ${MOUNTPOINT}"
+	exit 1
+fi
+
+if [ -z ${O2TDIR} ]; then
+	${ECHO} "ERROR: No logdir"
+	usage
+fi
+
+if [ ! -d ${O2TDIR} ]; then
+	mkdir -p ${O2TDIR}
+fi
+
+${MKDIR} -p ${LOGDIR}
+
+if [ -z ${KERNELSRC} ]; then
+	get_kernel_source $LOGDIR $DWNLD_PATH $KERNEL_TARBALL $KERNEL_TARBALL_CHECK
+	KERNELSRC=${LOGDIR}/${KERNEL_TARBALL}
+fi
+
+if [ ! -f ${KERNELSRC} ]; then
+	${ECHO} "No kernel source"
+	usage
+fi
+
+STARTRUN=$(date +%s)
+log_message "*** Start Single Node test ***"
+
+${ECHO} "Output log is ${LOGFILE}"
+
+run_fillverifyholes ${BINDIR} ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+
+run_renamewriterace ${BINDIR} ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+
+run_aiostress ${BINDIR} ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+
+run_filesizelimits ${BINDIR} ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+
+run_mmaptruncate ${BINDIR} ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+
+run_buildkernel ${BINDIR} ${LOGDIR} ${DEVICE} ${MOUNTPOINT} ${KERNELSRC}
+
+ENDRUN=$(date +%s)
+
+DIFF=$(( ${ENDRUN} - ${STARTRUN} ))
+log_message "Total Runtime ${DIFF} seconds"
+log_message "*** End Single Node test ***"
diff --git a/vendor/common/ocfs2-test.spec-generic.in b/vendor/common/ocfs2-test.spec-generic.in
index bae26d2..b37e870 100644
--- a/vendor/common/ocfs2-test.spec-generic.in
+++ b/vendor/common/ocfs2-test.spec-generic.in
@@ -113,6 +113,7 @@ rm -rf "$RPM_BUILD_ROOT"
 %{_installdir}/bin/open_delete.py
 %{_installdir}/bin/o2tf.py
 %{_installdir}/bin/single_run.sh
+%{_installdir}/bin/single_run-WIP.sh
 %{_installdir}/bin/remote_mount.py
 %{_installdir}/bin/remote_umount.py
 %{_installdir}/bin/command.py
-- 
1.6.0.4




More information about the Ocfs2-test-devel mailing list