diff options
author | Jiajun Xu <jiajun.xu@intel.com> | 2010-11-10 22:58:52 +0800 |
---|---|---|
committer | Saul Wold <sgw@linux.intel.com> | 2010-11-14 21:08:22 -0800 |
commit | d64c7ae88ca29def7dd2869acaa0e2ec047bd153 (patch) | |
tree | 21c2114e45481ef195b1c966a58612c5281a962b /scripts/qemuimage-tests/sanity | |
parent | 2078af333d704fd894a2dedbc19cef5775cdadbb (diff) | |
download | poky-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')
-rwxr-xr-x | scripts/qemuimage-tests/sanity/boot | 2 | ||||
-rwxr-xr-x | scripts/qemuimage-tests/sanity/dmesg | 2 | ||||
-rwxr-xr-x | scripts/qemuimage-tests/sanity/scp | 71 | ||||
-rwxr-xr-x | scripts/qemuimage-tests/sanity/shutdown | 70 | ||||
-rwxr-xr-x | scripts/qemuimage-tests/sanity/ssh | 2 |
5 files changed, 144 insertions, 3 deletions
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 | |||
14 | TIMEOUT=360 | ||
15 | RET=1 | ||
16 | SPID=0 | ||
17 | i=0 | ||
18 | |||
19 | # Start qemu and check its network | ||
20 | Test_Create_Qemu ${TIMEOUT} | ||
21 | |||
22 | # If qemu network is up, check ssh service in qemu | ||
23 | if [ $? -eq 0 ]; then | ||
24 | Test_Info "Begin to Test SSH Service in Qemu" | ||
25 | Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT} | ||
26 | RET=$? | ||
27 | else | ||
28 | RET=1 | ||
29 | fi | ||
30 | |||
31 | # Check if file can be copied from host into target | ||
32 | # For qemu target, the file is 5M | ||
33 | if [ $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 | ||
59 | fi | ||
60 | |||
61 | if [ ${RET} -eq 0 ]; then | ||
62 | Test_Info "SCP Test PASS" | ||
63 | Test_Kill_Qemu | ||
64 | Test_Print_Result "SCP" 0 | ||
65 | exit 0 | ||
66 | else | ||
67 | Test_Info "SCP Test FAIL" | ||
68 | Test_Kill_Qemu | ||
69 | Test_Print_Result "SCP" 1 | ||
70 | exit 1 | ||
71 | fi | ||
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 | |||
16 | TIMEOUT=360 | ||
17 | RET=1 | ||
18 | i=0 | ||
19 | |||
20 | # Start qemu and check its network | ||
21 | Test_Create_Qemu ${TIMEOUT} | ||
22 | |||
23 | # If qemu network is up, check ssh service in qemu | ||
24 | if [ $? -eq 0 ]; then | ||
25 | Test_Info "Begin to Test SSH Service in Qemu" | ||
26 | Test_SSH_UP ${TARGET_IPADDR} ${TIMEOUT} | ||
27 | RET=$? | ||
28 | else | ||
29 | RET=1 | ||
30 | fi | ||
31 | |||
32 | # Check if target can shutdown | ||
33 | if [ $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 | ||
59 | fi | ||
60 | |||
61 | if [ ${RET} -eq 0 ]; then | ||
62 | Test_Info "Shutdown Test PASS" | ||
63 | Test_Print_Result "shutdown" 0 | ||
64 | exit 0 | ||
65 | else | ||
66 | Test_Info "Shutdown Test FAIL" | ||
67 | Test_Kill_Qemu | ||
68 | Test_Print_Result "shutdown" 1 | ||
69 | exit 1 | ||
70 | fi | ||
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> |