diff options
author | Gichan Jang <gichan2.jang@samsung.com> | 2024-11-07 14:46:33 +0900 |
---|---|---|
committer | gichan-jang <56856496+gichan-jang@users.noreply.github.com> | 2024-11-12 17:14:46 +0900 |
commit | 1db32d22b5e541324aebe35c987527069237a5e7 (patch) | |
tree | fcf966018e7833da1cf8e244663743a9f2a5ea26 | |
parent | 681b884c6a50f3134065311d1610991dcdde916e (diff) | |
download | machine-learning-accepted/tizen_9.0_unified.tar.gz machine-learning-accepted/tizen_9.0_unified.tar.bz2 machine-learning-accepted/tizen_9.0_unified.zip |
[gcov] Fix invalid gcda filesaccepted/tizen/9.0/unified/20241114.015943accepted/tizen_9.0_unified
Previously, a null file was created to cover cases where tests were not performed.
From the latest gcov version (gcov14), this is treated as an invalid gcda file, resulting in an error.
Change to merge the initialized info and test result info.
Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
-rw-r--r-- | packaging/machine-learning-api.spec | 18 |
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 |