--- /dev/null
+#!/bin/bash
+
+# Don't run this script
+[[ "${BASH_SOURCE[0]}" == "${0}" ]] && echo "Please don't execute ${BASH_SOURCE[0]}, source it" && return
+
+# Global variable
+# CURRENT_PATH: infra/scripts directory absolute path
+# ROOT_PATH: nnfw root directory absolute path
+
+# Functions
+#
+# CheckTestPrepared
+# Check environment variable setting to run test
+#
+# TFLiteModelVerification $1 $2 $3
+# Run ./tests/scripts/test_driver.sh script verification test
+#
+# Unittests $1 $2 $3
+# Run ./tests/scripts/test_driver.sh script unittest
+
+CURRENT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+ROOT_PATH="$(cd ${CURRENT_PATH}/../../ && pwd)"
+
+# $1: (required) backend
+# $2: (required) related framework test list file path from nnfw root directory
+# pass empty string if there is no test list
+# $3: (required) related report path from nnfw root directory
+function CheckTestPrepared()
+{
+ # Model download server setting
+ if [[ -z "${MODELFILE_SERVER}" ]]; then
+ echo "[WARNING] Model file server is not set"
+ echo " Try to use pre-downloaed model"
+ else
+ echo "Model Server: ${MODELFILE_SERVER}"
+ fi
+}
+
+# $1: (required) backend
+# $2: (required) related framework skiplist file path from nnfw root directory
+# pass empty string if there is no skiplist
+# $3: (required) related report path from nnfw root directory
+function TFLiteModelVerification()
+{
+ [[ $# -ne 3 ]] && echo "Invalid function argument setting" && exit 1
+
+ pushd ${ROOT_PATH} > /dev/null
+
+ export BACKENDS=$1
+ if [[ "$2" == "" ]]; then
+ ./tests/scripts/test_driver.sh \
+ --reportdir=$ROOT_PATH/$3 \
+ --verification \
+ .
+ else
+ ./tests/scripts/test_driver.sh \
+ --frameworktest_list_file=$2 \
+ --reportdir=$ROOT_PATH/$3 \
+ --verification \
+ .
+ fi
+ unset BACKENDS
+
+ popd > /dev/null
+}
+
+function Unittests()
+{
+ [[ $# -ne 3 ]] && echo "Invalid function argument setting" && exit 1
+
+ pushd ${ROOT_PATH} > /dev/null
+
+ # Backup original nnapi_gtest.skip
+ # TODO Pass skiplist to test_driver.sh
+ SKIPLIST_FILE="${ROOT_PATH}/Product/out/unittest/nnapi_gtest.skip"
+ BACKUP_FILE="${SKIPLIST_FILE}.backup"
+ if [[ "$2" != "" ]]; then
+ cp ${SKIPLIST_FILE} ${BACKUP_FILE}
+ cp ${ROOT_PATH}/$2 ${SKIPLIST_FILE}
+ fi
+
+ export BACKENDS=$1
+ ./tests/scripts/test_driver.sh \
+ --reportdir=$ROOT_PATH/$3 \
+ --unittest \
+ .
+ unset BACKENDS
+
+ # TODO Pass skiplist to test_driver.sh
+ # Restore original nnapi_gtest.skip
+ if [[ "$2" != "" ]]; then
+ cp ${BACKUP_FILE} ${SKIPLIST_FILE}
+ rm ${BACKUP_FILE}
+ fi
+
+ popd > /dev/null
+}
#!/bin/bash
-[[ "${BASH_SOURCE[0]}" != "${0}" ]] && echo "Please don't source ${BASH_SOURCE[0]}, execute it" && return
-
-CURRENT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-ROOT_PATH="$CURRENT_PATH/../../"
-
-# Model download server setting
-if [[ -z $MODELFILE_SERVER ]]; then
- echo "Need model file server setting"
- exit 1
-fi
-
-set -e
-
-pushd $ROOT_PATH > /dev/null
+set -eo pipefail
+source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
export DISABLE_COMPILE=1
-
-cp -v ./Product/out/unittest/nnapi_gtest.skip.noarch.interp ./Product/out/unittest/nnapi_gtest.skip
-./tests/scripts/test_driver.sh \
- --unittest \
- --reportdir="$ROOT_PATH/report/interp" .
-
-popd > /dev/null
+CheckTestPrepared
+Unittests "cpu" "Product/out/unittest/nnapi_gtest.skip.noarch.interp" "report/interp"
+unset DISABLE_COMPILE
#!/bin/bash
-[[ "${BASH_SOURCE[0]}" != "${0}" ]] && echo "Please don't source ${BASH_SOURCE[0]}, execute it" && return
+set -eo pipefail
+source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
-CURRENT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-ROOT_PATH="$CURRENT_PATH/../../"
+pushd ${ROOT_PATH} > /dev/null
-# Model download server setting
-if [[ -z $MODELFILE_SERVER ]]; then
- echo "Need model file server setting"
- exit 1
-fi
-
-set -e
-
-pushd $ROOT_PATH > /dev/null
-
-export BACKENDS=cpu
-./tests/scripts/test_driver.sh \
- --frameworktest_list_file=./tests/scripts/neurun_frameworktest_list.x86-64.cpu.txt \
- --reportdir=$ROOT_PATH/report/ .
+CheckTestPrepared
+Unittests "cpu" "Product/out/unittest/nnapi_gtest.skip.x86_64-linux" "report"
+TFLiteModelVerification "cpu" "tests/scripts/neurun_frameworktest_list.x86-64.cpu.txt" "report"
popd > /dev/null