diff options
| author | Daniel Manrique <roadmr@ubuntu.com> | 2014-06-06 12:05:34 -0400 |
|---|---|---|
| committer | Daniel Manrique <roadmr@ubuntu.com> | 2014-06-06 12:05:34 -0400 |
| commit | c50d971c1e6b7ff804f1b8e7d6f7a371893578aa (patch) | |
| tree | 1bfcf94e4ccce07f475533a8f8154a76b5e14e2a /jobs | |
| parent | 8435bd2adaa2b551b7e0cf78646afa4caeb15131 (diff) | |
providers:checkbox: use existing WWAN connection for tests.
Previously, it was mandatory to set environment variables for WWAN testing, so the script could automatically create the modem connection and activate it. Unfortunately the best way to discover those settings is to create a connection manually and then copy them from there. This is OK for bulk testing, but for testing a single system, it creates duplication of work. These changes will skip the automatic connection creation and destruction if a wwan connection already exists, so users can configure their connection manually and leverage that for testing. - If the environment variables are set, drop any existing connections, create the test connection before testing, then destroy it after testing. - If environment variables are not set and an active connection is found, test using that one. - If environment are not set and there is no active connection, fail the test.
Diffstat (limited to 'jobs')
| -rw-r--r-- | jobs/mobilebroadband.txt.in | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/jobs/mobilebroadband.txt.in b/jobs/mobilebroadband.txt.in index 1bd2f4b..eab4e4c 100644 --- a/jobs/mobilebroadband.txt.in +++ b/jobs/mobilebroadband.txt.in @@ -8,18 +8,20 @@ requires: 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 \ - `[ -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 + if [ -n "${GSM_APN}" ]; then + 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 + fi 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 + if [ -n "${GSM_APN}" ] && [ "`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 @@ -35,17 +37,19 @@ requires: user: root environ: CDMA_CONN_NAME CDMA_USERNAME CDMA_PASSWORD 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 + if [ -n "${CDMA_USERNAME}" ]; then + 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 + fi 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 + if [ -n "${CDMA_USERNAME}" ] && [ "`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 |
