diff options
-rwxr-xr-x | dvm/2010/testcase | 25 | ||||
-rwxr-xr-x | dvm/2140/testcase | 20 | ||||
-rwxr-xr-x | dvm/2294/testcase | 22 | ||||
-rw-r--r-- | init | 35 | ||||
-rw-r--r-- | regression_helpers | 101 | ||||
-rw-r--r-- | regression_testcase_sample | 19 | ||||
-rwxr-xr-x | run.sh | 65 |
7 files changed, 244 insertions, 43 deletions
diff --git a/dvm/2010/testcase b/dvm/2010/testcase new file mode 100755 index 0000000..bdd4589 --- /dev/null +++ b/dvm/2010/testcase @@ -0,0 +1,25 @@ +#!/bin/bash + +source ./regression_helpers +source ./init + +GLUSTERD_DIR=$(dirname $GLUSTERD); + +mkdir $EXPORT_DIR/$global_bug_id/; + +$GLUSTERD_DIR/gluster volume create vol $(hostname):$EXPORT_DIR/$global_bug_id/export1 2>/dev/null 1>/dev/null; + +$GLUSTERD_DIR/gluster --mode=script volume stop vol | grep "started state" 2>/dev/null 1>/dev/null; + +if [ $? -ne 0 ]; then + echo -n "$global_bug_id: " + not_ok; +else + echo -n "$global_bug_id: " + ok; +fi + +test_kill; + +test_cleanup; + diff --git a/dvm/2140/testcase b/dvm/2140/testcase new file mode 100755 index 0000000..be0b980 --- /dev/null +++ b/dvm/2140/testcase @@ -0,0 +1,20 @@ +#!/bin/bash + +source ./init +source ./regression_helpers + +GLUSTERD_DIR=$(dirname $GLUSTERD); +mkdir $EXPORT_DIR/$global_bug_id/; + +$GLUSTERD_DIR/gluster volume delete abcdsdrgf --mode=script | grep -i "exist" 2>/dev/null 1>/dev/null +if [ $? -ne 0 ]; then + echo -n "$global_bug_id: " + not_ok; +else + echo -n "$global_bug_id: " + ok; +fi + +test_kill; + +test_cleanup; diff --git a/dvm/2294/testcase b/dvm/2294/testcase new file mode 100755 index 0000000..58eeae0 --- /dev/null +++ b/dvm/2294/testcase @@ -0,0 +1,22 @@ +#!/bin/bash + + +source ./init +source ./regression_helpers + +GLUSTERD_DIR=$(dirname $GLUSTERD); +mkdir $EXPORT_DIR/$global_bug_id/; + +$GLUSTERD_DIR/gluster volume create vol transport tcp,rdma $(hostname):$EXPORT_DIR/$global_bug_id/export1 2>/dev/null 1>/dev/null + +if [ $? -ne 0 ]; then + echo -n "$global_bug_id: " + not_ok; +else + echo -n "$global_bug_id: " + ok; +fi + +test_kill; + +test_cleanup; @@ -17,50 +17,41 @@ # <http://www.gnu.org/licenses/>. # set -u -DESC=0 -BUGID=$(pwd | xargs dirname | xargs basename) +# #BUGID=$(pwd | xargs dirname | xargs basename) + +# BUGID=$( | xargs dirname | xargs basename) function ok () { - desc=$@ - if [ $DESC -ne "0" ] - then - echo "$BUGID: ok - $desc" - else - echo "$BUGID: ok" - fi + echo "ok" + } function not_ok () { - desc=$@ - if [ $DESC -ne "0" ] - then - echo "$BUGID: not ok - $desc" - else - echo "$BUGID: not ok" - fi + echo "not ok" + } -[ $# -ne 1 ] && { - not_ok "#<Usage: $(basename $0) <complete_path_to_glusterfs>" +[ $# -lt 1 ] && { + not_ok "#<Usage: $(basename $0) <complete_path_to_glusterd>" exit } -GLUSTERFS=$1 +GLUSTERD=$1 -VERSION_STR=`$GLUSTERFS --version` +VERSION_STR=`$GLUSTERD --version` VERSION=`echo $VERSION_STR|cut -d " " -f 2` if [ "$VERSION" == "" ] then -echo "Unable to determine version of $GLUSTERFS" +echo "Unable to determine version of $GLUSTERD" exit fi STARTDIR=$(pwd) LOGDIR=$PWD/logs/$VERSION -GLUSTERFSDIR=`dirname $GLUSTERFS` +GLUSTERFSDIR=`dirname $GLUSTERD` SPECDIR=$PWD/spec_files MOUNTDIR=$PWD/mnt EXPORTDIR=$PWD/export diff --git a/regression_helpers b/regression_helpers new file mode 100644 index 0000000..a321473 --- /dev/null +++ b/regression_helpers @@ -0,0 +1,101 @@ +#!/bin/bash +# +# Copyright (c) 2006-2009 Gluster, Inc. <http://www.gluster.com> +# This file is part of GlusterFS. +# +# GlusterFS is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation; either version 3 of the License, +# or (at your option) any later version. +# +# GlusterFS is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see +# <http://www.gnu.org/licenses/>. + +test_kill () +{ + killall -9 glusterfs glusterfsd 2>/dev/null 1>/dev/null; + rm -rf /etc/glusterd/vols/*; + rm -rf /etc/glusterd/peers/*; +} + +test_cleanup () +{ + rm -rf /regression/export/*; +} + +final_kill () +{ + killall -9 glusterd 2>/dev/null 1>/dev/null; + rm -rf /etc/glusterd; +} + +final_cleanup () +{ + rm -rf /regression; +} + +create_directory () +{ + local directory=$1; + + mkdir -p $directory; +} + +check_glusterd_running () +{ + local ret; + + pgrep glusterd 2>/dev/null 1>/dev/null; + if [ $? -eq 0 ]; then + ret=22; + else + ret=0; + fi + + return $ret; +} + +start_glusterd () +{ + local gluster_path=$1; + + stat --printf=%i $gluster_path 2>&1 1>/dev/null; + if [ $? -ne 0 ]; then + echo "glusterfs is not present in the path $gluster_path"; + return 22; + fi + + $gluster_path; +} + +run_testcase () +{ + local id=; + if [ $# -eq 1 ]; then + id=$1; + fi + + export global_bug_id=; + + if [ $id ]; then + global_bug_id=$id; + if [ -f ./dvm/$id/testcase ]; then + ./dvm/$id/testcase $GLUSTERD; + fi + return 0; + fi + + for i in $(ls dvm/ | grep "^[0-9]*$" | sort -n) + do + if [ -f ./dvm/$i/testcase ]; then + global_bug_id=$i; + run_testcase $i; + fi + done +} diff --git a/regression_testcase_sample b/regression_testcase_sample index a9a424b..10e6798 100644 --- a/regression_testcase_sample +++ b/regression_testcase_sample @@ -19,15 +19,28 @@ # <http://www.gnu.org/licenses/>. -source ../../init -start_glusterfs +source ./init +source ./regression_helpers + +GLUSTERD_DIR=$(dirname $GLUSTERD); + +mkdir $EXPORT_DIR/$global_bug_id; #testcase starts here +#Export directories should be from $EXPORT_DIR/$global_bug_id directory. + +#Mount point also should be from $EXPORT_DIR/$global_bug_id directory. + +#Starting the volume, mounting it and checking for the appropriate +#functionality comprises the testcase. + #This is my testcase #testcase ends here -cleanup_glusterfs +test_kill; + +test_cleanup; @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # Copyright (c) 2006-2009 Gluster, Inc. <http://www.gluster.com> # This file is part of GlusterFS. @@ -17,20 +17,49 @@ # along with this program. If not, see # <http://www.gnu.org/licenses/>. -GLUSTERFS=$1 -OLDDIR=`pwd` - -if [ 1 -ne $# ] -then - echo "Usage: run.sh <path_to_glusterfs_binary>" - return; -fi - -for i in `ls | grep "^[0-9]*$"|sort -n` -do - cd $i/regr - if [ -f ./testcase ];then - ./testcase $GLUSTERFS - fi - cd $OLDDIR -done +_init () +{ + [ $# -lt 1 ] && { + echo "#<Usage: $(basename $0) <complete_path_to_glusterd> [bug id]" + exit; + } + + source ./init + source ./regression_helpers + export GLUSTERD=$1 + bug_id=; + if [ $# -eq 2 ]; then + bug_id=$2; + fi + export EXPORT_DIR="/regression/export"; +} + +main () +{ + check_glusterd_running; + if [ $? -ne 0 ]; then + echo "glusterd is already running. Please stop and run the script"; + exit; + fi + + start_glusterd $GLUSTERD; + if [ $? -ne 0 ]; then + return 2; + fi + + create_directory $EXPORT_DIR; + + if [ ! $bug_id ]; then + run_testcase; + else + run_testcase $bug_id; + fi + + final_kill; + + final_cleanup; + + return 0; +} + +_init "$@" && main "$@" |