diff options
Diffstat (limited to 'scripts/qemuimage-testlib')
| -rwxr-xr-x | scripts/qemuimage-testlib | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/scripts/qemuimage-testlib b/scripts/qemuimage-testlib index 11768d001a..551011cbaf 100755 --- a/scripts/qemuimage-testlib +++ b/scripts/qemuimage-testlib | |||
| @@ -69,7 +69,7 @@ Test_Update_IPSAVE() | |||
| 69 | local pid=$1 | 69 | local pid=$1 |
| 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 -a "$pid" != "0" -a "$pid" != "" -a "$ip_addr" != "" -a "$ip_addr" != "" ]; then |
| 73 | echo "Saving $pid $ip_addr to $TARGET_IPSAVE" | 73 | echo "Saving $pid $ip_addr to $TARGET_IPSAVE" |
| 74 | echo "$pid $ip_addr" > $TARGET_IPSAVE | 74 | echo "$pid $ip_addr" > $TARGET_IPSAVE |
| 75 | fi | 75 | fi |
| @@ -234,15 +234,19 @@ Test_Kill_Qemu() | |||
| 234 | fi | 234 | fi |
| 235 | 235 | ||
| 236 | if [ $k -eq 1 ]; then | 236 | if [ $k -eq 1 ]; then |
| 237 | running=`ps -wwfp $QEMUPID` | 237 | if [ "$QEMUPID" != "0" -a "$QEMUPID" != "" ]; then |
| 238 | if [ $? -eq 0 ]; then | 238 | running=`ps -wwfp $QEMUPID` |
| 239 | echo "killing $QEMUPID" | 239 | if [ $? -eq 0 ]; then |
| 240 | kill $QEMUPID | 240 | echo "killing $QEMUPID" |
| 241 | kill $QEMUPID | ||
| 242 | fi | ||
| 241 | fi | 243 | fi |
| 242 | running=`ps -wwfp $XTERMPID` | 244 | if [ "$XTERMPID" != "0" -a "$XTERMPID" != "" ]; then |
| 243 | if [ $? -eq 0 ]; then | 245 | running=`ps -wwfp $XTERMPID` |
| 244 | echo "killing $XTERMPID" | 246 | if [ $? -eq 0 ]; then |
| 245 | kill $XTERMPID | 247 | echo "killing $XTERMPID" |
| 248 | kill $XTERMPID | ||
| 249 | fi | ||
| 246 | fi | 250 | fi |
| 247 | fi | 251 | fi |
| 248 | 252 | ||
| @@ -336,6 +340,11 @@ Test_Fetch_Target_IP() | |||
| 336 | local opid=$1 | 340 | local opid=$1 |
| 337 | local ip_addr=0 | 341 | local ip_addr=0 |
| 338 | 342 | ||
| 343 | if [ "$opid" = "0" -o "$opid" = "" ]; then | ||
| 344 | echo "" | ||
| 345 | return | ||
| 346 | fi | ||
| 347 | |||
| 339 | # Check if $1 pid exists and contains ipaddr of target | 348 | # Check if $1 pid exists and contains ipaddr of target |
| 340 | ip_addr=`ps -wwfp $opid | grep -o "192\.168\.7\.[0-9]*::" | awk -F":" '{print $1}'` | 349 | ip_addr=`ps -wwfp $opid | grep -o "192\.168\.7\.[0-9]*::" | awk -F":" '{print $1}'` |
| 341 | 350 | ||
| @@ -433,8 +442,10 @@ Test_Create_Qemu() | |||
| 433 | # Parse IP address of target from the qemu command line | 442 | # Parse IP address of target from the qemu command line |
| 434 | TARGET_IPADDR=`Test_Fetch_Target_IP $QEMUPID` | 443 | TARGET_IPADDR=`Test_Fetch_Target_IP $QEMUPID` |
| 435 | echo "Target IP is ${TARGET_IPADDR}" | 444 | echo "Target IP is ${TARGET_IPADDR}" |
| 436 | if [ -z ${TARGET_IPADDR} -o "${TARGET_IPADDR}" = "0" ]; then | 445 | if [ ${TARGET_IPADDR} = "" -o "${TARGET_IPADDR}" = "0" ]; then |
| 437 | Test_Info "There is no qemu process or qemu ip address found, return failed" | 446 | Test_Info "There is no qemu process or qemu ip address found, return failed" |
| 447 | ps -wwf | ||
| 448 | ps axww -O ppid | ||
| 438 | return 1 | 449 | return 1 |
| 439 | fi | 450 | fi |
| 440 | 451 | ||
