summaryrefslogtreecommitdiff
diff options
authorDaniel Manrique <roadmr@ubuntu.com>2014-04-11 10:05:46 -0400
committerDaniel Manrique <>2014-04-11 10:05:46 -0400
commit9e3a053e941f90a10d8557f8e0e2374c6905858d (patch)
tree23dda74ea5e35338abd5bd979a73af49dfa66618
parent5879801d827ef83108a34887cc4eb4613366dbb6 (diff)
parentfcf6a19ff1d0c813c79383ba2d3bc753ba038706 (diff)
"A revamp of the mobile-broadband test commands.
- Fixed use of bad interface name in curl. - Fixed not using curl's return code as the global exit status (caused the first problem to be hidden behind a failpass). - Assorted logic fixes - Converted commands to multi-line scripts for better readability. [r=zkrynicki][bug=1301620][author=roadmr]"
-rw-r--r--jobs/mobilebroadband.txt.in33
1 files changed, 31 insertions, 2 deletions
diff --git a/jobs/mobilebroadband.txt.in b/jobs/mobilebroadband.txt.in
index 289625e..a83b858 100644
--- a/jobs/mobilebroadband.txt.in
+++ b/jobs/mobilebroadband.txt.in
@@ -7,7 +7,22 @@ requires:
mobilebroadband.gsm == 'supported'
user: root
environ: GSM_CONN_NAME GSM_APN GSM_USERNAME GSM_PASSWORD
-command: trap "nmcli con delete id $GSM_CONN_NAME" EXIT; create_connection mobilebroadband gsm `if [ ${GSM_APN} ]; then echo "--apn=$GSM_APN"; fi` `if [ ${GSM_CONN_NAME} ]; then echo "--name=$GSM_CONN_NAME"; fi` `if [ ${GSM_USERNAME} ]; then echo "--username=$GSM_USERNAME"; fi` `if [ ${GSM_PASSWORD} ]; then echo "--password=$GSM_PASSWORD"; fi` && curl http://start.ubuntu.com/connectivity-check.html --interface `nmcli dev status | awk '/gsm/ {print $1}'`; if [ "`nmcli dev status | awk '/gsm/ {print $3}'`" == "connected" ]; then nmcli con down id `[ ${GSM_CONN_NAME} ] && echo "$GSM_CONN_NAME" || echo "MobileBB"`; fi
+command:
+ trap "nmcli con delete id $GSM_CONN_NAME" EXIT
+ create_connection mobilebroadband gsm \
+ `[ -n "${GSM_APN}" ] && echo "--apn=$GSM_APN"` \
+ `[ -n "${GSM_CONN_NAME}" ] && echo "--name=$GSM_CONN_NAME"` \
+ `[ -n "${GSM_USERNAME}" ] && echo "--username=$GSM_USERNAME"` \
+ `[ -n "${GSM_PASSWORD}" ] && echo "--password=$GSM_PASSWORD"` || exit 1
+ INTERFACE=`nmcli -t -f GENERAL -m tabular dev list |grep gsm |cut -d ":" -f 13`
+ echo "connected GSM interface seems to be $INTERFACE"
+ [ -z $INTERFACE ] && exit 1
+ curl http://start.ubuntu.com/connectivity-check.html --interface $INTERFACE
+ EXIT_CODE=$?
+ if [ "`nmcli dev status | awk '/gsm/ {print $3}'`" == "connected" ]; then
+ nmcli con down id `[ ${GSM_CONN_NAME} ] && echo "$GSM_CONN_NAME" || echo "MobileBB"`
+ fi
+ exit $EXIT_CODE
_description: Creates a mobile broadband connection for a GSM based modem and checks the connection to ensure it's working.
plugin: shell
@@ -19,5 +34,19 @@ requires:
mobilebroadband.cdma == 'supported'
user: root
environ: CDMA_CONN_NAME CDMA_USERNAME CDMA_PASSWORD
-command: trap "nmcli con delete id $CDMA_CONN_NAME" EXIT; create_connection mobilebroadband cdma `if [ ${CDMA_CONN_NAME} ]; then echo "--name=$CDMA_CONN_NAME"; fi` `if [ ${CDMA_USERNAME} ]; then echo "--username=$CDMA_USERNAME"; fi` `if [ ${CDMA_PASSWORD} ]; then echo "--password=$CDMA_PASSWORD"; fi` && curl http://start.ubuntu.com/connectivity-check.html --interface `nmcli dev status | awk '/gsm/ {print $1}'`; if [ "`nmcli dev status | awk '/gsm/ {print $3}'`" == "connected" ]; then nmcli con down id `[ ${CDMA_CONN_NAME} ] && echo "$CDMA_CONN_NAME" || echo "MobileBB"`; fi
+command:
+ trap "nmcli con delete id $CDMA_CONN_NAME" EXIT
+ create_connection mobilebroadband cdma \
+ `[ -n "${CDMA_CONN_NAME}" ] && echo "--name=$CDMA_CONN_NAME"` \
+ `[ -n "${CDMA_USERNAME}" ] && echo "--username=$CDMA_USERNAME"` \
+ `[ -n "${CDMA_PASSWORD}" ] && echo "--password=$CDMA_PASSWORD"` || exit 1
+ INTERFACE=`nmcli -t -f GENERAL -m tabular dev list |grep cdma |cut -d ":" -f 13`
+ echo "connected CDMA interface seems to be $INTERFACE"
+ [ -z $INTERFACE ] && exit 1
+ curl http://start.ubuntu.com/connectivity-check.html --interface $INTERFACE
+ EXIT_CODE=$?
+ if [ "`nmcli dev status | awk '/cdma/ {print $3}'`" == "connected" ]; then
+ nmcli con down id `[ ${CDMA_CONN_NAME} ] && echo "$CDMA_CONN_NAME" || echo "MobileBB"`
+ fi
+ exit $EXIT_CODE
_description: Creates a mobile broadband connection for a CDMA based modem and checks the connection to ensure it's working.