Imported Upstream version 1.8.0
[platform/core/ml/nnfw.git] / infra / scripts / test_coverage.sh
1 #!/bin/bash
2
3 # Test suite: ${ARCHIVE_PATH}/coverage-suite.tar.gz
4 # NNPackage test suite: ${ARCHIVE_PATH}/nnpkg-test-suite.tar.gz (optional)
5
6 set -eo pipefail
7 source "$(dirname "${BASH_SOURCE[0]}")/common.sh"
8
9 CheckTestPrepared
10
11 NNAS_WORKSPACE=${NNAS_WORKSPACE:-build}
12 if [[ -z "${ARCHIVE_PATH}" ]]; then
13   ARCHIVE_PATH=${NNAS_WORKSPACE}/archive
14   echo "Default archive directory including nncc package and resources: ${ARCHIVE_PATH}"
15 fi
16
17 pushd $ROOT_PATH > /dev/null
18
19 tar -zxf ${ARCHIVE_PATH}/coverage-suite.tar.gz -C ./
20
21 if [[ ! -e $ROOT_PATH/tests/scripts/build_path_depth.txt ]]; then
22   echo "Cannot find prefix strip file"
23   exit 1
24 fi
25 export GCOV_PREFIX_STRIP=`cat $ROOT_PATH/tests/scripts/build_path_depth.txt`
26
27 ./infra/scripts/test_ubuntu_runtime.sh --backend acl_cl --tflite-loader
28 ./infra/scripts/test_ubuntu_runtime.sh --backend acl_neon
29 ./infra/scripts/test_ubuntu_runtime.sh --backend cpu
30
31 # Enable all logs (mixed backend)
32 TENSOR_LOGGING=trace_log.txt ONERT_LOG_ENABLE=1 GRAPH_DOT_DUMP=1 ./infra/scripts/test_ubuntu_runtime_mixed.sh
33 # Enable trace event (acl_cl default backend)
34 export TRACE_FILEPATH=trace.json
35 TFLiteModelVerification "acl_cl" "Product/out/test/list/frameworktest_list.armv7l.acl_cl.txt" "report/acl_cl/trace"
36 unset TRACE_FILEPATH
37
38 # Interpreter
39 ./infra/scripts/test_ubuntu_runtime.sh --interp
40
41 # nnpackage test suite
42 if [[ -e ${ARCHIVE_PATH}/nnpkg-test-suite.tar.gz ]]; then
43   tar -zxf ${ARCHIVE_PATH}/nnpkg-test-suite.tar.gz -C ./
44   ./infra/scripts/test_arm_nnpkg.sh
45 fi
46
47 # Pack coverage test data: coverage-data.tar.gz
48 find Product -type f \( -iname *.gcda -or -iname *.gcno \) > include_lists.txt
49 tar -zcf ${ARCHIVE_PATH}/coverage-data.tar.gz -T include_lists.txt
50 rm -rf include_lists.txt
51
52 popd > /dev/null