From 0a2f8996d316bcaa484d6dc4d26255fe39d96bba Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=98=A4=ED=98=95=EC=84=9D/On-Device=20Lab=28SR=29/Staff?= =?utf8?q?=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Wed, 27 Nov 2019 13:29:25 +0900 Subject: [PATCH] [neurun/gbs] Collect gcov data (#9100) - On gbs build, collect .gcno files and install with test package - Set prefix strip on coverage test run - Remove unused parameter in tizen_xu4_test.sh Signed-off-by: Hyeongseok Oh --- infra/scripts/tizen_xu4_test.sh | 67 +++++++++++++++++------------------------ packaging/nnfw.spec | 7 ++++- 2 files changed, 33 insertions(+), 41 deletions(-) diff --git a/infra/scripts/tizen_xu4_test.sh b/infra/scripts/tizen_xu4_test.sh index 19aa029..e5eaa28 100755 --- a/infra/scripts/tizen_xu4_test.sh +++ b/infra/scripts/tizen_xu4_test.sh @@ -12,9 +12,6 @@ function Usage() echo "Usage: ./tizen_xu4_test.sh --test-suite-path=path/to/test-suite.tar.gz --unittest --verification" echo "--rpm-dir : directory containing nnfw.rpm and nnfw-test.rpm" echo "--test-suite-path : filepath to test-suite.tar.gz" - echo "--unittest : run unittest" - echo "--verification : run verification" - echo "--framework : run framework" echo "--gcov-dir : directory to save gcov files" } @@ -26,7 +23,7 @@ function prepare_rpm_test() $SDB_CMD shell rm -rf $TEST_ROOT $SDB_CMD shell mkdir -p $TEST_ROOT # install nnfw nnfw-test rpms - for file in $RPM_DIR/* + for file in $RPM_DIR/*.rpm do $SDB_CMD push $file $TEST_ROOT $SDB_CMD shell rpm -Uvh $TEST_ROOT/$(basename $file) --force --nodeps @@ -78,15 +75,6 @@ do --test-suite-path=*) TEST_SUITE_PATH=${i#*=} ;; - --unittest) - UNITTEST=on - ;; - --verification) - VERIFICATION=on - ;; - --framework) - FRAMEWORK=on - ;; --gcov-dir=*) GCOV_DIR=${i#*=} ;; @@ -131,31 +119,30 @@ else prepare_suite_test fi -# For tizen, we run acl_cl and mixed test -$SDB_CMD shell /bin/bash -c "IGNORE_MD5=1 $TEST_ROOT/infra/scripts/test_tizen_neurun_acl_cl.sh" -$SDB_CMD shell /bin/bash -c "IGNORE_MD5=1 $TEST_ROOT/infra/scripts/test_tizen_neurun_mixed.sh" - -# run unittest -if [ "$UNITTEST" == "on" ]; then - $SDB_CMD shell $TEST_ROOT/tests/scripts/test_driver.sh --unittest --artifactpath=$TEST_ROOT -fi - -# run framework test -if [ "$FRAMEWORK" == "on" ]; then - $SDB_CMD shell $TEST_ROOT/tests/scripts/test_driver.sh --frameworktest --artifactpath=$TEST_ROOT -fi - -# run verification -if [ "$VERIFICATION" == "on" ]; then - $SDB_CMD shell $TEST_ROOT/tests/scripts/test_driver.sh --verification --artifactpath=$TEST_ROOT -fi - -# pull gcov files -if [ -n "$GCOV_DIR" ]; then - $SDB_CMD shell 'rm -rf /home/gcov && mkdir -p /home/gcov' - $SDB_CMD shell 'find / -type f \( -iname "*.gcda" -or -iname "*.gcno" \) -exec cp {} /home/gcov/. \;' - $SDB_CMD shell 'cd /home/ && tar -zcvf gcov.tar.gz ./gcov ' - cd $GCOV_DIR - sdb pull /home/gcov.tar.gz - tar -zxvf gcov.tar.gz +if [ -z "${GCOV_DIR}" ]; then + ${SDB_CMD} shell /bin/bash -c "IGNORE_MD5=1 ${TEST_ROOT}/infra/scripts/test_tizen_neurun_acl_cl.sh" + ${SDB_CMD} shell /bin/bash -c "IGNORE_MD5=1 ${TEST_ROOT}/infra/scripts/test_tizen_neurun_mixed.sh" +else + mkdir -p ${GCOV_DIR} + rm -rf ${GCOV_DIR}/* + pushd ${GCOV_DIR} + + sdb pull ${TEST_ROOT}/tests/scripts/build_path.txt + SRC_PREFIX=`cat build_path.txt` + GCOV_PREFIX_STRIP=`echo "${SRC_PREFIX}" | grep -o '/' | wc -l` + GCOV_DATA_PATH="/opt/usr/nnfw-gcov" + + # TODO For coverage check, we run acl_cl and mixed test + ${SDB_CMD} shell /bin/bash -c "GCOV_PREFIX_STRIP=${GCOV_PREFIX_STRIP} IGNORE_MD5=1 ${TEST_ROOT}/infra/scripts/test_tizen_neurun_acl_cl.sh" + ${SDB_CMD} shell /bin/bash -c "GCOV_PREFIX_STRIP=${GCOV_PREFIX_STRIP} IGNORE_MD5=1 ${TEST_ROOT}/infra/scripts/test_tizen_neurun_mixed.sh" + + # More test to check coverage + ${SDB_CMD} shell "rm -rf ${GCOV_DATA_PATH} && mkdir -p ${GCOV_DATA_PATH}" + ${SDB_CMD} shell "find ${TEST_ROOT} -type f \( -iname '*.gcda' -or -iname '*.gcno' \) -exec cp {} ${GCOV_DATA_PATH}/. \;" + ${SDB_CMD} shell "cd ${TEST_ROOT} && tar -zcvf coverage-data.tar.gz -C ${GCOV_DATA_PATH} ." + + # pull gcov files + sdb pull ${TEST_ROOT}/coverage-data.tar.gz + tar -zxvf coverage-data.tar.gz + popd fi diff --git a/packaging/nnfw.spec b/packaging/nnfw.spec index 514b740..38b59e3 100644 --- a/packaging/nnfw.spec +++ b/packaging/nnfw.spec @@ -104,7 +104,7 @@ tar -xf %{SOURCE1003} -C ./externals %{test_build_env} ./nnfw configure %{test_build_options} %{extra_option} %{test_build_env} ./nnfw build %if %{coverage_build} == 1 -pwd | grep -o '/' | wc -l > tests/scripts/build_path_depth.txt +pwd > tests/scripts/build_path.txt %endif tar -zcf test-suite.tar.gz infra/scripts tests/scripts tests/framework %endif @@ -127,6 +127,11 @@ install -m 0644 ./nnfw.pc.in %{buildroot}%{_libdir}/pkgconfig/nnfw.pc %{test_build_env} ./nnfw install tar -zxf test-suite.tar.gz -C %{buildroot}%{test_install_home} +%if %{coverage_build} == 1 +mkdir -p %{buildroot}%{test_install_home}/gcov +find . -name "*.gcno" -exec xargs cp {} %{buildroot}%{test_install_home}/gcov/. \; +%endif + %endif %post -p /sbin/ldconfig -- 2.7.4