3 SCRIPT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4 HOST_HOME=$SCRIPT_ROOT/../..
5 if [ -z "$TEST_ROOT" ]; then
6 TEST_ROOT=/opt/usr/nnfw-test
11 echo "Usage: ./tizen_xu4_test.sh"
12 echo "Usage: ./tizen_xu4_test.sh --rpm-dir=path/to/rpm-dir"
13 echo "Usage: ./tizen_xu4_test.sh --test-suite-path=path/to/test-suite.tar.gz"
14 echo "Usage: ./tizen_xu4_test.sh --skip-install-model"
15 echo "Usage: ./tizen_xu4_test.sh --rpm-dir=path/to/rpm-dir --skip-test"
17 echo "--rpm-dir <dir> : directory containing nnfw.rpm and nnfw-test.rpm"
18 echo "--test-suite-path <dir> : filepath to test-suite.tar.gz"
19 echo "--skip-install-model : skip install downloaded model"
20 echo "--skip-test : skip running test"
21 echo "--gcov-dir <dir> : directory to save gcov files"
24 function install_model()
26 # download tflite model files
28 tests/scripts/models/run_test.sh --download=on --run=off
29 # TODO Since this command removes model file(.zip),
30 # We must always download the file unlike model file(.tflite).
31 # Because caching applies only to tflite file.
32 find tests -name "*.zip" -exec rm {} \;
33 tar -zcf cache.tar.gz -C tests/scripts/models cache
34 $SDB_CMD push cache.tar.gz $TEST_ROOT/.
36 $SDB_CMD shell tar -zxf $TEST_ROOT/cache.tar.gz -C $TEST_ROOT/Product/out/test/models
38 # download api test model file for nnfw_api_gtest
39 MODEL_CACHE_DIR=$(mktemp -d)
40 tests/scripts/models/run_test.sh --download=on --run=off \
41 --configdir=tests/scripts/models/nnfw_api_gtest \
42 --cachedir=$MODEL_CACHE_DIR
43 tar -zcf $MODEL_CACHE_DIR/api_model_test.tar.gz -C $MODEL_CACHE_DIR .
44 $SDB_CMD push $MODEL_CACHE_DIR/api_model_test.tar.gz $TEST_ROOT/Product/out/unittest_standalone/nnfw_api_gtest_models/
45 $SDB_CMD shell tar -zxf $TEST_ROOT/Product/out/unittest_standalone/nnfw_api_gtest_models/api_model_test.tar.gz \
46 -C $TEST_ROOT/Product/out/unittest_standalone/nnfw_api_gtest_models/
47 rm -rf $MODEL_CACHE_DIR
52 function prepare_rpm_test()
54 echo "======= Test with rpm packages(gbs build) ======="
56 $SDB_CMD shell rm -rf $TEST_ROOT
57 $SDB_CMD shell mkdir -p $TEST_ROOT
58 # install nnfw nnfw-test rpms
59 for file in $RPM_DIR/*.rpm
61 $SDB_CMD push $file $TEST_ROOT
62 $SDB_CMD shell rpm -Uvh $TEST_ROOT/$(basename $file) --force --nodeps
66 function prepare_suite_test()
68 echo "======= Test with test-suite(cross build) ======="
70 $SDB_CMD shell rm -rf $TEST_ROOT
71 $SDB_CMD shell mkdir -p $TEST_ROOT
74 $SDB_CMD push $TEST_SUITE_PATH $TEST_ROOT/$(basename $TEST_SUITE_PATH)
75 $SDB_CMD shell tar -zxf $TEST_ROOT/$(basename $TEST_SUITE_PATH) -C $TEST_ROOT
96 TEST_SUITE_PATH=${i#*=}
102 --skip-install-model)
116 N=`sdb devices 2>/dev/null | wc -l`
118 # exit if no device found
119 if [[ $N -le 1 ]]; then
120 echo "No device found."
126 DEVICE_LIST=`sdb devices 2>/dev/null`
127 echo "$DEVICE_LIST" | tail -n"$NUM_DEV"
129 if [ -z "$SERIAL" ]; then
130 SERIAL=`echo "$DEVICE_LIST" | tail -n1 | awk '{print $1}'`
132 SDB_CMD="sdb -s $SERIAL "
134 # root on, remount as rw
136 $SDB_CMD shell mount -o rw,remount /
138 SCRIPT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
139 ROOT=$SCRIPT_ROOT/../
141 if [ -z "$RPM_DIR" ] && [ -z "$TEST_SUITE_PATH" ]; then
142 echo "======= Skip install runtime ======="
145 if [ ! -z "$RPM_DIR" ]; then
147 elif [ ! -z "$TEST_SUITE_PATH" ]; then
151 if [ $INSTALL_MODEL = "1" ]; then
154 echo "======= Skip install model ======="
157 if [ $RUN_TEST = "0" ]; then
158 echo "======= Skip test ======="
162 if [ -z "${GCOV_DIR}" ]; then
163 ${SDB_CMD} shell /bin/bash -c "IGNORE_MD5=1 ${TEST_ROOT}/infra/scripts/test_ubuntu_runtime.sh --backend acl_cl --tflite-loader"
164 ${SDB_CMD} shell /bin/bash -c "IGNORE_MD5=1 ${TEST_ROOT}/infra/scripts/test_ubuntu_runtime.sh --backend acl_neon"
165 ${SDB_CMD} shell /bin/bash -c "IGNORE_MD5=1 ${TEST_ROOT}/infra/scripts/test_ubuntu_runtime.sh --backend cpu"
166 ${SDB_CMD} shell /bin/bash -c "IGNORE_MD5=1 ${TEST_ROOT}/infra/scripts/test_ubuntu_runtime_mixed.sh"
167 ${SDB_CMD} shell /bin/bash -c "IGNORE_MD5=1 ${TEST_ROOT}/infra/scripts/test_ubuntu_runtime.sh --interp"
173 sdb pull ${TEST_ROOT}/Product/out/test/build_path.txt
174 SRC_PREFIX=`cat build_path.txt`
175 GCOV_PREFIX_STRIP=`echo "${SRC_PREFIX}" | grep -o '/' | wc -l`
176 GCOV_DATA_PATH="/opt/usr/nnfw-gcov"
178 # TODO For coverage check, we run acl_cl and mixed test
179 ${SDB_CMD} shell /bin/bash -c "GCOV_PREFIX_STRIP=${GCOV_PREFIX_STRIP} IGNORE_MD5=1 ${TEST_ROOT}/infra/scripts/test_ubuntu_runtime.sh --backend acl_cl --tflite-loader"
180 ${SDB_CMD} shell /bin/bash -c "GCOV_PREFIX_STRIP=${GCOV_PREFIX_STRIP} IGNORE_MD5=1 ${TEST_ROOT}/infra/scripts/test_ubuntu_runtime.sh --backend acl_neon"
181 ${SDB_CMD} shell /bin/bash -c "GCOV_PREFIX_STRIP=${GCOV_PREFIX_STRIP} IGNORE_MD5=1 ${TEST_ROOT}/infra/scripts/test_ubuntu_runtime.sh --backend cpu"
182 ${SDB_CMD} shell /bin/bash -c "GCOV_PREFIX_STRIP=${GCOV_PREFIX_STRIP} IGNORE_MD5=1 ${TEST_ROOT}/infra/scripts/test_ubuntu_runtime_mixed.sh"
183 ${SDB_CMD} shell /bin/bash -c "GCOV_PREFIX_STRIP=${GCOV_PREFIX_STRIP} IGNORE_MD5=1 ${TEST_ROOT}/infra/scripts/test_ubuntu_runtime.sh --interp"
185 # More test to check coverage
186 ${SDB_CMD} shell "rm -rf ${GCOV_DATA_PATH} && mkdir -p ${GCOV_DATA_PATH}"
187 ${SDB_CMD} shell "find ${TEST_ROOT} -type f \( -iname '*.gcda' -or -iname '*.gcno' \) -exec cp {} ${GCOV_DATA_PATH}/. \;"
188 ${SDB_CMD} shell "cd ${TEST_ROOT} && tar -zcvf coverage-data.tar.gz -C ${GCOV_DATA_PATH} ."
191 sdb pull ${TEST_ROOT}/coverage-data.tar.gz
192 tar -zxvf coverage-data.tar.gz