blob: edd21163ca81281c93321ccf9071f65f01260da9 (
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
#!/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
#
# NNPackageTest $1 $2
# Run ./tools/nnpackage_tool/nnpkg_test/nnpkg_test.sh script nnpackage test
CURRENT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_PATH="$(cd ${CURRENT_PATH}/../../ && pwd)"
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) framework list file relative path from nnfw root directory
# pass empty string if there is no skiplist
# $3: (required) relative path to report 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
}
# $1: (required) backend
# $2: (required) unittest skiplist file relative path from nnfw root directory
# pass empty string if there is no test list
# $3: (required) relative path for report from nnfw root directory
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
}
# $1: (require) backend
# $2: (require) list
function NNPackageTest()
{
[[ $# -ne 2 ]] && echo "Invalid function argument setting" && exit 1
pushd ${ROOT_PATH} > /dev/null
echo "[Package Test] Run $1 backend nnpackage test"
EXITCODE=0
PKG_LIST=$(cat $2)
for f in ${PKG_LIST}
do
for entry in "nnpkg-tcs"/$f; do
if [ -e $entry ]; then
BACKENDS="$1" tools/nnpackage_tool/nnpkg_test/nnpkg_test.sh -d -i nnpkg-tcs $(basename "$entry")
fi
done
EXITCODE_F=$?
if [ ${EXITCODE_F} -ne 0 ]; then
EXITCODE=${EXITCODE_F}
fi
done
if [ ${EXITCODE} -ne 0 ]; then
exit ${EXITCODE}
fi
popd > /dev/null
}
|