diff options
Diffstat (limited to 'scripts/qemuimage-tests/sanity/shutdown')
-rwxr-xr-x | scripts/qemuimage-tests/sanity/shutdown | 76 |
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 | |||
16 | TIMEOUT=400 | ||
17 | |||
18 | RET=1 | ||
19 | i=0 | ||
20 | |||
21 | # Start qemu and check its network | ||
22 | Test_Create_Qemu ${TIMEOUT} | ||
23 | |||
24 | # If qemu network is up, check ssh service in qemu | ||
25 | if [ $? -eq 0 ]; then | ||
26 | Test_Info "Begin to Test SSH Service in Qemu" | ||
27 | Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT} | ||
28 | RET=$? | ||
29 | else | ||
30 | RET=1 | ||
31 | fi | ||
32 | |||
33 | # Check if target can shutdown | ||
34 | if [ $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 | ||
60 | fi | ||
61 | |||
62 | if [ ${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 | ||
71 | else | ||
72 | Test_Info "Shutdown Test FAIL" | ||
73 | Test_Kill_Qemu | ||
74 | Test_Print_Result "shutdown" 1 | ||
75 | exit 1 | ||
76 | fi | ||