Skip to content

Commit ff62dce

Browse files
raghavendrabhatvbellur
authored andcommitted
changes for regression framework and functions for mounting
1 parent 7ed2ddd commit ff62dce

File tree

7 files changed

+76
-176
lines changed

7 files changed

+76
-176
lines changed

dvm/2010/testcase

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,13 @@
11
#!/bin/bash
22

33
source ./regression_helpers
4-
source ./init
54

6-
GLUSTERD_DIR=$(dirname $GLUSTERD);
5+
VOLNAME="vol";
6+
$GLUSTERFSDIR/gluster volume create $VOLNAME $(hostname):$EXPORT_DIR/$global_bug_id/export1 2>/dev/null 1>/dev/null;
77

8-
mkdir $EXPORT_DIR/$global_bug_id/;
8+
$GLUSTERFSDIR/gluster --mode=script volume stop $VOLNAME | grep "started state" 2>/dev/null 1>/dev/null;
99

10-
$GLUSTERD_DIR/gluster volume create vol $(hostname):$EXPORT_DIR/$global_bug_id/export1 2>/dev/null 1>/dev/null;
10+
exit $?;
1111

12-
$GLUSTERD_DIR/gluster --mode=script volume stop vol | grep "started state" 2>/dev/null 1>/dev/null;
1312

14-
if [ $? -ne 0 ]; then
15-
echo -n "$global_bug_id: "
16-
not_ok;
17-
else
18-
echo -n "$global_bug_id: "
19-
ok;
20-
fi
21-
22-
test_kill;
23-
24-
test_cleanup;
2513

dvm/2140/testcase

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,9 @@
11
#!/bin/bash
22

3-
source ./init
43
source ./regression_helpers
54

6-
GLUSTERD_DIR=$(dirname $GLUSTERD);
7-
mkdir $EXPORT_DIR/$global_bug_id/;
5+
VOLNAME="abcdefg";
6+
$GLUSTERFSDIR/gluster volume delete $VOLNAME --mode=script | grep -i "exist" 2>/dev/null 1>/dev/null
7+
exit $?;
88

9-
$GLUSTERD_DIR/gluster volume delete abcdsdrgf --mode=script | grep -i "exist" 2>/dev/null 1>/dev/null
10-
if [ $? -ne 0 ]; then
11-
echo -n "$global_bug_id: "
12-
not_ok;
13-
else
14-
echo -n "$global_bug_id: "
15-
ok;
16-
fi
179

18-
test_kill;
19-
20-
test_cleanup;

dvm/2294/testcase

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,9 @@
11
#!/bin/bash
22

3-
4-
source ./init
53
source ./regression_helpers
64

7-
GLUSTERD_DIR=$(dirname $GLUSTERD);
8-
mkdir $EXPORT_DIR/$global_bug_id/;
9-
10-
$GLUSTERD_DIR/gluster volume create vol transport tcp,rdma $(hostname):$EXPORT_DIR/$global_bug_id/export1 2>/dev/null 1>/dev/null
11-
12-
if [ $? -ne 0 ]; then
13-
echo -n "$global_bug_id: "
14-
not_ok;
15-
else
16-
echo -n "$global_bug_id: "
17-
ok;
18-
fi
5+
VOLNAME="vol";
6+
$GLUSTERFSDIR/gluster volume create $VOLNAME transport tcp,rdma $(hostname):$EXPORT_DIR/$global_bug_id/export1 2>/dev/null 1>/dev/null
7+
exit $?;
198

20-
test_kill;
219

22-
test_cleanup;

init

Lines changed: 0 additions & 119 deletions
This file was deleted.

regression_helpers

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
test_kill ()
2121
{
2222
killall -9 glusterfs glusterfsd 2>/dev/null 1>/dev/null;
23+
umount -l $FUSE_MOUNT 2>/dev/null 1>/dev/null;
24+
umount -l $NFS_MOUNT 2>/dev/null 1>/dev/null;
2325
rm -rf /etc/glusterd/vols/*;
2426
rm -rf /etc/glusterd/peers/*;
2527
}
@@ -74,6 +76,20 @@ start_glusterd ()
7476
$gluster_path;
7577
}
7678

79+
mount_glusterfs ()
80+
{
81+
local volname=$1;
82+
83+
$GLUSTERFSDIR/glusterfs --volfile-server=$(hostname) --volfile-id=$volname $FUSE_MOUNT;
84+
}
85+
86+
mount_nfs ()
87+
{
88+
local volname=$1;
89+
90+
mount $(hostname):$volname $NFS_MOUNT;
91+
}
92+
7793
run_testcase ()
7894
{
7995
local id=;
@@ -85,17 +101,42 @@ run_testcase ()
85101

86102
if [ $id ]; then
87103
global_bug_id=$id;
104+
export FUSE_MOUNT=$EXPORT_DIR/$global_bug_id/fuse;
105+
export NFS_MOUNT=$EXPORT_DIR/$global_bug_id/nfs;
106+
88107
if [ -f ./dvm/$id/testcase ]; then
108+
create_directory $FUSE_MOUNT;
109+
create_directory $NFS_MOUNT;
110+
89111
./dvm/$id/testcase $GLUSTERD;
112+
if [ $? -ne 0 ]; then
113+
echo -n "$global_bug_id: "
114+
not_ok;
115+
else
116+
echo -n "$global_bug_id: "
117+
ok;
118+
fi
119+
120+
test_kill;
121+
test_cleanup;
90122
fi
91123
return 0;
92124
fi
93125

94126
for i in $(ls dvm/ | grep "^[0-9]*$" | sort -n)
95127
do
96128
if [ -f ./dvm/$i/testcase ]; then
97-
global_bug_id=$i;
98129
run_testcase $i;
99130
fi
100131
done
101132
}
133+
134+
function ok ()
135+
{
136+
echo "ok"
137+
}
138+
139+
function not_ok ()
140+
{
141+
echo "not ok"
142+
}

regression_testcase_sample

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,25 @@
1919
# <http://www.gnu.org/licenses/>.
2020

2121

22-
source ./init
2322
source ./regression_helpers
2423

25-
GLUSTERD_DIR=$(dirname $GLUSTERD);
26-
27-
mkdir $EXPORT_DIR/$global_bug_id;
28-
2924
#testcase starts here
3025

3126
#Export directories should be from $EXPORT_DIR/$global_bug_id directory.
3227

33-
#Mount point also should be from $EXPORT_DIR/$global_bug_id directory.
28+
#For fuse mounts use mount_glusterfs $FUSE_MOUNT fumction.
29+
#For nfs mounts use mount_nfs $NFS_MOUNT function
3430

3531
#Starting the volume, mounting it and checking for the appropriate
3632
#functionality comprises the testcase.
3733

34+
#the glusterfs binaries for the provided version can be obtained from the
35+
#$GLUSTERFSDIR variable which points to the directory containing the
36+
#gluster binaries such as glusterfs, glusterfsd, gluster
37+
3838
#This is my testcase
3939

4040
#testcase ends here
4141

42-
test_kill;
43-
44-
test_cleanup;
4542

4643

run.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,31 @@ _init ()
2424
exit;
2525
}
2626

27-
source ./init
27+
[ $1 == "show" ] && {
28+
ls $PWD/dvm | sort -n;
29+
exit;
30+
}
31+
2832
source ./regression_helpers
2933
export GLUSTERD=$1
3034
bug_id=;
3135
if [ $# -eq 2 ]; then
3236
bug_id=$2;
3337
fi
3438
export EXPORT_DIR="/regression/export";
39+
export glusterd_conf="/etc/glusterd";
40+
41+
export GLUSTERFSDIR=$(dirname $GLUSTERD);
42+
export VERSION_STR=$($GLUSTERD --version) 2>&1 1>/dev/null
43+
export VERSION=$(echo $VERSION_STR|cut -d " " -f 2)
44+
45+
if [ "$VERSION" == "" ]
46+
then
47+
echo "Unable to determine version of $GLUSTERD"
48+
exit
49+
fi
50+
51+
LOGDIR=$(dirname $GLUSTERFSDIR)/var/log/glusterfs;
3552
}
3653

3754
main ()

0 commit comments

Comments
 (0)