Skip to content

Commit

Permalink
changes for regression framework and functions for mounting
Browse files Browse the repository at this point in the history
  • Loading branch information
raghavendrabhat authored and vbellur committed Mar 15, 2011
1 parent 7ed2ddd commit ff62dce
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 176 deletions.
20 changes: 4 additions & 16 deletions dvm/2010/testcase
Original file line number Diff line number Diff line change
@@ -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;

17 changes: 3 additions & 14 deletions dvm/2140/testcase
Original file line number Diff line number Diff line change
@@ -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;
19 changes: 3 additions & 16 deletions dvm/2294/testcase
Original file line number Diff line number Diff line change
@@ -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;
119 changes: 0 additions & 119 deletions init

This file was deleted.

43 changes: 42 additions & 1 deletion regression_helpers
Original file line number Diff line number Diff line change
Expand Up @@ -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/*;
}
Expand Down Expand Up @@ -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=;
Expand All @@ -85,17 +101,42 @@ 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

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"
}
15 changes: 6 additions & 9 deletions regression_testcase_sample
Original file line number Diff line number Diff line change
Expand Up @@ -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;


19 changes: 18 additions & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,31 @@ _init ()
exit;
}

source ./init
[ $1 == "show" ] && {
ls $PWD/dvm | sort -n;
exit;
}

source ./regression_helpers
export GLUSTERD=$1
bug_id=;
if [ $# -eq 2 ]; then
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 ()
Expand Down

0 comments on commit ff62dce

Please sign in to comment.