diff options
Diffstat (limited to 'scripts/qemuimage-testlib')
| -rwxr-xr-x | scripts/qemuimage-testlib | 52 |
1 files changed, 42 insertions, 10 deletions
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" |
