97
by louis_bouchard
test scripts for SLES10 |
1 |
#!/bin/bash
|
2 |
||
3 |
typeset -i error=0 |
|
4 |
typeset host=crashdcSLES10 |
|
5 |
||
6 |
wait_for_server()
|
|
7 |
{
|
|
8 |
host=$1 |
|
9 |
||
10 |
typeset -i nologin=1 |
|
11 |
typeset -i nonetwork=1 |
|
12 |
||
13 |
echo -n "### $(date) Waiting for $host VM to settle" |
|
14 |
while (( nologin )) || (( nonetwork ));do |
|
15 |
echo -n "." |
|
16 |
||
17 |
ping -q -c 1 -t 5 ${host} > /dev/null |
|
18 |
||
19 |
error=$? |
|
20 |
||
21 |
if (( error ));then |
|
22 |
nonetwork=1 |
|
23 |
nologin=1 |
|
24 |
else
|
|
25 |
if (( nonetwork ));then |
|
26 |
echo
|
|
27 |
echo -n "### $(date) $host VM is there and network is started" |
|
28 |
fi
|
|
29 |
nonetwork=0 |
|
30 |
ssh -o ConnectTimeout=5 root@${host} uname -a > /dev/null 2>&1 |
|
31 |
error=$? |
|
32 |
if ! (( error ));then |
|
33 |
nologin=0 |
|
34 |
echo
|
|
35 |
echo "### $(date) $host VM is there and login is enabled" |
|
36 |
else
|
|
37 |
sleep 5
|
|
38 |
fi
|
|
39 |
fi
|
|
40 |
done
|
|
41 |
}
|
|
42 |
||
43 |
cleanup_last_vmcore()
|
|
44 |
{
|
|
45 |
ssh root@${host} "rm -f \'ls -rtd /var/log/dump/*/vmcore | head -1\'" |
|
46 |
}
|
|
47 |
||
48 |
test_service()
|
|
49 |
{
|
|
50 |
echo "### $(date) Testing crashdc init script" |
|
51 |
ssh root@${host} "service crashdc status" |
|
52 |
ssh root@${host} "service crashdc generate" |
|
53 |
sleep 45
|
|
54 |
ssh root@${host} "service crashdc generate advanced" |
|
55 |
sleep 45
|
|
56 |
ssh root@${host} "service crashdc generate custom /tmp/toto" |
|
57 |
}
|
|
58 |
echo "### $(date) Starting SLES10 VM" |
|
59 |
||
60 |
vmrun -T ws start /work/VM/${host}/${host}.vmx |
|
61 |
||
62 |
wait_for_server ${host} |
|
63 |
||
64 |
echo "### $(date) Preparing VM for tests" |
|
65 |
scp prepare_test_sles10 root@${host}: |
|
66 |
ssh root@${host} /root/prepare_test_sles10 |
|
67 |
sync |
|
68 |
sleep 5
|
|
69 |
sync |
|
70 |
||
71 |
echo "### $(date) Run ${host} test #1 : BIGSMP kernel" |
|
72 |
nohup ssh root@${host} "echo c > /proc/sysrq-trigger" > /dev/null 2>&1 & |
|
73 |
sleep 10 #Otherwise the other end is still alive |
|
74 |
||
75 |
wait_for_server ${host} |
|
76 |
||
77 |
test_service |
|
78 |
||
79 |
echo "### $(date) Preparing to reboot to SMP kernel" |
|
80 |
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" |
|
81 |
ssh root@${host} "reboot" |
|
82 |
sleep 10 #Otherwise the other end is still alive |
|
83 |
||
84 |
wait_for_server ${host} |
|
85 |
echo "### $(date) Run ${host} test #2 : SMP kernel" |
|
86 |
nohup ssh root@${host} "echo c > /proc/sysrq-trigger" > /dev/null 2>&1 & |
|
87 |
sleep 10 #Otherwise the other end is still alive |
|
88 |
||
89 |
wait_for_server ${host} |
|
90 |
||
91 |
test_service |
|
92 |
echo "### $(date) Preparing to reboot to VMIPAE kernel" |
|
93 |
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" |
|
94 |
ssh root@${host} "reboot" |
|
95 |
sleep 10 #Otherwise the other end is still alive |
|
96 |
||
97 |
wait_for_server ${host} |
|
98 |
echo "### $(date) Run ${host} test #3 : VMIPAE kernel" |
|
99 |
nohup ssh root@${host} "echo c > /proc/sysrq-trigger" > /dev/null 2>&1 & |
|
100 |
sleep 10 #Otherwise the other end is still alive |
|
101 |
||
102 |
wait_for_server ${host} |
|
103 |
||
104 |
test_service |
|
105 |
echo "### $(date) Preparing to reboot to VMI kernel" |
|
106 |
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" |
|
107 |
ssh root@${host} "reboot" |
|
108 |
sleep 10 #Otherwise the other end is still alive |
|
109 |
||
110 |
wait_for_server ${host} |
|
111 |
||
112 |
cleanup_last_vmcore |
|
113 |
||
114 |
echo "### $(date) Run ${host} test #4 : VMI kernel" |
|
115 |
nohup ssh root@${host} "echo c > /proc/sysrq-trigger" > /dev/null 2>&1 & |
|
116 |
sleep 10 #Otherwise the other end is still alive |
|
117 |
||
118 |
wait_for_server ${host} |
|
119 |
||
120 |
test_service |
|
121 |
echo "### $(date) Preparing to reboot to XENPAE kernel" |
|
122 |
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" |
|
123 |
ssh root@${host} "reboot" |
|
124 |
sleep 10 #Otherwise the other end is still alive |
|
125 |
||
126 |
wait_for_server ${host} |
|
127 |
||
128 |
cleanup_last_vmcore |
|
129 |
||
130 |
echo "### $(date) Run ${host} test #5 : XENPAE kernel" |
|
131 |
nohup ssh root@${host} "echo c > /proc/sysrq-trigger" > /dev/null 2>&1 & |
|
132 |
sleep 10 #Otherwise the other end is still alive |
|
133 |
||
134 |
wait_for_server ${host} |
|
135 |
||
136 |
test_service |
|
137 |
echo "### $(date) Preparing to reboot to XEN kernel" |
|
138 |
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" |
|
139 |
ssh root@${host} "reboot" |
|
140 |
sleep 10 #Otherwise the other end is still alive |
|
141 |
||
142 |
wait_for_server ${host} |
|
143 |
||
144 |
cleanup_last_vmcore |
|
145 |
||
146 |
echo "### $(date) Run ${host} test #6 : XEN kernel" |
|
147 |
nohup ssh root@${host} "echo c > /proc/sysrq-trigger" > /dev/null 2>&1 & |
|
148 |
sleep 10 #Otherwise the other end is still alive |
|
149 |
||
150 |
wait_for_server ${host} |
|
151 |
||
152 |
test_service |
|
153 |
echo "### $(date) Preparing to reboot to DEFAULT kernel" |
|
154 |
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" |
|
155 |
ssh root@${host} "reboot" |
|
156 |
sleep 10 #Otherwise the other end is still alive |
|
157 |
||
158 |
wait_for_server ${host} |
|
159 |
||
160 |
cleanup_last_vmcore |
|
161 |
||
162 |
echo "### $(date) Run ${host} test #7 : DEFAULT kernel" |
|
163 |
nohup ssh root@${host} "echo c > /proc/sysrq-trigger" > /dev/null 2>&1 & |
|
164 |
sleep 10 #Otherwise the other end is still alive |
|
165 |
||
166 |
wait_for_server ${host} |
|
167 |
||
168 |
test_service |
|
169 |
echo "### $(date) Finished running all tests" |
|
170 |
echo
|
|
171 |
echo "### $(date) Tests Results are :" |
|
172 |
ssh root@${host} "grep -e KERNEL: -e DUMPFILE -e \"mode in use\" /var/log/dump/2*/*txt" |
|
173 |
exit 0 |