diff options
author | Yongqin Liu <yongqin.liu@linaro.org> | 2018-03-05 22:39:11 +0800 |
---|---|---|
committer | Yongqin Liu <yongqin.liu@linaro.org> | 2018-03-15 01:15:14 +0800 |
commit | 91d5a3b7a1702a20fa89425d373c417fc3e7444d (patch) | |
tree | 39be6fa750f93ba334f30c391004a69c41eb8b2e /automated/lib | |
parent | 3139ec3018bd07018e1958c9bc0f4c21f0027ab2 (diff) |
automated/android: add wifi join test action
which help to connect to WIFI in the lab
with the AP_SSID and AP_KEY defined in the job definition
Also move the wifi connection call for tradefed test tradefed.sh
after make sure the boot is complete
Change-Id: I0e87bab99e09e75ae9edf34574402062b6095abc
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
Diffstat (limited to 'automated/lib')
-rwxr-xr-x | automated/lib/android-test-lib | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/automated/lib/android-test-lib b/automated/lib/android-test-lib index a904411..1b7e4af 100755 --- a/automated/lib/android-test-lib +++ b/automated/lib/android-test-lib @@ -227,3 +227,28 @@ parse_common_args() { esac done } + +# Try to find the WIFI AP info and connect to it +# depends on WIFI AP information specified by lava job like following: +# secrets: +# AP_SSID: "${AP_SSID}" +# AP_KEY: "${AP_KEY}" +adb_join_wifi() { + AP_SSID=$1 + AP_KEY=$2 + if [ -z "${AP_SSID}" ] || [ -z "${AP_KEY}" ]; then + # Try to find the WIFI AP information specified by the job definition if not specified via command line + lava_test_dir="$(find /lava-* -maxdepth 0 -type d -regex '/lava-[0-9]+' 2>/dev/null | sort | tail -1)" + if test -f "${lava_test_dir}/secrets"; then + # shellcheck disable=SC1090 + . "${lava_test_dir}/secrets" + fi + fi + + # Try to connect to wifi if found the WIFI AP information + if [ ! -z "${AP_SSID}" ] && [ ! -z "${AP_KEY}" ]; then + wget http://testdata.validation.linaro.org/apks/wifi/wifi.apk + adb install wifi.apk + adb shell am start -n com.steinwurf.adbjoinwifi/.MainActivity -e ssid "${AP_SSID}" -e password_type WPA -e password "${AP_KEY}" + fi +} |