summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packaging/machine-learning-api.spec18
1 files changed, 11 insertions, 7 deletions
diff --git a/packaging/machine-learning-api.spec b/packaging/machine-learning-api.spec
index d473da3..b6cf21d 100644
--- a/packaging/machine-learning-api.spec
+++ b/packaging/machine-learning-api.spec
@@ -414,6 +414,14 @@ ninja -C build %{?_smp_mflags}
export MLAPI_SOURCE_ROOT_PATH=$(pwd)
export MLAPI_BUILD_ROOT_PATH=$(pwd)/build
+%if 0%{?testcoverage}
+# Capture initial zero coverage data. This will be merged with actual coverage data later.
+# This is to prevent null gcda file error if the test is not performed (in case of gcov package generation mode).
+pushd build
+lcov -i -c -o unittest_base.info -d . -b $(pwd) --ignore-errors mismatch
+popd
+%endif # testcoverage
+
# Run test
# If gcov package generation is enabled, pass the test from GBS.
%if 0%{?unit_test} && !0%{?gcov}
@@ -451,19 +459,15 @@ TZ='Asia/Seoul'; export TZ
VCS=`cat ${RPM_SOURCE_DIR}/machine-learning-api.spec | grep "^VCS:" | sed "s|VCS:\\W*\\(.*\\)|\\1|"`
# Create human readable coverage report web page.
-# Create null gcda files if gcov didn't create it because there is completely no unit test for them.
-find . -name "*.gcno" -exec sh -c 'touch -a "${1%.gcno}.gcda"' _ {} \;
-# Remove gcda for meaningless file (CMake's autogenerated)
-find . -name "CMakeCCompilerId*.gcda" -delete
-find . -name "CMakeCXXCompilerId*.gcda" -delete
# Generate report and exclude files which are generated by gdbus-codegen and external files in /usr/*.
# TODO: the --no-external option is removed to include machine-learning-agent related source files.
# Restore this option when there is proper way to include those source files.
pushd build
# Set different lcov options for Tizen/lcov versions.
%if 0%{tizen_version_major} >= 9
-lcov -t 'ML API unittest coverage' -o unittest.info -c -d . -b $(pwd) --ignore-errors mismatch
-lcov -r unittest.info "*/tests/*" "*/meson*/*" "*/*@sha/*" "*/*.so.p/*" "*/*tizen*" "*/*-dbus.c" "/usr/*" -o unittest-filtered.info --ignore-errors graph,unused
+lcov -t 'ML API unittest coverage' -o unittest_test.info -c -d . -b $(pwd) --ignore-errors mismatch,empty
+lcov -a unittest_base.info -a unittest_test.info -o unittest_total.info --ignore-errors empty
+lcov -r unittest_total.info "*/tests/*" "*/meson*/*" "*/*@sha/*" "*/*.so.p/*" "*/*tizen*" "*/*-dbus.c" "/usr/*" -o unittest-filtered.info --ignore-errors graph,unused
%else
lcov -t 'ML API unittest coverage' -o unittest.info -c -d . -b $(pwd)
lcov -r unittest.info "*/tests/*" "*/meson*/*" "*/*@sha/*" "*/*.so.p/*" "*/*tizen*" "*/*-dbus.c" "/usr/*" -o unittest-filtered.info