Include unitest rpm in the gcov build 65/318465/1 accepted/tizen/unified/20241004.041910 accepted/tizen/unified/x/20241006.082042
authorDohyun Pyun <dh79.pyun@samsung.com>
Mon, 30 Sep 2024 06:58:36 +0000 (15:58 +0900)
committerDohyun Pyun <dh79.pyun@samsung.com>
Mon, 30 Sep 2024 07:30:06 +0000 (16:30 +0900)
Change-Id: Ibd3e969ddf58c6d353f935f4302709ed8ebae387
Signed-off-by: Dohyun Pyun <dh79.pyun@samsung.com>
CMakeLists.txt
packaging/capi-network-wifi-aware.spec

index 39e8a7323c62653aec1250781a73206d7e622fba..0a5a88d29a96aa44d3fcc2cb8b9e274851f0eeb4 100644 (file)
@@ -59,5 +59,7 @@ ADD_SUBDIRECTORY(include)
 ADD_SUBDIRECTORY(src)
 ADD_SUBDIRECTORY(pkgconfig)
 ADD_SUBDIRECTORY(tests/nan-test)
+IF("$ENV{CFLAGS}" MATCHES "-DBUILD_GCOV")
 ADD_SUBDIRECTORY(tests/unittest)
+ENDIF()
 ADD_SUBDIRECTORY(cts-verifier)
index 2839b62676a6acb0925c26b3f4bd9f05eb088e16..5610ecb8fad6fea25d7eced5cb8487580aca17b2 100644 (file)
@@ -54,13 +54,13 @@ Summary:    Coverage Data of %{name}
 
 %description gcov
 The %{name}-gcov package contains gcov objects
-%endif
 
 %package unittests
 Summary:    %{name} unittests binary
 
 %description unittests
 unittests binary
+%endif
 
 %prep
 %setup -q
@@ -75,8 +75,8 @@ export ARCH=i586
 
 %build
 %if 0%{?gcov:1}
-export CFLAGS+=" -fprofile-arcs -ftest-coverage"
-export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
+export CFLAGS+=" -fprofile-arcs -ftest-coverage -DBUILD_GCOV"
+export CXXFLAGS+=" -fprofile-arcs -ftest-coverage -DBUILD_GCOV"
 export FFLAGS+=" -fprofile-arcs -ftest-coverage"
 %endif
 
@@ -97,6 +97,7 @@ MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
         -DDATA_ROOT_DIR:PATH=%{_datadir} \
         -DFULLVER=%{version} \
         -DMAJORVER=${MAJORVER}
+
 make %{?jobs:-j%jobs}
 
 %install
@@ -108,7 +109,6 @@ 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
@@ -136,12 +136,12 @@ EOF
 
 mkdir -p %{buildroot}%{_bindir}/tizen-unittests/%{name}
 install -m 0755 run-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/%{name}/
-
+%endif
 
 %check
+%if 0%{?gcov:1}
 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 mismatch,graph,unused --no-external -b . -d . -o %{name}.info
 genhtml %{name}.info -o out --legend --show-details
 %endif
@@ -177,8 +177,8 @@ genhtml %{name}.info -o out --legend --show-details
 %if 0%{?gcov:1}
 %files gcov
 %{_datadir}/gcov/obj/*
-%endif
 
 %files unittests
 %{_bindir}/wifi-aware-unittest
 %{_bindir}/tizen-unittests/%{name}/run-unittest.sh
+%endif