167b1811188b7a874bb851dddc3b3cd930a551773Mitchell Wills#!/usr/bin/env bash
267b1811188b7a874bb851dddc3b3cd930a551773Mitchell Wills
30db50e20ec8d91c5febed969f01cb4cb53ee2288mukesh agrawalif [[ "$1" == "--help" ]]; then
40db50e20ec8d91c5febed969f01cb4cb53ee2288mukesh agrawal  cat <<END
50db50e20ec8d91c5febed969f01cb4cb53ee2288mukesh agrawalUsage for $0
60db50e20ec8d91c5febed969f01cb4cb53ee2288mukesh agrawal
70db50e20ec8d91c5febed969f01cb4cb53ee2288mukesh agrawal	<no-args>			run all tests
80db50e20ec8d91c5febed969f01cb4cb53ee2288mukesh agrawal	-r				print raw results
90db50e20ec8d91c5febed969f01cb4cb53ee2288mukesh agrawal	-e class <class-name>		run all the tests in <class-name>
100db50e20ec8d91c5febed969f01cb4cb53ee2288mukesh agrawal	-e class <class-name>#<method>	run just the specified <method>
110db50e20ec8d91c5febed969f01cb4cb53ee2288mukesh agrawal
120db50e20ec8d91c5febed969f01cb4cb53ee2288mukesh agrawalExample:
130db50e20ec8d91c5febed969f01cb4cb53ee2288mukesh agrawal$ $0 -r -e class \\
140db50e20ec8d91c5febed969f01cb4cb53ee2288mukesh agrawal  com.android.server.wifi.WifiDiagnosticsTest#startLoggingRegistersLogEventHandler
150db50e20ec8d91c5febed969f01cb4cb53ee2288mukesh agrawalRun just the specified test, and show the raw output.
160db50e20ec8d91c5febed969f01cb4cb53ee2288mukesh agrawal
170db50e20ec8d91c5febed969f01cb4cb53ee2288mukesh agrawalFor more options, see https://goo.gl/JxYjIw
180db50e20ec8d91c5febed969f01cb4cb53ee2288mukesh agrawalEND
190db50e20ec8d91c5febed969f01cb4cb53ee2288mukesh agrawal  exit 0
200db50e20ec8d91c5febed969f01cb4cb53ee2288mukesh agrawalfi
210db50e20ec8d91c5febed969f01cb4cb53ee2288mukesh agrawal
2267b1811188b7a874bb851dddc3b3cd930a551773Mitchell Willsif [ -z $ANDROID_BUILD_TOP ]; then
2367b1811188b7a874bb851dddc3b3cd930a551773Mitchell Wills  echo "You need to source and lunch before you can use this script"
2467b1811188b7a874bb851dddc3b3cd930a551773Mitchell Wills  exit 1
2567b1811188b7a874bb851dddc3b3cd930a551773Mitchell Willsfi
2667b1811188b7a874bb851dddc3b3cd930a551773Mitchell Wills
2767b1811188b7a874bb851dddc3b3cd930a551773Mitchell Willsecho "Running tests"
2867b1811188b7a874bb851dddc3b3cd930a551773Mitchell Wills
2967b1811188b7a874bb851dddc3b3cd930a551773Mitchell Willsset -e # fail early
3067b1811188b7a874bb851dddc3b3cd930a551773Mitchell Wills
3167b1811188b7a874bb851dddc3b3cd930a551773Mitchell Willsecho "+ mmma -j32 $ANDROID_BUILD_TOP/frameworks/opt/net/wifi/tests"
3267b1811188b7a874bb851dddc3b3cd930a551773Mitchell Wills# NOTE Don't actually run the command above since this shell doesn't inherit functions from the
3367b1811188b7a874bb851dddc3b3cd930a551773Mitchell Wills#      caller.
3467b1811188b7a874bb851dddc3b3cd930a551773Mitchell Willsmake -j32 -C $ANDROID_BUILD_TOP -f build/core/main.mk MODULES-IN-frameworks-opt-net-wifi-tests
3567b1811188b7a874bb851dddc3b3cd930a551773Mitchell Wills
3667b1811188b7a874bb851dddc3b3cd930a551773Mitchell Willsset -x # print commands
3767b1811188b7a874bb851dddc3b3cd930a551773Mitchell Wills
3867b1811188b7a874bb851dddc3b3cd930a551773Mitchell Willsadb root
3967b1811188b7a874bb851dddc3b3cd930a551773Mitchell Willsadb wait-for-device
4067b1811188b7a874bb851dddc3b3cd930a551773Mitchell Wills
4167b1811188b7a874bb851dddc3b3cd930a551773Mitchell Willsadb install -r -g "$OUT/data/app/FrameworksWifiTests/FrameworksWifiTests.apk"
4267b1811188b7a874bb851dddc3b3cd930a551773Mitchell Wills
43da7d73da44a47933cfc99660c2d247c24fd72544mukesh agrawaladb shell am instrument -w "$@" \
44da7d73da44a47933cfc99660c2d247c24fd72544mukesh agrawal  -e notAnnotation com.android.server.wifi.DisabledForUpdateToAnyMatcher \
45da7d73da44a47933cfc99660c2d247c24fd72544mukesh agrawal  'com.android.server.wifi.test/android.support.test.runner.AndroidJUnitRunner'
46