diff options
Diffstat (limited to 'scripts/qemuimage-tests')
| -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" |
