diff options
-rw-r--r-- | meta/classes/imagetest-qemu.bbclass | 2 | ||||
-rwxr-xr-x | scripts/qemuimage-testlib | 52 | ||||
-rwxr-xr-x | scripts/qemuimage-tests/toolchain/sudoku-savant | 2 |
3 files changed, 44 insertions, 12 deletions
diff --git a/meta/classes/imagetest-qemu.bbclass b/meta/classes/imagetest-qemu.bbclass index e259ae9baa..25304de5ef 100644 --- a/meta/classes/imagetest-qemu.bbclass +++ b/meta/classes/imagetest-qemu.bbclass | |||
@@ -33,7 +33,7 @@ def qemuimagetest_main(d): | |||
33 | Test Controller for automated testing. | 33 | Test Controller for automated testing. |
34 | """ | 34 | """ |
35 | 35 | ||
36 | casestr = re.compile(r'(?P<scen>\w+\b):(?P<case>\w+$)') | 36 | casestr = re.compile(r'(?P<scen>\w+\b):(?P<case>\S+$)') |
37 | resultstr = re.compile(r'\s*(?P<case>\w+)\s*(?P<pass>\d+)\s*(?P<fail>\d+)\s*(?P<noresult>\d+)') | 37 | resultstr = re.compile(r'\s*(?P<case>\w+)\s*(?P<pass>\d+)\s*(?P<fail>\d+)\s*(?P<noresult>\d+)') |
38 | machine = bb.data.getVar('MACHINE', d, 1) | 38 | machine = bb.data.getVar('MACHINE', d, 1) |
39 | pname = bb.data.getVar('PN', d, 1) | 39 | pname = bb.data.getVar('PN', d, 1) |
diff --git a/scripts/qemuimage-testlib b/scripts/qemuimage-testlib index c39fb7ae21..c2dbf6027f 100755 --- a/scripts/qemuimage-testlib +++ b/scripts/qemuimage-testlib | |||
@@ -32,14 +32,14 @@ PID=0 | |||
32 | TARGET_IPADDR=0 | 32 | TARGET_IPADDR=0 |
33 | 33 | ||
34 | # Global variable for test project version during toolchain test | 34 | # Global variable for test project version during toolchain test |
35 | # Version of cvs is 1.11.23 | 35 | # Version of cvs is 1.12.13 |
36 | # Version of iptables is 1.4.9 | 36 | # Version of iptables is 1.4.11 |
37 | # Version of sudoku-savant is 1.3 | 37 | # Version of sudoku-savant is 1.3 |
38 | PROJECT_PV=0 | 38 | PROJECT_PV=0 |
39 | 39 | ||
40 | # Global variable for test project download URL during toolchain test | 40 | # Global variable for test project download URL during toolchain test |
41 | # URL of cvs is http://ftp.gnu.org/non-gnu/cvs/source/stable/1.11.23/cvs-1.11.23.tar.bz2 | 41 | # URL of cvs is http://ftp.gnu.org/non-gnu/cvs/source/feature/1.12.13/cvs-1.12.13.tar.bz2 |
42 | # URL of iptables is http://netfilter.org/projects/iptables/files/iptables-1.4.9.tar.bz2 | 42 | # URL of iptables is http://netfilter.org/projects/iptables/files/iptables-1.4.11.tar.bz2 |
43 | # URL of sudoku-savant is http://downloads.sourceforge.net/project/sudoku-savant/sudoku-savant/sudoku-savant-1.3/sudoku-savant-1.3.tar.bz2 | 43 | # URL of sudoku-savant is http://downloads.sourceforge.net/project/sudoku-savant/sudoku-savant/sudoku-savant-1.3/sudoku-savant-1.3.tar.bz2 |
44 | PROJECT_DOWNLOAD_URL=0 | 44 | PROJECT_DOWNLOAD_URL=0 |
45 | 45 | ||
@@ -641,14 +641,46 @@ Test_Time_Out() | |||
641 | local date=0 | 641 | local date=0 |
642 | local tmp=`mktemp` | 642 | local tmp=`mktemp` |
643 | local ret=1 | 643 | local ret=1 |
644 | local pid=0 | ||
645 | local ppid=0 | ||
646 | local i=0 | ||
647 | declare local pid_l | ||
644 | 648 | ||
645 | # Run command in background | 649 | # Run command in background |
646 | ($command; echo $? > $tmp) & | 650 | ($command; echo $? > $tmp) & |
647 | while ps -e -o pid | grep -qw $!; do | 651 | pid=$! |
652 | while ps -e -o pid | grep -qw $pid; do | ||
648 | if [ $date -ge $timeout ]; then | 653 | if [ $date -ge $timeout ]; then |
649 | Test_Info "$timeout Timeout when running command $command" | 654 | Test_Info "$timeout Timeout when running command $command" |
650 | rm -rf $tmp | 655 | rm -rf $tmp |
651 | return 1 | 656 | |
657 | # Find all child processes of pid and kill them | ||
658 | ppid=$pid | ||
659 | ps -f --ppid $ppid | ||
660 | ret=$? | ||
661 | |||
662 | while [ $ret -eq 0 ] | ||
663 | do | ||
664 | # If yes, get the child pid and check if the child pid has other child pid | ||
665 | # Continue the while loop until there is no child pid found | ||
666 | pid_l[$i]=`ps -f --ppid $ppid | awk '{if ($2 != "PID") print $2}'` | ||
667 | ppid=${pid_l[$i]} | ||
668 | i=$((i+1)) | ||
669 | ps -f --ppid $ppid | ||
670 | ret=$? | ||
671 | done | ||
672 | |||
673 | # Kill these children pids from the last one | ||
674 | while [ $i -ne 0 ] | ||
675 | do | ||
676 | i=$((i-1)) | ||
677 | kill ${pid_l[$i]} | ||
678 | sleep 2 | ||
679 | done | ||
680 | |||
681 | # Kill the parent id | ||
682 | kill $pid | ||
683 | return 1 | ||
652 | fi | 684 | fi |
653 | sleep 5 | 685 | sleep 5 |
654 | date=`expr $date + 5` | 686 | date=`expr $date + 5` |
@@ -672,11 +704,11 @@ Test_Toolchain() | |||
672 | 704 | ||
673 | # Set value for PROJECT_PV and PROJECT_DOWNLOAD_URL accordingly | 705 | # Set value for PROJECT_PV and PROJECT_DOWNLOAD_URL accordingly |
674 | if [ $test_project == "cvs" ]; then | 706 | if [ $test_project == "cvs" ]; then |
675 | PROJECT_PV=1.11.23 | 707 | PROJECT_PV=1.12.13 |
676 | PROJECT_DOWNLOAD_URL="http://ftp.gnu.org/non-gnu/cvs/source/stable/1.11.23/cvs-1.11.23.tar.bz2" | 708 | PROJECT_DOWNLOAD_URL="http://ftp.gnu.org/non-gnu/cvs/source/feature/1.12.13/cvs-1.12.13.tar.bz2" |
677 | elif [ $test_project == "iptables" ]; then | 709 | elif [ $test_project == "iptables" ]; then |
678 | PROJECT_PV=1.4.9 | 710 | PROJECT_PV=1.4.11 |
679 | PROJECT_DOWNLOAD_URL="http://netfilter.org/projects/iptables/files/iptables-1.4.9.tar.bz2" | 711 | PROJECT_DOWNLOAD_URL="http://netfilter.org/projects/iptables/files/iptables-1.4.11.tar.bz2" |
680 | elif [ $test_project == "sudoku-savant" ]; then | 712 | elif [ $test_project == "sudoku-savant" ]; then |
681 | PROJECT_PV=1.3 | 713 | PROJECT_PV=1.3 |
682 | PROJECT_DOWNLOAD_URL="http://downloads.sourceforge.net/project/sudoku-savant/sudoku-savant/sudoku-savant-1.3/sudoku-savant-1.3.tar.bz2" | 714 | PROJECT_DOWNLOAD_URL="http://downloads.sourceforge.net/project/sudoku-savant/sudoku-savant/sudoku-savant-1.3/sudoku-savant-1.3.tar.bz2" |
diff --git a/scripts/qemuimage-tests/toolchain/sudoku-savant b/scripts/qemuimage-tests/toolchain/sudoku-savant index 603afe63ee..3d149dea27 100755 --- a/scripts/qemuimage-tests/toolchain/sudoku-savant +++ b/scripts/qemuimage-tests/toolchain/sudoku-savant | |||
@@ -11,7 +11,7 @@ | |||
11 | # | 11 | # |
12 | . $COREBASE/scripts/qemuimage-testlib | 12 | . $COREBASE/scripts/qemuimage-testlib |
13 | 13 | ||
14 | TIMEOUT=120 | 14 | TIMEOUT=240 |
15 | 15 | ||
16 | # Extract and test toolchain tarball | 16 | # Extract and test toolchain tarball |
17 | Test_Toolchain sudoku-savant ${TIMEOUT} | 17 | Test_Toolchain sudoku-savant ${TIMEOUT} |