#!/bin/sh
set -eu

ROOT=$(CDPATH='' cd -- "$(dirname -- "$0")/.." && pwd)
matrix=${WNH_ANDROID_TEST_API_MATRIX:-"24 30 34 37.0"}

for api in $matrix; do
  case "$api" in
    24|30|34|37.0) ;;
    *)
      echo "WNH_ANDROID_TEST_API_MATRIX contains unsupported API: $api" >&2
      exit 1
      ;;
  esac

  echo "Running Android device suite on API $api."
  WNH_ANDROID_TEST_API=$api "$ROOT/scripts/android-instrumentation-test.sh"
done

echo "Android device matrix passed: $matrix"
