[poky] Another sanity test tweak
Xu, Jiajun
jiajun.xu at intel.com
Thu Dec 23 07:19:42 PST 2010
> Hi Jiajun,
>
> Along with bugs 611 and 612, I also noticed messages in the qemu logs
> about the qemu process being present when it very clearly wasn't.
> These are due to
> Test_Check_Qemu_UP() not functioning correctly.
>
> Looking at the output of ps -ef when running the script, I see things
> like:
>
> richard 6582 1845 0 11:32 pts/8 00:00:00 /bin/sh
> /rphome/poky/scripts/bitbake poky-image-sato -c qemuimagetest_standalone
> richard 6588 6582 72 11:32 pts/8 00:00:15 python
> /rphome/poky/bitbake/bin//bitbake poky-image-sato -c
> qemuimagetest_standalone richard 6598 6588 0 11:32 pts/8 00:00:00
> python /rphome/poky/bitbake/bin//bitbake poky-image-sato -c
> qemuimagetest_standalone richard 6601 6598 0 11:32 pts/8 00:00:00
> sh -c /rphome/poky/scripts/qemuimage-tests/sanity/boot | tee -a
> /media/data1/builds/poky2/tmp/log/qemuimagetests/sanity/log_boot.20101 2
> 23113226 richard 6602 6601 0 11:32 pts/8 00:00:00 /bin/bash
> /rphome/poky/scripts/qemuimage-tests/sanity/boot richard 6603 6601 0
> 11:32 pts/8 00:00:00 tee -a
> /media/data1/builds/poky2/tmp/log/qemuimagetests/sanity/log_boot.20101 2
> 23113226
>
> which is why it thinks qemu is running. I'd like to propose something
> like:
>
> diff --git a/scripts/qemuimage-testlib b/scripts/qemuimage-testlib index
> c2c394d..2b18683 100644 --- a/scripts/qemuimage-testlib +++
> b/scripts/qemuimage-testlib @@ -204,7 +204,7 @@ Test_Kill_Qemu()
> # function to check if there is any qemu process Test_Check_Qemu_UP() {
> - local count=`ps -ef | grep -c qemu`
> + local count=`ps -eo command | cut -d " " -f 1 | grep -c
> + \(^qemu\|.*/qemu\)`
> if [ ${count} -lt 2 ]; then
> Test_Info "There is no Qemu process"
> return 1
> which should ensure a qemu command is running rather than any command
> which happens to have "qemu" in its path. I'm still testing the above
> to see if it works well.
>
I tested above code and it works correctly on my machine. One thing needs modification is the count value we check.
diff --git a/scripts/qemuimage-testlib b/scripts/qemuimage-testlib
index 608c6f0..684929a 100644
--- a/scripts/qemuimage-testlib
+++ b/scripts/qemuimage-testlib
@@ -204,12 +204,12 @@ Test_Kill_Qemu()
# function to check if there is any qemu process
Test_Check_Qemu_UP()
{
- local count=`ps -ef | grep -c qemu`
- if [ ${count} -lt 2 ]; then
+ local count=`ps -eo command | cut -d" " -f 1 | grep -c '\(^qemu\|.*/qemu\)'`
+ if [ ${count} -ne 1 ]; then
Test_Info "There is no Qemu process"
return 1
else
- Test_Info "There is at least Qemu process running"
+ Test_Info "There is at least one Qemu process running"
return 0
fi
}
> Also, waiting 120 seconds for the qemu network to be up is fine. For
> the actual process to be running I'd suggest we just wait 10 seconds
> maximum as if it ever takes longer than that, we have a problem. I'd propose the following change:
>
> @@ -383,9 +383,7 @@ Test_Create_Qemu()
> # Get the pid of the xterm processor, which will be used in
> Test_Kill_Qemu PID=$!
> - sleep 5
> -
> - while [ ${up_time} -lt ${timeout} ]
> + while [ ${up_time} -lt 10 ]
> do
> Test_Check_Qemu_UP
> if [ $? -ne 0 ]; then
> Are you ok with these changes?
>
Agree. We don’t' need to wait such a long time for qemu up.
> Cheers,
>
> Richard
>
Best Regards,
Jiajun
More information about the poky
mailing list