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

Commit a44a5648 authored by Scott James Remnant's avatar Scott James Remnant
Browse files

Add test filter option to run_unit_tests

e.g. ./run_unit_test.sh net_test_hci.HciLayerTest.*

Useful since this script wraps the hard part of pushing the binary
to the device and then shell to running it.

This also allows multiple individual tests to be run, since the filter
is per-target rather than global.

Change-Id: I74a6511ab226fb55054cbb840bb47815e0fdc97e
parent 5421c185
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ known_tests=(
)

usage() {
  echo "Usage: $0 [-s <specific device> ][--all|--help|<test names>]"
  echo "Usage: $0 [-s <specific device> ][--all|--help|<test name>[.<filter>] ...]"
  echo ""
  echo "Known test names:"

@@ -25,13 +25,17 @@ run_tests() {
  shift

  failed_tests=''
  for name in $*
  for spec in $*
  do
    name="${spec%%.*}"
    if [ "${name}" != "${spec}" ]; then
      filter="${spec#*.}"
    fi
    echo "--- $name ---"
    echo "pushing..."
    $adb push {$ANDROID_PRODUCT_OUT,}/data/nativetest/$name/$name
    echo "running..."
    $adb shell data/nativetest/$name/$name
    $adb shell data/nativetest/$name/$name${filter:+ "--gtest_filter=${filter}"}
    if [ $? != 0 ]; then
      failed_tests="$failed_tests$CR!!! FAILED TEST: $name !!!";
    fi