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)
%description gcov
The %{name}-gcov package contains gcov objects
-%endif
%package unittests
Summary: %{name} unittests binary
%description unittests
unittests binary
+%endif
%prep
%setup -q
%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
-DDATA_ROOT_DIR:PATH=%{_datadir} \
-DFULLVER=%{version} \
-DMAJORVER=${MAJORVER}
+
make %{?jobs:-j%jobs}
%install
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
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
%if 0%{?gcov:1}
%files gcov
%{_datadir}/gcov/obj/*
-%endif
%files unittests
%{_bindir}/wifi-aware-unittest
%{_bindir}/tizen-unittests/%{name}/run-unittest.sh
+%endif