[Ocfs2-test-devel] [PATCH 7/7] fill_verify_holes: Add fill_verify_holes.sh
Sunil Mushran
sunil.mushran at oracle.com
Wed Aug 19 18:21:09 PDT 2009
single_run-WIP.sh calls fill_verify_holes.sh for a more comprehensive testrun.
Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com>
---
programs/fill_verify_holes/Makefile | 2 +-
programs/fill_verify_holes/fill_verify_holes.sh | 157 +++++++++++++++++++++++
programs/python_common/single_run-WIP.sh | 34 +++--
vendor/common/ocfs2-test.spec-generic.in | 1 +
4 files changed, 181 insertions(+), 13 deletions(-)
create mode 100755 programs/fill_verify_holes/fill_verify_holes.sh
diff --git a/programs/fill_verify_holes/Makefile b/programs/fill_verify_holes/Makefile
index 00718a6..d0d53ae 100644
--- a/programs/fill_verify_holes/Makefile
+++ b/programs/fill_verify_holes/Makefile
@@ -10,7 +10,7 @@ SOURCES = fill_holes.c punch_holes.c verify_holes.c fill_holes.h reservations.h
DIST_FILES = $(SOURCES)
-BIN_EXTRA = burn-in.sh old_burn-in.sh
+BIN_EXTRA = burn-in.sh old_burn-in.sh fill_verify_holes.sh
BIN_PROGRAMS = fill_holes punch_holes verify_holes
diff --git a/programs/fill_verify_holes/fill_verify_holes.sh b/programs/fill_verify_holes/fill_verify_holes.sh
new file mode 100755
index 0000000..5db8a51
--- /dev/null
+++ b/programs/fill_verify_holes/fill_verify_holes.sh
@@ -0,0 +1,157 @@
+#!/bin/bash
+#
+# fill_verify_holes.sh
+#
+
+APP=`basename ${0}`
+PATH=$PATH:/sbin # Added sbin to the path for ocfs2-tools
+SUDO="`which sudo` -u root"
+DEBUGFS_BIN="`which sudo` -u root `which debugfs.ocfs2`"
+MKFS_BIN="`which sudo` -u root `which mkfs.ocfs2`"
+TUNEFS_BIN="`which sudo` -u root `which tunefs.ocfs2`"
+GREP=`which grep`
+DF=`which df`
+ECHO="`which echo` -e"
+AWK=`which awk`
+FUSER=`which fuser`
+MOUNT=`which mount`
+UMOUNT=`which umount`
+FILL_HOLES=`which fill_holes 2>/dev/null`
+VERIFY_HOLES=`which verify_holes 2>/dev/null`
+
+log_run() {
+ echo "Run: $@"
+ "$@"
+}
+
+do_mount() {
+ if [ "$#" -lt "3" ]; then
+ ${ECHO} "Error in do_mount()"
+ exit 1
+ fi
+
+ device=$1
+ mountpoint=$2
+ mountopts=$3
+
+ ${ECHO} "${MOUNT} -o ${mountopts} ${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() {
+ if [ "$#" -lt "1" ]; then
+ ${ECHO} "Error in do_umount()"
+ exit 1
+ fi
+
+ mountpoint=$1
+
+ ${ECHO} "${UMOUNT} ${mountpoint}"
+ ${UMOUNT} ${mountpoint}
+ if [ $? -ne 0 ]; then
+ ${ECHO} "ERROR: umount ${mountpoint}"
+ exit 1
+ fi
+}
+
+usage()
+{
+ ${ECHO} "${APP} [ -M ] [ -U ] [ -i iteractions ] [ -s size ] [-o mountopts] -c count -m mountpoint -l logdir -d device"
+ exit 1
+}
+
+OPTIND=1
+COUNT=1
+ITER=100000
+SIZE=10000000
+
+MMAPOPT=
+UNWOPT=
+
+while getopts "c:d:i:l:s:m:o:MUh?" args
+do
+ case "$args" in
+ c) COUNT="$OPTARG";;
+ d) DEVICE="$OPTARG";;
+ i) ITER="$OPTARG";;
+ l) LOGPATH="$OPTARG";;
+ s) SIZE="$OPTARG";;
+ m) MOUNTPOINT="$OPTARG";;
+ o) MOUNTOPTS="$OPTARG";;
+ M) MMAPOPT="-m";;
+ U) UNWOPT="-u";;
+ h) USAGE="yes";;
+ ?) USAGE="yes";;
+ esac
+done
+
+if [ ! -z "${USAGE}" ]; then
+ usage
+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 ${MOUNTOPTS} ] ; then
+ MOUNTOPTS="defaults"
+fi
+
+if [ -z ${FILL_HOLES} -o -z ${VERIFY_HOLES} ] ; then
+ ${ECHO} "Error: fill_holes and/or verify_holes not in PATH"
+ exit 1
+fi
+
+fnamebase="iter${ITER}.size${SIZE}"
+
+do_mount ${DEVICE} ${MOUNTPOINT} ${MOUNTOPTS}
+
+for i in `seq -w 0 ${COUNT}`
+do
+ outtxt="${MOUNTPOINT}/${fnamebase}.${i}.txt"
+ outlog="${LOGPATH}/${fnamebase}.${i}.log"
+
+ ${ECHO} "Creating file..."
+ log_run "${FILL_HOLES}" ${MMAPOPT} ${UNWOPT} -f -o "${outlog}" -i "${ITER}" "${outtxt}" "${SIZE}"
+
+ sleep 10
+
+ ${FUSER} -km ${MOUNTPOINT}
+
+ sleep 10
+
+ do_umount ${MOUNTPOINT}
+
+# sleep 10
+
+ do_mount ${DEVICE} ${MOUNTPOINT} ${MOUNTOPTS}
+
+# sleep 10
+
+ ${ECHO} "Verifying..."
+ log_run "${VERIFY_HOLES}" "-v" "${outlog}" "${outtxt}"
+ RC=$?
+
+ if [ ${RC} -ne 0 ]; then
+ do_umount ${MOUNTPOINT}
+ exit 1
+ fi
+done
+
+do_umount ${MOUNTPOINT}
diff --git a/programs/python_common/single_run-WIP.sh b/programs/python_common/single_run-WIP.sh
index 50ce38c..1daaffb 100755
--- a/programs/python_common/single_run-WIP.sh
+++ b/programs/python_common/single_run-WIP.sh
@@ -330,12 +330,15 @@ run_fillverifyholes()
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
+2048 4096 nosparse,nounwritten,noinline-data data=ordered 100000000 0 0
+2048 65536 sparse,unwritten,inline-data data=writeback 5000000000 -M -U
+4096 4096 sparse,unwritten,inline-data data=ordered 5000000000 0 0
+4096 4096 sparse,unwritten,inline-data data=ordered 5000000000 -M 0
+4096 4096 sparse,unwritten,inline-data data=ordered 5000000000 0 -U
+4096 4096 sparse,unwritten,inline-data data=ordered 5000000000 -M -U
+4096 8192 nosparse,nounwritten,noinline-data data=writeback 100000000 0 0
+4096 131072 nosparse,nounwritten,noinline-data data=ordered 100000000 -M 0
+4096 1048576 sparse,unwritten,inline-data data=writeback 5000000000 -M -U
EOF
if [ $? != 0 ]; then
${ECHO} "ERROR writing ${varfile}"
@@ -349,22 +352,29 @@ EOF
clustersize=`echo ${LINE} | cut -f2 -d' '`
features=`echo ${LINE} | cut -f3 -d' '`
mountopts=`echo ${LINE} | cut -f4 -d' '`
+ filesize=`echo ${LINE} | cut -f5 -d' '`
+ mmap=`echo ${LINE} | cut -f6 -d' '`
+ punchholes=`echo ${LINE} | cut -f7 -d' '`
+
+ log_start "fill_verify_holes" ${blocksize} ${clustersize} ${features} ${mountopts} ${filesize} ${mmap} ${punchholes}
+ if [ ${mmap} = 0 ] ; then
+ mmap=
+ fi
- log_start "fill_verify_holes" ${blocksize} ${clustersize} ${features} ${mountopts}
+ if [ ${punchholes} = 0 ] ; then
+ punchholes=
+ fi
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
+ ${bindir}/fill_verify_holes.sh -i 10000 -s ${filesize} -c 2 -m ${mountpoint} -l ${ldir} \
+ -d ${device} -o ${mountopts} ${mmap} ${punchholes} >${outlog} 2>&1
RC=$?
- do_umount ${mountpoint}
-
log_end ${RC}
i=$[$i+1]
diff --git a/vendor/common/ocfs2-test.spec-generic.in b/vendor/common/ocfs2-test.spec-generic.in
index b37e870..c298e8a 100644
--- a/vendor/common/ocfs2-test.spec-generic.in
+++ b/vendor/common/ocfs2-test.spec-generic.in
@@ -92,6 +92,7 @@ rm -rf "$RPM_BUILD_ROOT"
%{_installdir}/bin/verify_holes
%{_installdir}/bin/burn-in.sh
%{_installdir}/bin/old_burn-in.sh
+%{_installdir}/bin/fill_verify_holes.sh
%{_installdir}/bin/flock_unit_test
%{_installdir}/bin/run_flock_unit_test.py
%{_installdir}/bin/fsck-test.sh
--
1.6.0.4
More information about the Ocfs2-test-devel
mailing list