blob: 48863ff1249e355051c478b47d0903e3c7adfed2 (
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
|
#!/bin/bash
#
# Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
COMMAND_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
INSTALL_DIR="$(dirname $(dirname $COMMAND_DIR))"
MD5_CHECK="on"
TFLITE_LOADER="nnapi"
REPORT_DIR="report"
TEST_LIST_FILE=
function Usage()
{
echo "Usage: $0 $(basename ${BASH_SOURCE[0]}) [OPTIONS]"
echo ""
echo "Options:"
echo " --ignoremd5 Ignore MD5 check when download model files"
echo " --api=(nnapi|loader) TFLite model file loading API (default=$TFLITE_LOADER)"
echo " --reportdir=PATH Path to write report (default=$REPORT_DIR)"
echo " --list=FILE List file to test. Test all if list option is not passed"
}
for i in "$@"
do
case $i in
-h|--help|help)
Usage
exit 1
;;
--ignoremd5)
MD5_CHECK="off"
;;
--api=*)
TFLITE_LOADER=${i#*=}
;;
--reportdir=*)
REPORT_DIR=${i#*=}
;;
--list=*)
TEST_LIST_FILE=${i#*=}
;;
*)
echo "Unknown option: $i"
exit 1
;;
esac
shift
done
if [ ! -z "$TEST_LIST_FILE" ]; then
MODELLIST=$(cat "${TEST_LIST_FILE}")
fi
if [ ! -e "$REPORT_DIR" ]; then
mkdir -p $REPORT_DIR
fi
TEST_RESULT=0
TAP_NAME=verification_test.tap
TEST_NAME="Verification"
TEST_DRIVER=
if [[ $TFLITE_LOADER == "nnapi" ]]; then
TEST_NAME="NNAPI Verification"
TEST_DRIVER=nnapi_test
elif [[ $TFLITE_LOADER == "loader" ]]; then
TEST_NAME="Loader Verification"
TEST_DRIVER=tflite_loader_test_tool
else
Usage
exit 1
fi
$INSTALL_DIR/test/models/run_test.sh --driverbin=$TEST_DRIVER \
--reportdir=$REPORT_DIR \
--tapname=$TAP_NAME \
${MODELLIST:-} > $REPORT_DIR/verification_test.log 2>&1
TEST_RESULT=$?
if [[ $TEST_RESULT -ne 0 ]]; then
echo ""
cat $REPORT_DIR/$TAP_NAME
echo ""
echo "$TEST_NAME failed... exit code: $TEST_RESULT"
echo "============================================"
echo ""
exit $TEST_RESULT
fi
echo ""
cat $REPORT_DIR/$TAP_NAME
echo "============================================"
echo ""
|