%description devel
This package contains necessaary files for manifest-parser development
+%package unittests
+Summary: %{name} unittests binary
+
+%description unittests
+unittest binary
+
%prep
%setup -q
cp %{SOURCE100} .
make %{?_smp_mflags}
-%if 0%{?gcov:1}
-mkdir -p gcov-obj
-find . -name '*.gcno' ! -path './gcov-obj/*' -exec cp '{}' gcov-obj ';'
-%endif
-
%check
export LD_LIBRARY_PATH=../../src/tpk_manifest_handlers
ctest -V
%if 0%{?gcov:1}
-lcov -c --ignore-errors graph --no-external -q -d . -o tpk-manifest-handlers.info
-genhtml tpk-manifest-handlers.info -o tpk-manifest-handlers.out
-zip -r tpk-manifest-handlers.zip tpk-manifest-handlers.out
-install -m 0644 tpk-manifest-handlers.zip %{buildroot}%{_datadir}/gcov/
+lcov -c --ignore-errors graph --no-external -b . -d . -o %{name}.info
+genhtml %{name}.info -o out --legend --show-details
%endif
%install
%make_install
%if 0%{?gcov:1}
-mkdir -p %{buildroot}%{_datadir}/gcov/obj/%{name}
-install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj/%{name}
+builddir=$(basename $PWD)
+gcno_obj_dir=%{buildroot}%{_datadir}/gcov/obj/%{name}/"$builddir"
+mkdir -p "$gcno_obj_dir"
+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"
+ CUR_DIR=$(pwd)
+ cd /usr/bin
+ /usr/bin/tpk-manifest-handlers-unit-test
+ cd $CUR_DIR
+}
+
+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}/
+
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%if 0%{?gcov:1}
%files gcov
%defattr(-,root,root,-)
-%{_datadir}/gcov/*
+%{_datadir}/gcov/obj/*
%endif
+
+%files unittests
+%{_bindir}/tpk-manifest-handlers-unit-test
+%{_bindir}/test_samples
+%{_bindir}/tizen-unittests/%{name}/run-unittest.sh
NAME ${TARGET_TPK_MANIFEST_HANDLERS_UNIT_TEST}
COMMAND ${TARGET_TPK_MANIFEST_HANDLERS_UNIT_TEST}
)
+
+INSTALL(TARGETS ${TARGET_TPK_MANIFEST_HANDLERS_UNIT_TEST} DESTINATION bin)
+INSTALL(DIRECTORY test_samples/ DESTINATION bin/test_samples)