summaryrefslogtreecommitdiffstats
path: root/scripts/qemuimage-tests/sanity/shutdown
diff options
context:
space:
mode:
authorJiajun Xu <jiajun.xu@intel.com>2010-11-10 22:58:52 +0800
committerSaul Wold <sgw@linux.intel.com>2010-11-14 21:08:22 -0800
commitd64c7ae88ca29def7dd2869acaa0e2ec047bd153 (patch)
tree21c2114e45481ef195b1c966a58612c5281a962b /scripts/qemuimage-tests/sanity/shutdown
parent2078af333d704fd894a2dedbc19cef5775cdadbb (diff)
downloadpoky-d64c7ae88ca29def7dd2869acaa0e2ec047bd153.tar.gz
imagetest-qemu: Add sanity test cases for scp/shutdown in target
scp test is to check if file copying via network work or not in target. shutdown test is to check if target can be poweroff with qemu process off. Signed-off-by Jiajun Xu <jiajun.xu@intel.com>
Diffstat (limited to 'scripts/qemuimage-tests/sanity/shutdown')
-rwxr-xr-xscripts/qemuimage-tests/sanity/shutdown70
1 files changed, 70 insertions, 0 deletions
diff --git a/scripts/qemuimage-tests/sanity/shutdown b/scripts/qemuimage-tests/sanity/shutdown
new file mode 100755
index 0000000000..e36b4a983d
--- /dev/null
+++ b/scripts/qemuimage-tests/sanity/shutdown
@@ -0,0 +1,70 @@
1#!/bin/bash
2# Shutdown Test Case for Sanity Test
3# The case boot up the Qemu target with `poky-qemu 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. $POKYBASE/scripts/qemuimage-testlib
15
16TIMEOUT=360
17RET=1
18i=0
19
20# Start qemu and check its network
21Test_Create_Qemu ${TIMEOUT}
22
23# If qemu network is up, check ssh service in qemu
24if [ $? -eq 0 ]; then
25 Test_Info "Begin to Test SSH Service in Qemu"
26 Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT}
27 RET=$?
28else
29 RET=1
30fi
31
32# Check if target can shutdown
33if [ $RET -eq 0 ]; then
34 echo $QEMUARCH | grep -q "qemux86"
35
36 # For qemux86/x86-64, command "poweroff" is used
37 # For non x86 qemu targets, command "reboot" is used because of BUG #100
38 if [ $? -eq 0 ]; then
39 Test_SSH ${TARGET_IPADDR} "/sbin/poweroff"
40 else
41 Test_SSH ${TARGET_IPADDR} "/sbin/reboot"
42 fi
43
44 # If qemu start up process ends up, it means shutdown completes
45 while [ $i -lt $TIMEOUT ]
46 do
47 ps -fp $PID > /dev/null
48 if [ $? -ne 0 ]; then
49 RET=0
50 break
51 fi
52 i=$((i+5))
53 sleep 5
54 done
55
56 if [ $i -ge $TIMEOUT ]; then
57 RET=1
58 fi
59fi
60
61if [ ${RET} -eq 0 ]; then
62 Test_Info "Shutdown Test PASS"
63 Test_Print_Result "shutdown" 0
64 exit 0
65else
66 Test_Info "Shutdown Test FAIL"
67 Test_Kill_Qemu
68 Test_Print_Result "shutdown" 1
69 exit 1
70fi