Skip to content

Commit 7ed2ddd

Browse files
raghavendrabhatvbellur
authored andcommitted
changes for dvm specific testcases
Signed-off-by: Vijay Bellur <[email protected]>
1 parent 914f0ae commit 7ed2ddd

File tree

7 files changed

+244
-43
lines changed

7 files changed

+244
-43
lines changed

dvm/2010/testcase

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
source ./regression_helpers
4+
source ./init
5+
6+
GLUSTERD_DIR=$(dirname $GLUSTERD);
7+
8+
mkdir $EXPORT_DIR/$global_bug_id/;
9+
10+
$GLUSTERD_DIR/gluster volume create vol $(hostname):$EXPORT_DIR/$global_bug_id/export1 2>/dev/null 1>/dev/null;
11+
12+
$GLUSTERD_DIR/gluster --mode=script volume stop vol | grep "started state" 2>/dev/null 1>/dev/null;
13+
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;
25+

dvm/2140/testcase

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
source ./init
4+
source ./regression_helpers
5+
6+
GLUSTERD_DIR=$(dirname $GLUSTERD);
7+
mkdir $EXPORT_DIR/$global_bug_id/;
8+
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
17+
18+
test_kill;
19+
20+
test_cleanup;

dvm/2294/testcase

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
4+
source ./init
5+
source ./regression_helpers
6+
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
19+
20+
test_kill;
21+
22+
test_cleanup;

init

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,50 +17,41 @@
1717
# <http://www.gnu.org/licenses/>.
1818
#
1919
set -u
20-
DESC=0
21-
BUGID=$(pwd | xargs dirname | xargs basename)
20+
# #BUGID=$(pwd | xargs dirname | xargs basename)
21+
22+
# BUGID=$( | xargs dirname | xargs basename)
2223

2324
function ok ()
2425
{
25-
desc=$@
26-
if [ $DESC -ne "0" ]
27-
then
28-
echo "$BUGID: ok - $desc"
29-
else
30-
echo "$BUGID: ok"
31-
fi
26+
echo "ok"
27+
3228
}
3329

3430
function not_ok ()
3531
{
36-
desc=$@
37-
if [ $DESC -ne "0" ]
38-
then
39-
echo "$BUGID: not ok - $desc"
40-
else
41-
echo "$BUGID: not ok"
42-
fi
32+
echo "not ok"
33+
4334
}
4435

45-
[ $# -ne 1 ] && {
46-
not_ok "#<Usage: $(basename $0) <complete_path_to_glusterfs>"
36+
[ $# -lt 1 ] && {
37+
not_ok "#<Usage: $(basename $0) <complete_path_to_glusterd>"
4738
exit
4839
}
4940

50-
GLUSTERFS=$1
41+
GLUSTERD=$1
5142

52-
VERSION_STR=`$GLUSTERFS --version`
43+
VERSION_STR=`$GLUSTERD --version`
5344
VERSION=`echo $VERSION_STR|cut -d " " -f 2`
5445

5546
if [ "$VERSION" == "" ]
5647
then
57-
echo "Unable to determine version of $GLUSTERFS"
48+
echo "Unable to determine version of $GLUSTERD"
5849
exit
5950
fi
6051

6152
STARTDIR=$(pwd)
6253
LOGDIR=$PWD/logs/$VERSION
63-
GLUSTERFSDIR=`dirname $GLUSTERFS`
54+
GLUSTERFSDIR=`dirname $GLUSTERD`
6455
SPECDIR=$PWD/spec_files
6556
MOUNTDIR=$PWD/mnt
6657
EXPORTDIR=$PWD/export

regression_helpers

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
#!/bin/bash
2+
#
3+
# Copyright (c) 2006-2009 Gluster, Inc. <http://www.gluster.com>
4+
# This file is part of GlusterFS.
5+
#
6+
# GlusterFS is free software; you can redistribute it and/or modify
7+
# it under the terms of the GNU General Public License as published
8+
# by the Free Software Foundation; either version 3 of the License,
9+
# or (at your option) any later version.
10+
#
11+
# GlusterFS is distributed in the hope that it will be useful, but
12+
# WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
# General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU General Public License
17+
# along with this program. If not, see
18+
# <http://www.gnu.org/licenses/>.
19+
20+
test_kill ()
21+
{
22+
killall -9 glusterfs glusterfsd 2>/dev/null 1>/dev/null;
23+
rm -rf /etc/glusterd/vols/*;
24+
rm -rf /etc/glusterd/peers/*;
25+
}
26+
27+
test_cleanup ()
28+
{
29+
rm -rf /regression/export/*;
30+
}
31+
32+
final_kill ()
33+
{
34+
killall -9 glusterd 2>/dev/null 1>/dev/null;
35+
rm -rf /etc/glusterd;
36+
}
37+
38+
final_cleanup ()
39+
{
40+
rm -rf /regression;
41+
}
42+
43+
create_directory ()
44+
{
45+
local directory=$1;
46+
47+
mkdir -p $directory;
48+
}
49+
50+
check_glusterd_running ()
51+
{
52+
local ret;
53+
54+
pgrep glusterd 2>/dev/null 1>/dev/null;
55+
if [ $? -eq 0 ]; then
56+
ret=22;
57+
else
58+
ret=0;
59+
fi
60+
61+
return $ret;
62+
}
63+
64+
start_glusterd ()
65+
{
66+
local gluster_path=$1;
67+
68+
stat --printf=%i $gluster_path 2>&1 1>/dev/null;
69+
if [ $? -ne 0 ]; then
70+
echo "glusterfs is not present in the path $gluster_path";
71+
return 22;
72+
fi
73+
74+
$gluster_path;
75+
}
76+
77+
run_testcase ()
78+
{
79+
local id=;
80+
if [ $# -eq 1 ]; then
81+
id=$1;
82+
fi
83+
84+
export global_bug_id=;
85+
86+
if [ $id ]; then
87+
global_bug_id=$id;
88+
if [ -f ./dvm/$id/testcase ]; then
89+
./dvm/$id/testcase $GLUSTERD;
90+
fi
91+
return 0;
92+
fi
93+
94+
for i in $(ls dvm/ | grep "^[0-9]*$" | sort -n)
95+
do
96+
if [ -f ./dvm/$i/testcase ]; then
97+
global_bug_id=$i;
98+
run_testcase $i;
99+
fi
100+
done
101+
}

regression_testcase_sample

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

2121

22-
source ../../init
23-
start_glusterfs
22+
source ./init
23+
source ./regression_helpers
24+
25+
GLUSTERD_DIR=$(dirname $GLUSTERD);
26+
27+
mkdir $EXPORT_DIR/$global_bug_id;
2428

2529
#testcase starts here
2630

31+
#Export directories should be from $EXPORT_DIR/$global_bug_id directory.
32+
33+
#Mount point also should be from $EXPORT_DIR/$global_bug_id directory.
34+
35+
#Starting the volume, mounting it and checking for the appropriate
36+
#functionality comprises the testcase.
37+
2738
#This is my testcase
2839

2940
#testcase ends here
3041

31-
cleanup_glusterfs
42+
test_kill;
43+
44+
test_cleanup;
3245

3346

run.sh

Lines changed: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/bin/bash
22
#
33
# Copyright (c) 2006-2009 Gluster, Inc. <http://www.gluster.com>
44
# This file is part of GlusterFS.
@@ -17,20 +17,49 @@
1717
# along with this program. If not, see
1818
# <http://www.gnu.org/licenses/>.
1919

20-
GLUSTERFS=$1
21-
OLDDIR=`pwd`
22-
23-
if [ 1 -ne $# ]
24-
then
25-
echo "Usage: run.sh <path_to_glusterfs_binary>"
26-
return;
27-
fi
28-
29-
for i in `ls | grep "^[0-9]*$"|sort -n`
30-
do
31-
cd $i/regr
32-
if [ -f ./testcase ];then
33-
./testcase $GLUSTERFS
34-
fi
35-
cd $OLDDIR
36-
done
20+
_init ()
21+
{
22+
[ $# -lt 1 ] && {
23+
echo "#<Usage: $(basename $0) <complete_path_to_glusterd> [bug id]"
24+
exit;
25+
}
26+
27+
source ./init
28+
source ./regression_helpers
29+
export GLUSTERD=$1
30+
bug_id=;
31+
if [ $# -eq 2 ]; then
32+
bug_id=$2;
33+
fi
34+
export EXPORT_DIR="/regression/export";
35+
}
36+
37+
main ()
38+
{
39+
check_glusterd_running;
40+
if [ $? -ne 0 ]; then
41+
echo "glusterd is already running. Please stop and run the script";
42+
exit;
43+
fi
44+
45+
start_glusterd $GLUSTERD;
46+
if [ $? -ne 0 ]; then
47+
return 2;
48+
fi
49+
50+
create_directory $EXPORT_DIR;
51+
52+
if [ ! $bug_id ]; then
53+
run_testcase;
54+
else
55+
run_testcase $bug_id;
56+
fi
57+
58+
final_kill;
59+
60+
final_cleanup;
61+
62+
return 0;
63+
}
64+
65+
_init "$@" && main "$@"

0 commit comments

Comments
 (0)