blob: 110839ec7a680a3f3fa8054a4e3f548c727469ae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
#!/bin/bash
ulimit -c unlimited
#set -x
#set -u
export PATH=$PATH:/opt/qa/tools:/usr/local/bin:/usr/local/sbin:/usr/sbin:/sbin
echo $PATH;
function _init()
{
arch=$(uname);
toprofile="toprofile"
DEFAULT_LOGDIR="/usr/local/var/log/glusterfs";
WORKSPACE_DIR="/gluster/glusterfs";
ARCHIVEDIR="/archives/`date +%F`";
CWDIR=`dirname $0`;
DATE=`date +%F`;
WORKDIR="/tmp/nightly";
BUILDDIR="$WORKSPACE_DIR/build";
LOGDIR="$WORKDIR/logs_$toprofile/`date +%F`";
RESULTDIR="/tmp/nightly-results";
COREDIR="$WORKDIR/$toprofile";
CORE_REPOSITORY="/opt/cores";
if [ "$arch" == "Linux" ]; then
echo "$COREDIR/core" > /proc/sys/kernel/core_pattern;
echo "1" > /proc/sys/kernel/core_uses_pid;
fi
echo "inited all the variables";
}
function prepare_dirs()
{
if [ ! -d $RESULTDIR ];then
mkdir -p $RESULTDIR;
fi
if [ ! -d $ARCHIVEDIR ];then
mkdir -p $ARCHIVEDIR;
fi
if [ ! -d $LOGDIR ]; then
mkdir -p $LOGDIR;
fi
if [ ! -d $COREDIR ]; then
mkdir -p $COREDIR;
fi
if [ ! -d $CORE_REPOSITORY ]; then
mkdir -p $CORE_REPOSITORY;
fi
}
function install_glusterfs()
{
cd $WORKSPACE_DIR
git pull;
./autogen.sh;
if [ ! -d $BUILDDIR ]
then
mkdir $BUILDDIR;
fi
cd $BUILDDIR;
if [ "$arch" == "Linux" ]; then
export CFLAGS="-g -O0 -DDEBUG";
../configure CFLAGS="-g -O0 -DDEBUG" --quiet;
make -j 32>/dev/null;
echo "make done, Installing...";
make install -j 32>/dev/null;
make clean && make distclean;
fi
}
function start_glusterd ()
{
glusterd -LDEBUG
if [ $? -ne 0 ]; then
echo "glusterd could not be started. Returning"
return 11;
else
echo "glusterd started successfully"
return 0;
fi
}
function stop_glusterd ()
{
pkill glusterd;
}
function cleanup()
{
rm -rfv /etc/glusterd;
rm -rfv $DEFAULT_LOGDIR/*;
rm -rfv $WORKDIR;
}
function pre_run_cleanup ()
{
stop_glusterd;
cleanup;
}
function pre_run()
{
echo "Entered pre_run";
prepare_dirs;
set -e;
install_glusterfs;
echo "Exiting pre_run";
}
function save_and_send_results_and_logs()
{
#Arching Result and Logs
egrep "PASS|FAIL|KEY" $RESULTDIR/temp.result >$RESULTDIR/top_profile.result
cp -r $DEFAULT_LOGDIR/* $LOGDIR/;
cp -r $LOGDIR $ARCHIVEDIR;
cp $RESULTDIR/temp.result $ARCHIVEDIR ;
cp $RESULTDIR/top_profile.result $ARCHIVEDIR ;
#Send the results to vishwanath@shell.gluster.com
ssh vishwanath@shell.gluster.com "rm -f ~/top-profile_sanity/*" #Remove this ugly hack ASAP. inotify programme should be taking care of this.
scp $RESULTDIR/top_profile.result vishwanath@shell.gluster.com:~/top-profile_sanity/
scp $RESULTDIR/temp.result vishwanath@shell.gluster.com:~/top-profile_sanity/results_details.txt
}
function clean_results()
{
directory=`date +%F`
rm -rf $RESULTDIR;
}
function check_and_kill ()
{
pgrep gluster | xargs kill -9
}
function post_run()
{
set +e;
check_and_kill;
save_and_send_results_and_logs;
cleanup;
clean_results;
}
function main()
{
echo "In main";
trap "post_run" INT TERM EXIT;
pre_run_cleanup;
pre_run;
start_glusterd;
$CWDIR/top_profile.sh 192.168.1.222 192.168.1.222 >$RESULTDIR/temp.result
trap - INT TERM EXIT
post_run;
}
_init "$@" && main "$@"
|