summaryrefslogtreecommitdiffstats
path: root/scripts/qemuimage-tests/sanity/shutdown
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/qemuimage-tests/sanity/shutdown')
-rwxr-xr-xscripts/qemuimage-tests/sanity/shutdown76
1 files changed, 0 insertions, 76 deletions
diff --git a/scripts/qemuimage-tests/sanity/shutdown b/scripts/qemuimage-tests/sanity/shutdown
deleted file mode 100755
index c9e931c4c2..0000000000
--- a/scripts/qemuimage-tests/sanity/shutdown
+++ /dev/null
@@ -1,76 +0,0 @@
1#!/bin/bash
2# Shutdown Test Case for Sanity Test
3# The case boot up the Qemu target with `runqemu qemuxxx`.
4# Then check if target can shutdown
5# For qemux86/x86-64, we use command "poweroff" for target shutdown
6# For non-x86 targets, we use command "reboot" for target shutdown
7#
8# Author: Jiajun Xu <jiajun.xu@intel.com>
9#
10# This file is licensed under the GNU General Public License,
11# Version 2.
12#
13
14. $COREBASE/scripts/qemuimage-testlib
15
16TIMEOUT=400
17
18RET=1
19i=0
20
21# Start qemu and check its network
22Test_Create_Qemu ${TIMEOUT}
23
24# If qemu network is up, check ssh service in qemu
25if [ $? -eq 0 ]; then
26 Test_Info "Begin to Test SSH Service in Qemu"
27 Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT}
28 RET=$?
29else
30 RET=1
31fi
32
33# Check if target can shutdown
34if [ $RET -eq 0 ]; then
35 echo $QEMUARCH | grep -q "qemux86"
36
37 # For qemux86/x86-64, command "poweroff" is used
38 # For non x86 qemu targets, command "reboot" is used because of BUG #100
39 if [ $? -eq 0 ]; then
40 Test_SSH ${TARGET_IPADDR} "/sbin/poweroff"
41 else
42 Test_SSH ${TARGET_IPADDR} "/sbin/reboot"
43 fi
44
45 # If qemu start up process ends up, it means shutdown completes
46 while [ $i -lt $TIMEOUT ]
47 do
48 ps -fp $QEMUPID > /dev/null 2> /dev/null
49 if [ $? -ne 0 ]; then
50 RET=0
51 break
52 fi
53 i=$((i+5))
54 sleep 5
55 done
56
57 if [ $i -ge $TIMEOUT ]; then
58 RET=1
59 fi
60fi
61
62if [ ${RET} -eq 0 ]; then
63 Test_Info "Shutdown Test PASS"
64 Test_Print_Result "shutdown" 0
65
66 # Remove TARGET_IPSAVE since no existing qemu running now
67 if [ -e ${TARGET_IPSAVE} ]; then
68 rm -rf ${TARGET_IPSAVE}
69 fi
70 exit 0
71else
72 Test_Info "Shutdown Test FAIL"
73 Test_Kill_Qemu
74 Test_Print_Result "shutdown" 1
75 exit 1
76fi