summaryrefslogtreecommitdiff
path: root/infra/scripts/test_ubuntu_runtime.sh
blob: d4190bd8026eb0dfa9cfdd10327e51363338bf3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash

set -eo pipefail
source "$(dirname "${BASH_SOURCE[0]}")/common.sh"

BACKEND="cpu"
TEST_ARCH=$(uname -m | tr '[:upper:]' '[:lower:]')
TEST_OS="linux"
TFLITE_LOADER="0"
LINEAR_ONLY="0"

function Usage()
{
  echo "Usage: $0 $(basename ${BASH_SOURCE[0]}) [OPTIONS]"
  echo ""
  echo "Options:"
  echo "      --backend <BACKEND>     Runtime backend to test (default: ${BACKEND})"
  echo "      --tflite-loader         Enable TFLite Loader test"
  echo "      --linear-only           Use Linear executor only"
}

while [[ $# -gt 0 ]]
do
  arg="$1"
  case $arg in
    -h|--help|help)
      Usage
      exit 0
      ;;
    --backend)
      BACKEND=$(echo $2 | tr '[:upper:]' '[:lower:]')
      shift 2
      ;;
    --backend=*)
      BACKEND=$(echo ${1#*=} | tr '[:upper:]' '[:lower:]')
      shift
      ;;
    --tflite-loader)
      TFLITE_LOADER="1"
      shift
      ;;
    --linear-only)
      LINEAR_ONLY="1"
      shift
      ;;
    *)
      # Ignore
      shift
      ;;
  esac
done

CheckTestPrepared
echo "[[ ${TEST_ARCH}-${TEST_OS}: ${BACKEND} backend test ]]"
UNITTEST_SKIPLIST="Product/out/unittest/nnapi_gtest.skip.${TEST_ARCH}-${TEST_OS}.${BACKEND}"
FRAMEWORK_TESTLIST="tests/scripts/list/frameworktest_list.${TEST_ARCH}.${BACKEND}.txt"
REPORT_BASE="report/${BACKEND}"
EXECUTORS=("Linear" "Dataflow" "Parallel")
if [ $LINEAR_ONLY = "1" ]; then
  EXECUTORS=("Linear")
fi

for EXECUTOR in "${EXECUTORS[@]}";
do
  echo "[EXECUTOR]: ${EXECUTOR}"
  export EXECUTOR="${EXECUTOR}"
  Unittests "${BACKEND}" "${UNITTEST_SKIPLIST}" "${REPORT_BASE}/${EXECUTOR}"
  TFLiteModelVerification "${BACKEND}" "${FRAMEWORK_TESTLIST}" "${REPORT_BASE}/${EXECUTOR}"
  unset EXECUTOR
done

if [[ $TFLITE_LOADER = "1" ]]; then
  # Test tflite_loader
  pushd ${ROOT_PATH} > /dev/null
  ./tests/scripts/test-driver.sh \
    --frameworktest \
    --framework_driverbin="$ROOT_PATH/Product/out/bin/tflite_loader_test_tool" \
    --frameworktest_list_file=tests/scripts/list/tflite_loader_list.${TEST_ARCH}.txt \
    --reportdir="$ROOT_PATH/report/tfliteloader" .

  # Test custom op
  ./Product/out/tests/FillFrom_runner
  popd > /dev/null
fi