diff options
author | Jiajun Xu <jiajun.xu@intel.com> | 2011-11-17 14:05:49 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-11-18 10:47:15 +0000 |
commit | c87a539aec000bdf13180f91a1c970ae9bd789c4 (patch) | |
tree | 50f7eeafaa88c4085389b7e8a3747d74160f46ef | |
parent | c2ce6387bd6e0a05a7e2b13741ccc20de96eaf49 (diff) | |
download | poky-c87a539aec000bdf13180f91a1c970ae9bd789c4.tar.gz |
sanitytest: use different option for command ps from busybox and procps
Current sanitytest use option -e for ps command, which only works for ps
from procps. It fails if ps is provided by busybox. Add check to use different
option for command from busybox and procps.
[YOCTO #1756]
(From OE-Core rev: dd856f5609c13fc740b53016de033a8a9cbe6b51)
Signed-off-by: Jiajun Xu <jiajun.xu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | scripts/qemuimage-tests/tools/connman_test.sh | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/scripts/qemuimage-tests/tools/connman_test.sh b/scripts/qemuimage-tests/tools/connman_test.sh index c4a66eebe3..8ed8b8b4aa 100644 --- a/scripts/qemuimage-tests/tools/connman_test.sh +++ b/scripts/qemuimage-tests/tools/connman_test.sh | |||
@@ -20,6 +20,16 @@ Target_Err() | |||
20 | echo -e "\tTARGET: ##### End #####" | 20 | echo -e "\tTARGET: ##### End #####" |
21 | } | 21 | } |
22 | 22 | ||
23 | # Check if ps comes from Procps or busybox first | ||
24 | ls -l `which ps` | grep -q "busybox" | ||
25 | RET=$? | ||
26 | |||
27 | if [ $RET -eq 0 ]; then | ||
28 | PS="ps" | ||
29 | else | ||
30 | PS="ps -ef" | ||
31 | fi | ||
32 | |||
23 | # Check if connmand is in target | 33 | # Check if connmand is in target |
24 | if [ ! -f /usr/sbin/connmand ]; then | 34 | if [ ! -f /usr/sbin/connmand ]; then |
25 | Target_Info "No connmand command found" | 35 | Target_Info "No connmand command found" |
@@ -27,21 +37,31 @@ if [ ! -f /usr/sbin/connmand ]; then | |||
27 | fi | 37 | fi |
28 | 38 | ||
29 | # Check if connmand is running in background | 39 | # Check if connmand is running in background |
30 | count=`ps -eo comm | cut -d " " -f 1 | grep -c connmand` | 40 | if [ $RET -eq 0 ]; then |
41 | count=`ps | awk '{print $5}' | grep -c connmand` | ||
42 | else | ||
43 | count=`ps -eo comm | cut -d " " -f 1 | grep -c connmand` | ||
44 | fi | ||
31 | 45 | ||
32 | if [ $count -ne 1 ]; then | 46 | if [ $count -ne 1 ]; then |
33 | Target_Info "connmand has issue when running in background, Pls, check the output of ps" | 47 | Target_Info "connmand has issue when running in background, Pls, check the output of ps" |
34 | ps -ef | grep connmand | 48 | ${PS} | grep connmand |
35 | exit 1 | 49 | exit 1 |
36 | fi | 50 | fi |
37 | 51 | ||
38 | # Check if there is always only one connmand running in background | 52 | # Check if there is always only one connmand running in background |
39 | if [ connmand > /dev/null 2>&1 ]; then | 53 | if [ connmand > /dev/null 2>&1 ]; then |
40 | Target_Info "connmand command run without problem" | 54 | Target_Info "connmand command run without problem" |
41 | count=`ps -eo comm | cut -d " " -f 1 | grep -c connmand` | 55 | |
56 | if [ $RET -eq 0 ]; then | ||
57 | count=`ps | awk '{print $5}' | grep -c connmand` | ||
58 | else | ||
59 | count=`ps -eo comm | cut -d " " -f 1 | grep -c connmand` | ||
60 | fi | ||
61 | |||
42 | if [ $count -ne 1 ]; then | 62 | if [ $count -ne 1 ]; then |
43 | Target_Info "There are more than one connmand running in background, Pls, check the output of ps" | 63 | Target_Info "There are more than one connmand running in background, Pls, check the output of ps" |
44 | ps -ef | grep connmand | 64 | ${PS} | grep connmand |
45 | exit 1 | 65 | exit 1 |
46 | else | 66 | else |
47 | Target_Info "There is always one connmand running in background, test pass" | 67 | Target_Info "There is always one connmand running in background, test pass" |