diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-03-19 20:54:33 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-03-19 20:58:11 +0000 |
commit | 8852e51bdcb55002e666ab9d4476d98599fdfc67 (patch) | |
tree | b318789f0ca4ed7606902766313aeb7f6746fb0c | |
parent | ee416ad6f4b0209f7ad7d54467e0d7d5e097dd2a (diff) | |
download | poky-8852e51bdcb55002e666ab9d4476d98599fdfc67.tar.gz |
scripts/qemutestlib: Add better process debugging and fix process group issue
In single testing with a shutdown scenario the processes are cleaned up correctly
but the manual cleanup fall back used for a minimal image do not work properly.
This patch fixes the kill commands to revert to non-process groups, fixing
the hung process issues that were occuring.
(From OE-Core rev: 6a0134fd4f1b64ef788be0791bd655dc7703d505)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-x | scripts/qemuimage-testlib | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/scripts/qemuimage-testlib b/scripts/qemuimage-testlib index 2c22bf2fa6..5d74a0a739 100755 --- a/scripts/qemuimage-testlib +++ b/scripts/qemuimage-testlib | |||
@@ -70,6 +70,7 @@ Test_Update_IPSAVE() | |||
70 | local ip_addr=$2 | 70 | local ip_addr=$2 |
71 | 71 | ||
72 | if [ "$TEST_SERIALIZE" -eq 1 ]; then | 72 | if [ "$TEST_SERIALIZE" -eq 1 ]; then |
73 | echo "Saving $pid $ip_addr to $TARGET_IPSAVE" | ||
73 | echo "$pid $ip_addr" > $TARGET_IPSAVE | 74 | echo "$pid $ip_addr" > $TARGET_IPSAVE |
74 | fi | 75 | fi |
75 | } | 76 | } |
@@ -215,6 +216,7 @@ Test_Kill_Qemu() | |||
215 | { | 216 | { |
216 | local index=0 | 217 | local index=0 |
217 | local total=0 | 218 | local total=0 |
219 | local k=0 | ||
218 | 220 | ||
219 | # When TEST_SERIALIZE is set, qemu process will not be | 221 | # When TEST_SERIALIZE is set, qemu process will not be |
220 | # killed until all the cases are finished | 222 | # killed until all the cases are finished |
@@ -222,15 +224,26 @@ Test_Kill_Qemu() | |||
222 | index=`sed -n 2p ${TEST_STATUS} | awk '{print $3}'` | 224 | index=`sed -n 2p ${TEST_STATUS} | awk '{print $3}'` |
223 | total=`sed -n 2p ${TEST_STATUS} | awk '{print $4}'` | 225 | total=`sed -n 2p ${TEST_STATUS} | awk '{print $4}'` |
224 | if [ ${index} != ${total} ]; then | 226 | if [ ${index} != ${total} ]; then |
225 | Test_Info "Do not kill the qemu process and use it for later testing" | 227 | Test_Info "Do not kill the qemu process and use it for later testing (step $index of $total)" |
226 | Test_Update_IPSAVE $XTERMPID $TARGET_IPADDR | 228 | Test_Update_IPSAVE $XTERMPID $TARGET_IPADDR |
227 | else | 229 | else |
228 | kill -$QEMUPID | 230 | k=1 |
229 | kill -$XTERMPID | ||
230 | fi | 231 | fi |
231 | else | 232 | else |
232 | kill -$QEMUPID | 233 | k=1 |
233 | kill -$XTERMPID | 234 | fi |
235 | |||
236 | if [ $k -eq 1 ]; then | ||
237 | running=`ps -wwfp $QEMUPID` | ||
238 | if [ $? -eq 0 ]; then | ||
239 | echo "killing $QEMUPID" | ||
240 | kill $QEMUPID | ||
241 | fi | ||
242 | running=`ps -wwfp $XTERMPID` | ||
243 | if [ $? -eq 0 ]; then | ||
244 | echo "killing $XTERMPID" | ||
245 | kill $XTERMPID | ||
246 | fi | ||
234 | fi | 247 | fi |
235 | 248 | ||
236 | return | 249 | return |
@@ -393,6 +406,7 @@ Test_Create_Qemu() | |||
393 | 406 | ||
394 | # Get the pid of the xterm processor, which will be used in Test_Kill_Qemu | 407 | # Get the pid of the xterm processor, which will be used in Test_Kill_Qemu |
395 | XTERMPID=$! | 408 | XTERMPID=$! |
409 | echo "XTERMPID is $XTERMPID" | ||
396 | fi | 410 | fi |
397 | 411 | ||
398 | while [ ${up_time} -lt 10 ] | 412 | while [ ${up_time} -lt 10 ] |
@@ -404,6 +418,7 @@ Test_Create_Qemu() | |||
404 | sleep 5 | 418 | sleep 5 |
405 | else | 419 | else |
406 | Test_Info "Begin to check if qemu network is up" | 420 | Test_Info "Begin to check if qemu network is up" |
421 | echo "QEMUPID is $QEMUPID" | ||
407 | break | 422 | break |
408 | fi | 423 | fi |
409 | done | 424 | done |