1#!/usr/bin/env bash
2
3if [[ "$1" == "--help" ]]; then
4  cat <<END
5Usage for $0
6
7	<no-args>			run all tests
8	-r				print raw results
9	-e class <class>[#<test>]	run test/s specified by class
10
11Example:
12$ $0 -r -e class com.android.cuttlefish.ril.RilE2eTests#testRilConnects
13Run just the specified test, and show the raw output.
14END
15  exit 0
16fi
17
18if [ -z $ANDROID_BUILD_TOP ]; then
19  echo "You need to source and lunch before you can use this script"
20  exit 1
21fi
22
23set -e # fail early
24make -j32 -C $ANDROID_BUILD_TOP -f build/core/main.mk MODULES-IN-device-google-cuttlefish-tests-ril
25adb wait-for-device
26# Same as 'package' in manifest file
27adb uninstall com.android.cuttlefish.ril.tests || true
28adb install -r -g "$OUT/data/app/CuttlefishRilTests/CuttlefishRilTests.apk"
29# optionally: -e class com.android.cuttlefish.ril.RilE2eTests#testName
30adb shell am instrument -w "$@" 'com.android.cuttlefish.ril.tests/android.support.test.runner.AndroidJUnitRunner'
31