Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6871767a authored by Etan Cohen's avatar Etan Cohen Committed by Android (Google) Code Review
Browse files

Merge "[WIFI] Update instructions for running tests"

parents db592084 8d12d098
Loading
Loading
Loading
Loading
+1 −20
Original line number Diff line number Diff line
@@ -8,12 +8,9 @@ libraries.
The easiest way to run tests is simply run

```
frameworks/base/wifi/tests/runtests.sh
atest android.net.wifi
```

`runtests.sh` will build the test project and all of its dependencies and push the APK to the
connected device. It will then run the tests on the device.

To pick up changes in framework/base, you will need to:
1. rebuild the framework library 'make -j32'
2. sync over the updated library to the device 'adb sync'
@@ -24,22 +21,6 @@ To enable syncing data to the device for first time after clean reflash:
2. adb reboot
3. adb remount

See below for a few example of options to limit which tests are run.
See the
[AndroidJUnitRunner Documentation](https://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner.html)
for more details on the supported options.

```
runtests.sh -e package android.net.wifi
runtests.sh -e class android.net.wifi.WifiScannerTest
```

If you manually build and push the test APK to the device you can run tests using

```
adb shell am instrument -w 'android.net.wifi.test/androidx.test.runner.AndroidJUnitRunner'
```

## Adding Tests
Tests can be added by adding classes to the src directory. JUnit4 style test cases can
be written by simply annotating test methods with `org.junit.Test`.

wifi/tests/runtests.sh

deleted100755 → 0
+0 −25
Original line number Diff line number Diff line
#!/usr/bin/env bash

if [ -z $ANDROID_BUILD_TOP ]; then
  echo "You need to source and lunch before you can use this script"
  exit 1
fi

echo "Running tests"

set -e # fail early

echo "+ mmma -j32 $ANDROID_BUILD_TOP/frameworks/base/wifi/tests"
# NOTE Don't actually run the command above since this shell doesn't inherit functions from the
#      caller.
$ANDROID_BUILD_TOP/build/soong/soong_ui.bash --make-mode MODULES-IN-frameworks-base-wifi-tests

set -x # print commands

adb wait-for-device

TARGET_ARCH=$($ANDROID_BUILD_TOP/build/soong/soong_ui.bash --dumpvar-mode TARGET_ARCH)
adb install -r -g "$OUT/testcases/FrameworksWifiApiTests/$TARGET_ARCH/FrameworksWifiApiTests.apk"

adb shell am instrument --no-hidden-api-checks -w "$@" \
  'android.net.wifi.test/androidx.test.runner.AndroidJUnitRunner'