summaryrefslogtreecommitdiffstats
path: root/scripts/qemuimage-tests/sanity/scp
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/scp
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/scp')
-rwxr-xr-xscripts/qemuimage-tests/sanity/scp71
1 files changed, 71 insertions, 0 deletions
diff --git a/scripts/qemuimage-tests/sanity/scp b/scripts/qemuimage-tests/sanity/scp
new file mode 100755
index 0000000000..ce3489d664
--- /dev/null
+++ b/scripts/qemuimage-tests/sanity/scp
@@ -0,0 +1,71 @@
1#!/bin/bash
2# SCP Test Case for Sanity Test
3# The case boot up the Qemu target with `poky-qemu qemuxxx`.
4# Then check if file can be copied into target with scp command.
5#
6# Author: Jiajun Xu <jiajun.xu@intel.com>
7#
8# This file is licensed under the GNU General Public License,
9# Version 2.
10#
11
12. $POKYBASE/scripts/qemuimage-testlib
13
14TIMEOUT=360
15RET=1
16SPID=0
17i=0
18
19# Start qemu and check its network
20Test_Create_Qemu ${TIMEOUT}
21
22# If qemu network is up, check ssh service in qemu
23if [ $? -eq 0 ]; then
24 Test_Info "Begin to Test SSH Service in Qemu"
25 Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT}
26 RET=$?
27else
28 RET=1
29fi
30
31# Check if file can be copied from host into target
32# For qemu target, the file is 5M
33if [ $RET -eq 0 ]; then
34 echo $QEMUARCH | grep -q "qemu"
35
36 if [ $? -eq 0 ]; then
37 dd if=/dev/zero of=${TEST_TMP}/scp_test_file bs=512k count=10
38 Test_SCP ${TARGET_IPADDR} ${TEST_TMP}/scp_test_file /home/root &
39 SPID=$!
40 fi
41
42 # Check if scp finished or not
43 while [ $i -lt $TIMEOUT ]
44 do
45 ps -fp $SPID > /dev/null
46 if [ $? -ne 0 ]; then
47 RET=0
48 break
49 fi
50 i=$((i+5))
51 sleep 5
52 done
53
54 # Kill scp process if scp is not finished in time
55 if [ $i -ge $TIMEOUT ]; then
56 RET=1
57 kill $SPID
58 fi
59fi
60
61if [ ${RET} -eq 0 ]; then
62 Test_Info "SCP Test PASS"
63 Test_Kill_Qemu
64 Test_Print_Result "SCP" 0
65 exit 0
66else
67 Test_Info "SCP Test FAIL"
68 Test_Kill_Qemu
69 Test_Print_Result "SCP" 1
70 exit 1
71fi