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
|
#!/bin/bash
typeset -i error=0
typeset host=crashdcSLES10
wait_for_server()
{
host=$1
typeset -i nologin=1
typeset -i nonetwork=1
echo -n "### $(date) Waiting for $host VM to settle"
while (( nologin )) || (( nonetwork ));do
echo -n "."
ping -q -c 1 -t 5 ${host} > /dev/null
error=$?
if (( error ));then
nonetwork=1
nologin=1
else
if (( nonetwork ));then
echo
echo -n "### $(date) $host VM is there and network is started"
fi
nonetwork=0
ssh -o ConnectTimeout=5 root@${host} uname -a > /dev/null 2>&1
error=$?
if ! (( error ));then
nologin=0
echo
echo "### $(date) $host VM is there and login is enabled"
else
sleep 5
fi
fi
done
}
cleanup_last_vmcore()
{
ssh root@${host} "rm -f \'ls -rtd /var/log/dump/*/vmcore | head -1\'"
}
test_service()
{
echo "### $(date) Testing crashdc init script"
ssh root@${host} "service crashdc status"
ssh root@${host} "service crashdc generate"
sleep 45
ssh root@${host} "service crashdc generate advanced"
sleep 45
ssh root@${host} "service crashdc generate custom /tmp/toto"
}
echo "### $(date) Starting SLES10 VM"
vmrun -T ws start /work/VM/${host}/${host}.vmx
wait_for_server ${host}
echo "### $(date) Preparing VM for tests"
scp prepare_test_sles10 root@${host}:
ssh root@${host} /root/prepare_test_sles10
sync
sleep 5
sync
echo "### $(date) Run ${host} test #1 : BIGSMP kernel"
nohup ssh root@${host} "echo c > /proc/sysrq-trigger" > /dev/null 2>&1 &
sleep 10 #Otherwise the other end is still alive
wait_for_server ${host}
test_service
echo "### $(date) Preparing to reboot to SMP kernel"
ssh root@${host} "mv /boot/grub/menu.lst /boot/grub/menu.lst.bigsmp;sed 's/^default 6/default 5/' /boot/grub/menu.lst.bigsmp > /boot/grub/menu.lst"
ssh root@${host} "reboot"
sleep 10 #Otherwise the other end is still alive
wait_for_server ${host}
echo "### $(date) Run ${host} test #2 : SMP kernel"
nohup ssh root@${host} "echo c > /proc/sysrq-trigger" > /dev/null 2>&1 &
sleep 10 #Otherwise the other end is still alive
wait_for_server ${host}
test_service
echo "### $(date) Preparing to reboot to VMIPAE kernel"
ssh root@${host} "mv /boot/grub/menu.lst /boot/grub/menu.lst.vmipae;sed 's/^default 5/default 4/' /boot/grub/menu.lst.vmipae > /boot/grub/menu.lst"
ssh root@${host} "reboot"
sleep 10 #Otherwise the other end is still alive
wait_for_server ${host}
echo "### $(date) Run ${host} test #3 : VMIPAE kernel"
nohup ssh root@${host} "echo c > /proc/sysrq-trigger" > /dev/null 2>&1 &
sleep 10 #Otherwise the other end is still alive
wait_for_server ${host}
test_service
echo "### $(date) Preparing to reboot to VMI kernel"
ssh root@${host} "mv /boot/grub/menu.lst /boot/grub/menu.lst.vmi;sed 's/^default 4/default 3/' /boot/grub/menu.lst.vmi > /boot/grub/menu.lst"
ssh root@${host} "reboot"
sleep 10 #Otherwise the other end is still alive
wait_for_server ${host}
cleanup_last_vmcore
echo "### $(date) Run ${host} test #4 : VMI kernel"
nohup ssh root@${host} "echo c > /proc/sysrq-trigger" > /dev/null 2>&1 &
sleep 10 #Otherwise the other end is still alive
wait_for_server ${host}
test_service
echo "### $(date) Preparing to reboot to XENPAE kernel"
ssh root@${host} "mv /boot/grub/menu.lst /boot/grub/menu.lst.xenpae;sed 's/^default 3/default 2/' /boot/grub/menu.lst.xenpae > /boot/grub/menu.lst"
ssh root@${host} "reboot"
sleep 10 #Otherwise the other end is still alive
wait_for_server ${host}
cleanup_last_vmcore
echo "### $(date) Run ${host} test #5 : XENPAE kernel"
nohup ssh root@${host} "echo c > /proc/sysrq-trigger" > /dev/null 2>&1 &
sleep 10 #Otherwise the other end is still alive
wait_for_server ${host}
test_service
echo "### $(date) Preparing to reboot to XEN kernel"
ssh root@${host} "mv /boot/grub/menu.lst /boot/grub/menu.lst.xen;sed 's/^default 2/default 1/' /boot/grub/menu.lst.xen > /boot/grub/menu.lst"
ssh root@${host} "reboot"
sleep 10 #Otherwise the other end is still alive
wait_for_server ${host}
cleanup_last_vmcore
echo "### $(date) Run ${host} test #6 : XEN kernel"
nohup ssh root@${host} "echo c > /proc/sysrq-trigger" > /dev/null 2>&1 &
sleep 10 #Otherwise the other end is still alive
wait_for_server ${host}
test_service
echo "### $(date) Preparing to reboot to DEFAULT kernel"
ssh root@${host} "mv /boot/grub/menu.lst /boot/grub/menu.lst.default;sed 's/^default 1/default 0/' /boot/grub/menu.lst.default > /boot/grub/menu.lst"
ssh root@${host} "reboot"
sleep 10 #Otherwise the other end is still alive
wait_for_server ${host}
cleanup_last_vmcore
echo "### $(date) Run ${host} test #7 : DEFAULT kernel"
nohup ssh root@${host} "echo c > /proc/sysrq-trigger" > /dev/null 2>&1 &
sleep 10 #Otherwise the other end is still alive
wait_for_server ${host}
test_service
echo "### $(date) Finished running all tests"
echo
echo "### $(date) Tests Results are :"
ssh root@${host} "grep -e KERNEL: -e DUMPFILE -e \"mode in use\" /var/log/dump/2*/*txt"
exit 0
|