diff options
-rwxr-xr-x | dvm/2010/testcase | 20 | ||||
-rwxr-xr-x | dvm/2140/testcase | 17 | ||||
-rwxr-xr-x | dvm/2294/testcase | 19 | ||||
-rw-r--r-- | init | 119 | ||||
-rw-r--r-- | regression_helpers | 43 | ||||
-rw-r--r-- | regression_testcase_sample | 15 | ||||
-rwxr-xr-x | run.sh | 19 |
7 files changed, 76 insertions, 176 deletions
diff --git a/dvm/2010/testcase b/dvm/2010/testcase index bdd4589..cdc3055 100755 --- a/dvm/2010/testcase +++ b/dvm/2010/testcase @@ -1,25 +1,13 @@ #!/bin/bash source ./regression_helpers -source ./init -GLUSTERD_DIR=$(dirname $GLUSTERD); +VOLNAME="vol"; +$GLUSTERFSDIR/gluster volume create $VOLNAME $(hostname):$EXPORT_DIR/$global_bug_id/export1 2>/dev/null 1>/dev/null; -mkdir $EXPORT_DIR/$global_bug_id/; +$GLUSTERFSDIR/gluster --mode=script volume stop $VOLNAME | grep "started state" 2>/dev/null 1>/dev/null; -$GLUSTERD_DIR/gluster volume create vol $(hostname):$EXPORT_DIR/$global_bug_id/export1 2>/dev/null 1>/dev/null; +exit $?; -$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 index be0b980..cc7ec09 100755 --- a/dvm/2140/testcase +++ b/dvm/2140/testcase @@ -1,20 +1,9 @@ #!/bin/bash -source ./init source ./regression_helpers -GLUSTERD_DIR=$(dirname $GLUSTERD); -mkdir $EXPORT_DIR/$global_bug_id/; +VOLNAME="abcdefg"; +$GLUSTERFSDIR/gluster volume delete $VOLNAME --mode=script | grep -i "exist" 2>/dev/null 1>/dev/null +exit $?; -$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 index 58eeae0..c363897 100755 --- a/dvm/2294/testcase +++ b/dvm/2294/testcase @@ -1,22 +1,9 @@ #!/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 +VOLNAME="vol"; +$GLUSTERFSDIR/gluster volume create $VOLNAME transport tcp,rdma $(hostname):$EXPORT_DIR/$global_bug_id/export1 2>/dev/null 1>/dev/null +exit $?; -test_kill; -test_cleanup; @@ -1,119 +0,0 @@ -# -# 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/>. -# -set -u -# #BUGID=$(pwd | xargs dirname | xargs basename) - -# BUGID=$( | xargs dirname | xargs basename) - -function ok () -{ - echo "ok" - -} - -function not_ok () -{ - echo "not ok" - -} - -[ $# -lt 1 ] && { - not_ok "#<Usage: $(basename $0) <complete_path_to_glusterd>" - exit -} - -GLUSTERD=$1 - -VERSION_STR=`$GLUSTERD --version` -VERSION=`echo $VERSION_STR|cut -d " " -f 2` - -if [ "$VERSION" == "" ] -then -echo "Unable to determine version of $GLUSTERD" -exit -fi - -STARTDIR=$(pwd) -LOGDIR=$PWD/logs/$VERSION -GLUSTERFSDIR=`dirname $GLUSTERD` -SPECDIR=$PWD/spec_files -MOUNTDIR=$PWD/mnt -EXPORTDIR=$PWD/export - -function replace_exportdir () -{ - j=1 - for i in `ls $SPECDIR/server*.vol` - do - cp -p $i $i.tmp - sed -i "s|option.*directory.*|option directory $EXPORTDIR/export$j|" $i - let "j += 1" - done -} - -function revert_exportdir () -{ - for i in `ls $SPECDIR/server*.vol` - do - mv $i.tmp $i - done -} - -function comment () -{ - desc=$@ - if [ $DESC -ne "0" ] - then - echo "$desc" - fi -} - -function start_glusterfs () -{ - args=$* - replace_exportdir - ../../setup $VERSION $BUGID -E $EXPORTDIR -M $MOUNTDIR -G $GLUSTERFSDIR -L $LOGDIR -S $SPECDIR $args -} - -function stop_glusterfs () -{ - cd $STARTDIR -# Kill the clients - sudo pkill -f "$GLUSTERFSDIR/glusterfs --run-id regr-$BUGID-$VERSION-c" 2>/dev/null - for i in `ls $MOUNTDIR/ 2>/dev/null` - do - sudo umount $MOUNTDIR/$i 1>&2 2>/dev/null - done -# Kill the servers later - sudo pkill -f "$GLUSTERFSDIR/glusterfsd --run-id regr-$BUGID-$VERSION-s" -} - -function cleanup_dir () -{ - rm -rf $EXPORTDIR - rm -rf `dirname $LOGDIR` - rm -rf $MOUNTDIR -} - -function cleanup_glusterfs () -{ - revert_exportdir - stop_glusterfs - cleanup_dir -} diff --git a/regression_helpers b/regression_helpers index a321473..571ab01 100644 --- a/regression_helpers +++ b/regression_helpers @@ -20,6 +20,8 @@ test_kill () { killall -9 glusterfs glusterfsd 2>/dev/null 1>/dev/null; + umount -l $FUSE_MOUNT 2>/dev/null 1>/dev/null; + umount -l $NFS_MOUNT 2>/dev/null 1>/dev/null; rm -rf /etc/glusterd/vols/*; rm -rf /etc/glusterd/peers/*; } @@ -74,6 +76,20 @@ start_glusterd () $gluster_path; } +mount_glusterfs () +{ + local volname=$1; + + $GLUSTERFSDIR/glusterfs --volfile-server=$(hostname) --volfile-id=$volname $FUSE_MOUNT; +} + +mount_nfs () +{ + local volname=$1; + + mount $(hostname):$volname $NFS_MOUNT; +} + run_testcase () { local id=; @@ -85,8 +101,24 @@ run_testcase () if [ $id ]; then global_bug_id=$id; + export FUSE_MOUNT=$EXPORT_DIR/$global_bug_id/fuse; + export NFS_MOUNT=$EXPORT_DIR/$global_bug_id/nfs; + if [ -f ./dvm/$id/testcase ]; then + create_directory $FUSE_MOUNT; + create_directory $NFS_MOUNT; + ./dvm/$id/testcase $GLUSTERD; + if [ $? -ne 0 ]; then + echo -n "$global_bug_id: " + not_ok; + else + echo -n "$global_bug_id: " + ok; + fi + + test_kill; + test_cleanup; fi return 0; fi @@ -94,8 +126,17 @@ run_testcase () 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 } + +function ok () +{ + echo "ok" +} + +function not_ok () +{ + echo "not ok" +} diff --git a/regression_testcase_sample b/regression_testcase_sample index 10e6798..3b74398 100644 --- a/regression_testcase_sample +++ b/regression_testcase_sample @@ -19,28 +19,25 @@ # <http://www.gnu.org/licenses/>. -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. +#For fuse mounts use mount_glusterfs $FUSE_MOUNT fumction. +#For nfs mounts use mount_nfs $NFS_MOUNT function #Starting the volume, mounting it and checking for the appropriate #functionality comprises the testcase. +#the glusterfs binaries for the provided version can be obtained from the +#$GLUSTERFSDIR variable which points to the directory containing the +#gluster binaries such as glusterfs, glusterfsd, gluster + #This is my testcase #testcase ends here -test_kill; - -test_cleanup; @@ -24,7 +24,11 @@ _init () exit; } - source ./init + [ $1 == "show" ] && { + ls $PWD/dvm | sort -n; + exit; + } + source ./regression_helpers export GLUSTERD=$1 bug_id=; @@ -32,6 +36,19 @@ _init () bug_id=$2; fi export EXPORT_DIR="/regression/export"; + export glusterd_conf="/etc/glusterd"; + + export GLUSTERFSDIR=$(dirname $GLUSTERD); + export VERSION_STR=$($GLUSTERD --version) 2>&1 1>/dev/null + export VERSION=$(echo $VERSION_STR|cut -d " " -f 2) + + if [ "$VERSION" == "" ] + then + echo "Unable to determine version of $GLUSTERD" + exit + fi + + LOGDIR=$(dirname $GLUSTERFSDIR)/var/log/glusterfs; } main () |