[Ocfs2-test-devel] [PATCH 31/59] ocfs2-test: add -t option to run specified testcase

Junxiao Bi junxiao.bi at oracle.com
Sun Sep 13 19:44:17 PDT 2015


Signed-off-by: Junxiao Bi <junxiao.bi at oracle.com>
---
 programs/python_common/multiple_run.sh   |   98 +++++++++++++++++++++---------
 programs/python_common/single_run-WIP.sh |   97 +++++++++++++++++++++++------
 2 files changed, 146 insertions(+), 49 deletions(-)

diff --git a/programs/python_common/multiple_run.sh b/programs/python_common/multiple_run.sh
index cf82b96..2a064ef 100755
--- a/programs/python_common/multiple_run.sh
+++ b/programs/python_common/multiple_run.sh
@@ -34,6 +34,7 @@ ECHO="`which echo` -e"
 
 SUDO="`which sudo` -u root"
 IFCONFIG_BIN="`which ifconfig`"
+SED=`which sed`
 
 REMOTE_MOUNT_BIN="${BINDIR}/remote_mount.py"
 REMOTE_UMOUNT_BIN="${BINDIR}/remote_umount.py"
@@ -61,6 +62,7 @@ FEATURES=
 JOURNALSIZE=0
 BLOCKS=0
 MOUNT_OPTS=
+TESTCASES=
 
 set -o pipefail
 
@@ -70,13 +72,14 @@ set -o pipefail
 f_usage()
 {
     echo "usage: `basename ${0}` <-k kerneltarball> <-n nodes> [-i nic] \
-[-a access_method] [-o logdir] <-d device> <mountpoint path>"
+[-a access_method] [-o logdir] <-d device> [-t testcases] <mountpoint path>"
     echo "       -k kerneltarball should be path of tarball for kernel src."
     echo "       -n nodelist,should be comma separated."
     echo "       -o output directory for the logs"
     echo "       -i network interface name to be used for MPI messaging."
     echo "       -a access method for mpi execution,should be ssh or rsh"
     echo "       -d device name used for ocfs2 volume."
+    echo "       -t sepcify testcases to run."
     echo "       <mountpoint path> path of mountpoint where test will be performed."
     echo 
     echo "Eaxamples:"
@@ -93,7 +96,7 @@ f_getoptions()
 		exit 1
 	fi
 
-	while getopts "n:d:i:a:o:k:h:" options; do
+	while getopts "n:d:i:a:o:k:t:h:" options; do
 		case $options in
 		n ) NODE_LIST="$OPTARG";;
 		d ) DEVICE="$OPTARG";;
@@ -101,6 +104,7 @@ f_getoptions()
 		a ) ACCESS_METHOD="$OPTARG";;
 		o ) LOG_DIR="$OPTARG";;
 		k ) KERNELSRC="$OPTARG";;
+		t ) TESTCASES="$OPTARG";;
 		h ) f_usage
 		    exit 1;;
                 * ) f_usage
@@ -191,6 +195,20 @@ f_setup()
 
         RUN_LOGFILE="`dirname ${LOG_DIR}`/`basename ${LOG_DIR}`/multiple-run-\
 `uname -m`-`date +%F-%H-%M-%S`.log"
+
+	if [ -z $TESTCASES ];then
+		TESTCASES="all"
+	fi
+
+	SUPPORTED_TESTCASES="all xattr inline reflink write_append_truncate multi_mmap create_racer flock_unit cross_delete open_delete lvb_torture"
+	for cas in ${TESTCASES}; do
+		echo ${SUPPORTED_TESTCASES} | grep -sqw $cas
+		if [ $? -ne 0 ]; then
+			echo "testcase [${cas}] not supported."
+			echo "supported testcases: [${SUPPORTED_TESTCASES}]"
+			exit 1
+		fi
+	done
 }
 
 LogRC()
@@ -456,39 +474,61 @@ f_setup $*
 STARTRUN=$(date +%s)
 ${ECHO} "`date` - Starting Multiple Nodes Regress test" > ${LOGFILE}
 
-START=$(date +%s)
-run_xattr_test 
-
-START=$(date +%s)
-run_inline_test
-
-START=$(date +%s)
-run_reflink_test
-
-for BLOCKSIZE in 512 1024 4096;do
-	for CLUSTERSIZE in 4096 32768 1048576;do
-		${ECHO} "Tests with \"-b ${BLOCKSIZE} -C ${CLUSTERSIZE}\"" | \
-${TEE_BIN} -a ${LOGFILE}
+for tc in `${ECHO} ${TESTCASES} | ${SED} "s:,: :g"`; do
+	if [ "$tc"X = "xattr"X -o "$tc"X = "all"X ]; then
 		START=$(date +%s)
-		run_write_append_truncate_test
-
-		START=$(date +%s)
-		run_multi_mmap_test
-
-		START=$(date +%s)
-		run_create_racer_test
-
-		START=$(date +%s)
-		run_flock_unit_test
+		run_xattr_test
+	fi
 
+	if [ "$tc"X = "inline"X -o "$tc"X = "all"X ]; then
 		START=$(date +%s)
-		run_cross_delete_test
+		run_inline_test
+	fi
 
+	if [ "$tc"X = "reflink"X -o "$tc"X = "all"X ]; then
 		START=$(date +%s)
-		run_open_delete_test
+		run_reflink_test
+	fi
 
-		START=$(date +%s)
-		run_lvb_torture_test
+	for BLOCKSIZE in 512 1024 4096;do
+		for CLUSTERSIZE in 4096 32768 1048576;do
+			${ECHO} "Tests with \"-b ${BLOCKSIZE} -C ${CLUSTERSIZE}\"" | \
+				${TEE_BIN} -a ${LOGFILE}
+			if [ "$tc"X = "write_append_truncate"X -o "$tc"X = "all"X ]; then
+				START=$(date +%s)
+				run_write_append_truncate_test
+			fi
+
+			if [ "$tc"X = "multi_mmap"X -o "$tc"X = "all"X ]; then
+				START=$(date +%s)
+				run_multi_mmap_test
+			fi
+
+			if [ "$tc"X = "create_racer"X -o "$tc"X = "all"X ]; then
+				START=$(date +%s)
+				run_create_racer_test
+			fi
+
+			if [ "$tc"X = "flock_unit"X -o "$tc"X = "all"X ]; then
+				START=$(date +%s)
+				run_flock_unit_test
+			fi
+
+			if [ "$tc"X = "cross_delete"X -o "$tc"X = "all"X ]; then
+				START=$(date +%s)
+				run_cross_delete_test
+			fi
+
+			if [ "$tc"X = "open_delete"X -o "$tc"X = "all"X ]; then
+				START=$(date +%s)
+				run_open_delete_test
+			fi
+
+			if [ "$tc"X = "lvb_torture"X -o "$tc"X = "all"X ]; then
+				START=$(date +%s)
+				run_lvb_torture_test
+			fi
+		done
 	done
 done
 
diff --git a/programs/python_common/single_run-WIP.sh b/programs/python_common/single_run-WIP.sh
index b5b4354..0d700cd 100755
--- a/programs/python_common/single_run-WIP.sh
+++ b/programs/python_common/single_run-WIP.sh
@@ -18,6 +18,7 @@ SEQ=`which seq`
 SUDO="`which sudo` -u root"
 WGET=`which wget`
 WHOAMI=`which whoami`
+SED=`which sed`
 
 DWNLD_PATH="http://oss.oracle.com/~smushran/ocfs2-test"
 KERNEL_TARBALL="linux-kernel.tar.gz"
@@ -931,17 +932,18 @@ run_backup_super()
 
 usage()
 {
-	${ECHO} "usage: ${APP} [-k kerneltarball] -m mountpoint -l logdir -d device"
+	${ECHO} "usage: ${APP} [-k kerneltarball] -m mountpoint -l logdir -d device [-t testcases]"
 	exit 1
 }
 
-while getopts "d:m:k:l:h?" args
+while getopts "d:m:k:l:t:h:?" args
 do
 	case "$args" in
 		d) DEVICE="$OPTARG";;
 		m) MOUNTPOINT="$OPTARG";;
 		k) KERNELSRC="$OPTARG";;
 		l) OUTDIR="$OPTARG";;
+		t) TESTCASES="$OPTARG";;
     		h) usage;;
     		?) usage;;
   	esac
@@ -968,6 +970,21 @@ if [ -z ${OUTDIR} ]; then
 	usage
 fi
 
+if [ -z ${TESTCASES} ]; then
+	TESTCASES="all"
+fi
+
+SUPPORTED_TESTCASES="all create_and_open directaio fillverifyholes renamewriterace aiostress\
+  filesizelimits mmaptruncate buildkernel splice sendfile mmap reserve_space inline xattr reflink mkfs tunefs backup_super"
+for cas in ${TESTCASES}; do
+	echo ${SUPPORTED_TESTCASES} | grep -sqw $cas
+	if [ $? -ne 0 ]; then
+		echo "testcase [${cas}] not supported."
+		echo "supported testcases: [${SUPPORTED_TESTCASES}]"
+		exit 1
+	fi
+done
+
 RUNDATE=`${DATE} +%F_%H:%M`
 LOGDIR=${OUTDIR}/${RUNDATE}
 LOGFILE=${LOGDIR}/single_run.log
@@ -989,43 +1006,83 @@ log_message "*** Start Single Node test ***"
 
 ${ECHO} "Output log is ${LOGFILE}"
 
-run_create_and_open ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+for tc in `${ECHO} ${TESTCASES} | ${SED} "s:,: :g"`; do
 
-run_directaio ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	if [ "$tc"X = "create_and_open"X -o "$tc"X = "all"X ];then
+		run_create_and_open ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	fi
 
-run_fillverifyholes ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	if [ "$tc"X = "directaio"X -o "$tc"X = "all"X ];then
+		run_directaio ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	fi
 
-run_renamewriterace ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	if [ "$tc"X = "fillverifyholes"X -o "$tc"X = "all"X ];then
+		run_fillverifyholes ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	fi
 
-run_aiostress ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	if [ "$tc"X = "renamewriterace"X -o "$tc"X = "all"X ];then
+		run_renamewriterace ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	fi
 
-run_filesizelimits ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	if [ "$tc"X = "aiostress"X -o "$tc"X = "all"X ];then
+		run_aiostress ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	fi
+
+	if [ "$tc"X = "filesizelimits"X -o "$tc"X = "all"X ];then
+		run_filesizelimits ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	fi
 
-run_mmaptruncate ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	if [ "$tc"X = "mmaptruncate"X -o "$tc"X = "all"X ];then
+		run_mmaptruncate ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	fi
 
-run_buildkernel ${LOGDIR} ${DEVICE} ${MOUNTPOINT} ${KERNELSRC}
+	if [ "$tc"X = "buildkernel"X -o "$tc"X = "all"X ];then
+		run_buildkernel ${LOGDIR} ${DEVICE} ${MOUNTPOINT} ${KERNELSRC}
+	fi
 
-run_splice ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	if [ "$tc"X = "splice"X -o "$tc"X = "all"X ];then
+		run_splice ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	fi
 
-run_sendfile ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	if [ "$tc"X = "sendfile"X -o "$tc"X = "all"X ];then
+		run_sendfile ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	fi
 
-run_mmap ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	if [ "$tc"X = "mmap"X -o "$tc"X = "all"X ];then
+		run_mmap ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	fi
 
-run_reserve_space ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	if [ "$tc"X = "reserve_space"X -o "$tc"X = "all"X ];then
+		run_reserve_space ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	fi
 
-run_inline_data ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	if [ "$tc"X = "inline"X -o "$tc"X = "all"X ];then
+		run_inline_data ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	fi
 
-run_xattr_test ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	if [ "$tc"X = "xattr"X -o "$tc"X = "all"X ];then
+		run_xattr_test ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	fi
 
-run_reflink_test ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	if [ "$tc"X = "reflink"X -o "$tc"X = "all"X ];then
+		run_reflink_test ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	fi
 
 # For tools test.
 
-run_mkfs ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	if [ "$tc"X = "mkfs"X -o "$tc"X = "all"X ];then
+		run_mkfs ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	fi
 
-run_tunefs ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	if [ "$tc"X = "tunefs"X -o "$tc"X = "all"X ];then
+		run_tunefs ${LOGDIR} ${DEVICE} ${MOUNTPOINT}
+	fi
 
-run_backup_super ${LOGDIR} ${DEVICE}
+	if [ "$tc"X = "backup_super"X -o "$tc"X = "all"X ];then
+		run_backup_super ${LOGDIR} ${DEVICE}
+	fi
+
+done
 
 ENDRUN=$(date +%s)
 
-- 
1.7.9.5




More information about the Ocfs2-test-devel mailing list