summaryrefslogtreecommitdiffstats
path: root/scripts
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
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')
-rw-r--r--scripts/qemuimage-testlib4
-rwxr-xr-xscripts/qemuimage-tests/sanity/boot2
-rwxr-xr-xscripts/qemuimage-tests/sanity/dmesg2
-rwxr-xr-xscripts/qemuimage-tests/sanity/scp71
-rwxr-xr-xscripts/qemuimage-tests/sanity/shutdown70
-rwxr-xr-xscripts/qemuimage-tests/sanity/ssh2
-rw-r--r--scripts/qemuimage-tests/scenario/qemuarm/poky-image-sato2
-rw-r--r--scripts/qemuimage-tests/scenario/qemuarm/poky-image-sdk2
-rw-r--r--scripts/qemuimage-tests/scenario/qemumips/poky-image-sato2
-rw-r--r--scripts/qemuimage-tests/scenario/qemumips/poky-image-sdk2
-rw-r--r--scripts/qemuimage-tests/scenario/qemuppc/poky-image-sato2
-rw-r--r--scripts/qemuimage-tests/scenario/qemuppc/poky-image-sdk2
-rw-r--r--scripts/qemuimage-tests/scenario/qemux86-64/poky-image-minimal1
-rw-r--r--scripts/qemuimage-tests/scenario/qemux86-64/poky-image-sato5
-rw-r--r--scripts/qemuimage-tests/scenario/qemux86-64/poky-image-sdk5
-rw-r--r--scripts/qemuimage-tests/scenario/qemux86/poky-image-sato2
-rw-r--r--scripts/qemuimage-tests/scenario/qemux86/poky-image-sdk2
17 files changed, 174 insertions, 4 deletions
diff --git a/scripts/qemuimage-testlib b/scripts/qemuimage-testlib
index 3ebf5ffd2a..c2c394d5ed 100644
--- a/scripts/qemuimage-testlib
+++ b/scripts/qemuimage-testlib
@@ -151,7 +151,8 @@ Test_Print_Result()
151 NORESULT=1 151 NORESULT=1
152 fi 152 fi
153 153
154 echo -e "\t$1\t\t$PASS\t$FAIL\t$NORESULT" >> $TEST_RESULT/testresult.log 154 # Format the output of the test result
155 echo -e "$1 $PASS $FAIL $NORESULT" | awk '{printf("\t"); for(i=1;i<=NF;i++) printf("%-15s",$i); printf("\n");}' >> $TEST_RESULT/testresult.log
155} 156}
156 157
157# Test_Kill_Qemu to kill child pid with parent pid given 158# Test_Kill_Qemu to kill child pid with parent pid given
@@ -399,6 +400,7 @@ Test_Create_Qemu()
399 400
400 # Parse IP address of target from the qemu command line 401 # Parse IP address of target from the qemu command line
401 if [ ${up_time} -lt ${timeout} ]; then 402 if [ ${up_time} -lt ${timeout} ]; then
403 sleep 5
402 TARGET_IPADDR=`Test_Fetch_Target_IP $PID` 404 TARGET_IPADDR=`Test_Fetch_Target_IP $PID`
403 fi 405 fi
404 406
diff --git a/scripts/qemuimage-tests/sanity/boot b/scripts/qemuimage-tests/sanity/boot
index 5014e8a5ac..b75b9b9285 100755
--- a/scripts/qemuimage-tests/sanity/boot
+++ b/scripts/qemuimage-tests/sanity/boot
@@ -1,7 +1,7 @@
1#!/bin/bash 1#!/bin/bash
2# 2#
3# Boot Test Case for Sanity Test 3# Boot Test Case for Sanity Test
4# The case boot up the Qemu target with `runqemu qemux86`. 4# The case boot up the Qemu target with `poky-qemu qemuxxx`.
5# Then check if qemu and qemu network is up. 5# Then check if qemu and qemu network is up.
6# 6#
7# Author: Jiajun Xu <jiajun.xu@intel.com> 7# Author: Jiajun Xu <jiajun.xu@intel.com>
diff --git a/scripts/qemuimage-tests/sanity/dmesg b/scripts/qemuimage-tests/sanity/dmesg
index c384659b6c..36813dcd43 100755
--- a/scripts/qemuimage-tests/sanity/dmesg
+++ b/scripts/qemuimage-tests/sanity/dmesg
@@ -1,6 +1,6 @@
1#!/bin/bash 1#!/bin/bash
2# Dmesg Check Test Case for Sanity Test 2# Dmesg Check Test Case for Sanity Test
3# The case boot up the Qemu target with `runqemu qemux86`. 3# The case boot up the Qemu target with `poky-qemu qemuxxx`.
4# Then check if there is any error log in dmesg. 4# Then check if there is any error log in dmesg.
5# 5#
6# Author: Jiajun Xu <jiajun.xu@intel.com> 6# Author: Jiajun Xu <jiajun.xu@intel.com>
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
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
diff --git a/scripts/qemuimage-tests/sanity/ssh b/scripts/qemuimage-tests/sanity/ssh
index f9143d0558..084530adfb 100755
--- a/scripts/qemuimage-tests/sanity/ssh
+++ b/scripts/qemuimage-tests/sanity/ssh
@@ -1,6 +1,6 @@
1#!/bin/bash 1#!/bin/bash
2# SSH Test Case for Sanity Test 2# SSH Test Case for Sanity Test
3# The case boot up the Qemu target with `runqemu qemux86`. 3# The case boot up the Qemu target with `poky-qemu qemuxxx`.
4# Then check if ssh service in qemu is up. 4# Then check if ssh service in qemu is up.
5# 5#
6# Author: Jiajun Xu <jiajun.xu@intel.com> 6# Author: Jiajun Xu <jiajun.xu@intel.com>
diff --git a/scripts/qemuimage-tests/scenario/qemuarm/poky-image-sato b/scripts/qemuimage-tests/scenario/qemuarm/poky-image-sato
index f6e7cb1604..b8e9847b48 100644
--- a/scripts/qemuimage-tests/scenario/qemuarm/poky-image-sato
+++ b/scripts/qemuimage-tests/scenario/qemuarm/poky-image-sato
@@ -1,3 +1,5 @@
1sanity boot 1sanity boot
2sanity ssh 2sanity ssh
3sanity scp
3sanity dmesg 4sanity dmesg
5sanity shutdown
diff --git a/scripts/qemuimage-tests/scenario/qemuarm/poky-image-sdk b/scripts/qemuimage-tests/scenario/qemuarm/poky-image-sdk
index f6e7cb1604..b8e9847b48 100644
--- a/scripts/qemuimage-tests/scenario/qemuarm/poky-image-sdk
+++ b/scripts/qemuimage-tests/scenario/qemuarm/poky-image-sdk
@@ -1,3 +1,5 @@
1sanity boot 1sanity boot
2sanity ssh 2sanity ssh
3sanity scp
3sanity dmesg 4sanity dmesg
5sanity shutdown
diff --git a/scripts/qemuimage-tests/scenario/qemumips/poky-image-sato b/scripts/qemuimage-tests/scenario/qemumips/poky-image-sato
index f6e7cb1604..b8e9847b48 100644
--- a/scripts/qemuimage-tests/scenario/qemumips/poky-image-sato
+++ b/scripts/qemuimage-tests/scenario/qemumips/poky-image-sato
@@ -1,3 +1,5 @@
1sanity boot 1sanity boot
2sanity ssh 2sanity ssh
3sanity scp
3sanity dmesg 4sanity dmesg
5sanity shutdown
diff --git a/scripts/qemuimage-tests/scenario/qemumips/poky-image-sdk b/scripts/qemuimage-tests/scenario/qemumips/poky-image-sdk
index f6e7cb1604..b8e9847b48 100644
--- a/scripts/qemuimage-tests/scenario/qemumips/poky-image-sdk
+++ b/scripts/qemuimage-tests/scenario/qemumips/poky-image-sdk
@@ -1,3 +1,5 @@
1sanity boot 1sanity boot
2sanity ssh 2sanity ssh
3sanity scp
3sanity dmesg 4sanity dmesg
5sanity shutdown
diff --git a/scripts/qemuimage-tests/scenario/qemuppc/poky-image-sato b/scripts/qemuimage-tests/scenario/qemuppc/poky-image-sato
index f6e7cb1604..b8e9847b48 100644
--- a/scripts/qemuimage-tests/scenario/qemuppc/poky-image-sato
+++ b/scripts/qemuimage-tests/scenario/qemuppc/poky-image-sato
@@ -1,3 +1,5 @@
1sanity boot 1sanity boot
2sanity ssh 2sanity ssh
3sanity scp
3sanity dmesg 4sanity dmesg
5sanity shutdown
diff --git a/scripts/qemuimage-tests/scenario/qemuppc/poky-image-sdk b/scripts/qemuimage-tests/scenario/qemuppc/poky-image-sdk
index f6e7cb1604..b8e9847b48 100644
--- a/scripts/qemuimage-tests/scenario/qemuppc/poky-image-sdk
+++ b/scripts/qemuimage-tests/scenario/qemuppc/poky-image-sdk
@@ -1,3 +1,5 @@
1sanity boot 1sanity boot
2sanity ssh 2sanity ssh
3sanity scp
3sanity dmesg 4sanity dmesg
5sanity shutdown
diff --git a/scripts/qemuimage-tests/scenario/qemux86-64/poky-image-minimal b/scripts/qemuimage-tests/scenario/qemux86-64/poky-image-minimal
new file mode 100644
index 0000000000..0fcc7bba84
--- /dev/null
+++ b/scripts/qemuimage-tests/scenario/qemux86-64/poky-image-minimal
@@ -0,0 +1 @@
sanity boot
diff --git a/scripts/qemuimage-tests/scenario/qemux86-64/poky-image-sato b/scripts/qemuimage-tests/scenario/qemux86-64/poky-image-sato
new file mode 100644
index 0000000000..b8e9847b48
--- /dev/null
+++ b/scripts/qemuimage-tests/scenario/qemux86-64/poky-image-sato
@@ -0,0 +1,5 @@
1sanity boot
2sanity ssh
3sanity scp
4sanity dmesg
5sanity shutdown
diff --git a/scripts/qemuimage-tests/scenario/qemux86-64/poky-image-sdk b/scripts/qemuimage-tests/scenario/qemux86-64/poky-image-sdk
new file mode 100644
index 0000000000..b8e9847b48
--- /dev/null
+++ b/scripts/qemuimage-tests/scenario/qemux86-64/poky-image-sdk
@@ -0,0 +1,5 @@
1sanity boot
2sanity ssh
3sanity scp
4sanity dmesg
5sanity shutdown
diff --git a/scripts/qemuimage-tests/scenario/qemux86/poky-image-sato b/scripts/qemuimage-tests/scenario/qemux86/poky-image-sato
index f6e7cb1604..b8e9847b48 100644
--- a/scripts/qemuimage-tests/scenario/qemux86/poky-image-sato
+++ b/scripts/qemuimage-tests/scenario/qemux86/poky-image-sato
@@ -1,3 +1,5 @@
1sanity boot 1sanity boot
2sanity ssh 2sanity ssh
3sanity scp
3sanity dmesg 4sanity dmesg
5sanity shutdown
diff --git a/scripts/qemuimage-tests/scenario/qemux86/poky-image-sdk b/scripts/qemuimage-tests/scenario/qemux86/poky-image-sdk
index f6e7cb1604..b8e9847b48 100644
--- a/scripts/qemuimage-tests/scenario/qemux86/poky-image-sdk
+++ b/scripts/qemuimage-tests/scenario/qemux86/poky-image-sdk
@@ -1,3 +1,5 @@
1sanity boot 1sanity boot
2sanity ssh 2sanity ssh
3sanity scp
3sanity dmesg 4sanity dmesg
5sanity shutdown