BuildRequires: pkgconfig(gmock)
BuildRequires: cmake
%if 0%{?gcov:1}
+BuildRequires: gtest-devel
BuildRequires: lcov
BuildRequires: tar
%endif
gcov objects for coverage test
%endif
+%package unittests
+Summary: %{name} unittests binary
+%description unittests
+unittests binary
+
%prep
%setup -q
make %{?jobs:-j%jobs}
%install
+rm -rf %{buildroot}
+
%make_install
%if 0%{?gcov:1}
find . -name '*.gcno' -exec cp --parents '{}' "$gcno_obj_dir" ';'
%endif
+cat << EOF > run-unittest.sh
+#!/bin/sh
+setup() {
+ echo "setup start"
+}
+
+test_main() {
+ echo "test_main start"
+ LD_LIBRARY_PATH=%{_bindir}/tizen-unittests/%{name} /usr/bin/url-download-gtest
+}
+
+teardown() {
+ echo "teardown start"
+}
+
+main() {
+ setup
+ test_main
+ teardown
+}
+
+main "\$*"
+EOF
+
+mkdir -p %{buildroot}%{_bindir}/tizen-unittests/%{name}
+install -m 0755 run-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/%{name}/
+cp tests/libdp-interface-mock.so %{buildroot}%{_bindir}/tizen-unittests/%{name}/
+
%check
%if 0%{?gcov:1}
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:tests
%files gcov
%{_datadir}/gcov/obj/*
%endif
+
+%files unittests
+%{_bindir}/url-download-gtest
+%{_bindir}/tizen-unittests/%{name}/run-unittest.sh
+%{_bindir}/tizen-unittests/%{name}/*.so
\ No newline at end of file