+# Execute gbs with --define "testcoverage 1" in case that you must get unittest coverage statictics
+
Name: nnstreamer
Summary: gstremaer plugins for neural networks
Version: 0.0.1
# and gtest
BuildRequires: gtest-devel
+%if 0%{?testcoverage}
+BuildRequires: taos-ci-unittest-coverage-assessment
+%endif
+
+%package unittest-coverage
+Summary: NNStreamer UnitTest Coverage Analysis Result
+%description unittest-coverage
+HTML pages of lcov results of NNStreamer generated during rpmbuild
+
%description
NNStreamer is a set of gstreamer plugins to support general neural networks
and their plugins in a gstreamer stream.
cp %{SOURCE1001} .
%build
+%if 0%{?testcoverage}
+CXXFLAGS="${CXXFLAGS} -fprofile-arcs -ftest-coverage"
+CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage"
+%endif
mkdir -p build
pushd build
./runTest.sh -skipgen
popd
+%if 0%{?testcoverage}
+ unittestcoverage.py module $(pwd)
+
+# Get commit info
+ VCS=`cat ${RPM_SOURCE_DIR}/audri.spec | grep "^VCS:" | sed "s|VCS:\\W*\\(.*\\)|\\1|"`
+
+# Create human readable unit test coverate 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
+ #find . -path "/build/*.j
+ # Generate report
+ lcov -t 'NNStreamer Unit Test Coverage' -o unittest.info -c -d . -b $(pwd) --no-external
+ # Visualize the report
+ genhtml -o result unittest.info -t "AuDri %{version}-%{release} ${VCS}" --ignore-errors source -p ${RPM_BUILD_DIR}
+%endif
+
%install
pushd build
%make_install
popd
+%if 0%{?testcoverage}
+mkdir -p %{buildroot}%{_datadir}/nnstreamer/unittest/
+cp -r result %{buildroot}%{_datadir}/nnstreamer/unittest/
+%endif
+
%files
%manifest nnstreamer.manifest
%defattr(-,root,root,-)
%license LICENSE.LGPLv2.1
%{_libdir}/*
+%if 0%{?testcoverage}
+%files unittest-coverage
+%{_datadir}/nnstreamer/unittest/*
+%endif
+
%changelog
* Fri May 25 2018 MyungJoo Ham <myungjoo.ham@samsung.com>
- Packaged tensor_convert plugin.