1 %define neexampledir %{_libdir}/npu-engine/bin
7 Group: System Environment/Daemons
8 Packager: MyungJoo Ham <myungjoo.ham@samsung.com>
10 Source0: npu-engine-%{version}.tar.gz
15 BuildRequires: pkg-config
17 BuildRequires: linux-npu-headers
20 BuildRequires: pkgconfig(libdrm)
22 # NE-CONF uses iniparser
23 BuildRequires: pkgconfig(iniparser)
26 BuildRequires: gtest-devel
28 # test coverage dependency
29 %if 0%{?test_coverage}
33 # NPU emulation dependency (used in unittests only)
35 %define enable_npu_emul true
36 BuildRequires: npu-engine-emul
39 %define testdatadir %{_datadir}/npu-engine/testdata
40 BuildRequires: npu-engine-testdata
43 # valgrind requires the same arch with host (x86_64)
46 BuildRequires: valgrind
47 BuildRequires: glibc-debuginfo
49 %undefine use_valgrind
54 %define enable_npu_emul false
57 %global debug_package %{nil}
58 %global __debug_install_post %{nil}
61 This provides in-NPU software control daemon, NPU-Engine.
68 # @todo (NYI) build three times for the three different transport plugins for npu-engine
70 %if 0%{?test_coverage}
71 CXXFLAGS="${CXXFLAGS} -fprofile-arcs -ftest-coverage"
72 CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage"
75 meson build --prefix=%{_prefix} --sysconfdir=%{_sysconfdir} --libdir=%{_libdir} --includedir=%{_includedir} --bindir=%{neexampledir} -Denable_npu_emul=%{enable_npu_emul} -Denable_data_manip=true
76 ninja -C build %{?_smp_mflags}
80 # Install Core (NPU-Engine)
81 DESTDIR=%{buildroot} ninja install -C build %{?_smp_mflags}
89 find unittests -maxdepth 1 -type f -perm 0755 -print0 | while IFS= read -r -d $'\0' unittest_exec; do
91 valgrind ./${unittest_exec}
93 ./${unittest_exec} --gtest_output="xml:${unittest_exec}.xml"
97 find apptests -maxdepth 1 -type f -perm 0755 -print0 | while IFS= read -r -d $'\0' apptest_exec; do
99 valgrind ./${apptest_exec}
105 # Run apptests using actual model files.
107 ./apptests/apptest_example_visa /%{testdatadir}/npubinfmt_v1 > /dev/null
108 ./apptests/apptest_example_visa /%{testdatadir}/npubinfmt_v2 > /dev/null
114 # Analyze test coverage
115 %if 0%{?test_coverage}
116 # 'lcov' generates the date format with UTC time zone by default. Let's replace UTC with KST
117 TZ='Asia/Seoul'; export TZ
119 $(pwd)/tools/unittestcoverage.py module $(pwd)/src
122 VCS=`cat ${RPM_SOURCE_DIR}/npu-engine.spec | grep "^VCS:" | sed "s|VCS:\\W*\\(.*\\)|\\1|"`
124 # Create human readable unit test coverate report web page
125 # Create null gcda files if gcov didn't create it
126 find . -name "*.gcno" -exec sh -c 'touch -a "${1%.gcno}.gcda"' _ {} \;
128 lcov -t 'NPU SystemService Unit Test Coverage' -o unittest.info -c -d . -b $(pwd)/src --no-external
129 # Exclude generated files
130 lcov -r unittest.info "*/tools/*" "*/tests/*" "*/meson*/*" -o unittest-filtered.info
131 # Visualize the report
132 genhtml -o result unittest-filtered.info -t "NPU SystemService %{version}-%{release} ${VCS}" --ignore-errors source -p ${RPM_BUILD_DIR}
134 # Copy unittest results
135 mkdir -p %{buildroot}%{_datadir}/unittest/
136 cp -r result %{buildroot}%{_datadir}/unittest/
140 %%defattr(-,root,root,-)
141 %{_libdir}/libnpu-engine.so
142 %{_libdir}/libnpu-engine.a
143 %{_sysconfdir}/npu-engine.ini
146 Summary: Development Support for NPU Engine Library
147 Requires: npu-engine = %{version}-%{release}
149 Developmental packages to develop programs using npu-engine.
150 This contains corresponding header files and .pc pkgconfig file.
152 %{_includedir}/npu-engine/*.h
153 %{_libdir}/pkgconfig/*.pc
156 Summary: NPU Engine Example Package
157 Requires: npu-engine = %{version}-%{release}
159 Example application package for NPU Engine, including UnitTests and AppTest with realistic scenarios.
161 %%defattr(-,root,root,-)
162 %{neexampledir}/unittests/*
163 %{neexampledir}/apptests/*
165 %package unittest-coverage
166 Summary: NPU Engine UnitTest Coverage Analysis Result
167 %description unittest-coverage
168 HTML pages of lcov results of NPU Engine generated during rpmbuild
169 %if 0%{?test_coverage}
170 %files unittest-coverage
171 %{_datadir}/unittest/*
175 * Wed Feb 19 2020 Dongju Chae <dongju.chae@samsung.com>
178 * Fri Feb 14 2020 Dongju Chae <dongju.chae@samsung.com>
181 * Fri Feb 07 2020 Dongju Chae <dongju.chae@samsung.com>
184 * Tue Jan 07 2020 Dongju Chae <dongju.chae@samsung.com>
187 * Tue Dec 17 2019 Dongju Chae <dongju.chae@samsung.com>
190 * Thu Nov 28 2019 Wook Song <wook16.song@samsung.com>
193 * Wed Nov 27 2019 Wook Song <wook16.song@samsung.com>
196 * Fri Nov 22 2019 Dongju Chae <dongju.chae@samsung.com>