summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packaging/capi-network-wifi-aware.spec54
-rw-r--r--tests/unittest/CMakeLists.txt2
2 files changed, 46 insertions, 10 deletions
diff --git a/packaging/capi-network-wifi-aware.spec b/packaging/capi-network-wifi-aware.spec
index b114f1a..9193913 100644
--- a/packaging/capi-network-wifi-aware.spec
+++ b/packaging/capi-network-wifi-aware.spec
@@ -17,6 +17,7 @@ BuildRequires: pkgconfig(capi-system-info)
BuildRequires: pkgconfig(cynara-client)
BuildRequires: pkgconfig(gmock)
%if 0%{?gcov:1}
+BuildRequires: gtest-devel
BuildRequires: lcov
%endif
@@ -55,6 +56,12 @@ Summary: Coverage Data of %{name}
The %{name}-gcov package contains gcov objects
%endif
+%package unittests
+Summary: %{name} unittests binary
+
+%description unittests
+unittests binary
+
%prep
%setup -q
chmod 644 %{SOURCE0}
@@ -71,7 +78,6 @@ export ARCH=i586
export CFLAGS+=" -fprofile-arcs -ftest-coverage"
export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
export FFLAGS+=" -fprofile-arcs -ftest-coverage"
-export LDFLAGS+=" -lgcov"
%endif
%if 0%{?sec_build_binary_debug_enable}
@@ -93,24 +99,48 @@ MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-DMAJORVER=${MAJORVER}
make %{?jobs:-j%jobs}
-%if 0%{?gcov:1}
-mkdir -p gcov-obj
-find . -name '*.gcno' -exec cp '{}' gcov-obj ';'
-%endif
-
%install
rm -rf %{buildroot}
%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' ! -path '*/cts-verifier/*' ! -path '*/nan-test/*' -exec cp --parents '{}' "$gcno_obj_dir" ';'
%endif
+cat << EOF > run-unittest.sh
+#!/bin/sh
+setup() {
+ echo "setup start"
+}
+
+test_main() {
+ echo "test_main start"
+ /usr/bin/wifi-aware-unittest
+}
+
+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}/
+
+
%check
export LD_LIBRARY_PATH=./src/:./tests/unittest/mocks/
LD_PRELOAD=./tests/unittest/mocks/libwifi-aware-mock.so ./tests/unittest/wifi-aware-unittest
-
%if 0%{?gcov:1}
lcov -c --ignore-errors graph --no-external -b . -d . -o %{name}.info
genhtml %{name}.info -o out --legend --show-details
@@ -146,5 +176,9 @@ genhtml %{name}.info -o out --legend --show-details
%if 0%{?gcov:1}
%files gcov
-%{_datadir}/gcov/obj/%{name}/*
+%{_datadir}/gcov/obj/*
%endif
+
+%files unittests
+%{_bindir}/wifi-aware-unittest
+%{_bindir}/tizen-unittests/%{name}/run-unittest.sh
diff --git a/tests/unittest/CMakeLists.txt b/tests/unittest/CMakeLists.txt
index f9d470e..8bd41f1 100644
--- a/tests/unittest/CMakeLists.txt
+++ b/tests/unittest/CMakeLists.txt
@@ -41,3 +41,5 @@ TARGET_LINK_LIBRARIES(${WIFI_AWARE_UNITTEST}
${TARGET_WIFI_AWARE_MOCK_INTERFACE}
${TARGET_WIFI_AWARE_UNITTEST_LIBRARIES}
)
+
+INSTALL(TARGETS ${WIFI_AWARE_UNITTEST} DESTINATION bin/)