BuildRequires: cmake
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(libsystemd)
+%if 0%{?gcov:1}
+BuildRequires: lcov
+%endif
%description
Web Authentication Service
%description manual-tests
Web Authentication Service (manual test)
+# gcov
+%if 0%{?gcov:1}
+%package gcov
+Summary: %{name} gcov data
+
+%description gcov
+Base utils gcov objects
+%endif
+
%define user_name security_fw
%define group_name security_fw
%define smack_domain System
make %{?jobs:-j%jobs}
%install
+rm -rf %{buildroot}
%make_install
%install_service multi-user.target.wants %{name}.service
%install_service sockets.target.wants %{name}.socket
+%if 0%{?gcov:1}
+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"
+ /usr/bin/webauthn-unit-tests
+}
+
+teardown() {
+ echo "teardown start"
+ chown ${user_name}:${group_name} /home/abuild/rpmbuild/BUILD/%{name}-%{version} -R
+ /usr/bin/killall %{name}-server
+}
+
+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}/
+
# write macro
mkdir -p %{buildroot}%{ro_etc_dir}/rpm
touch %{buildroot}%{macro_file_path}
echo "%WEBAUTHN_HYBRID_PLUGIN_SO_PATH %{hybrid_plugin_so_path}" >> %{buildroot}%{macro_file_path}
-
%post
/sbin/ldconfig
systemctl daemon-reload
%{_includedir}/webauthn*.h
%{lib_dir}/pkgconfig/%{name}-hal.pc
+%if 0%{?gcov:1}
+%files gcov
+%{_datadir}/gcov/obj/*
+%endif
+
%files -n %{name}-unit-tests
%manifest %{name}-unit-tests.manifest
%license LICENSE
%{bin_dir}/%{name}-unit-tests
+%{_bindir}/tizen-unittests/%{name}/run-unittest.sh
%files -n %{name}-manual-tests
%manifest %{name}-manual-tests.manifest
#define WEBAUTHN_TEST_LOG_TAG "WEBAUTHN-TEST"
-#ifdef GCOV_BUILD
-extern "C" void __gcov_flush(void);
-#endif
-
int main(int argc, char *argv[])
{
WA::Singleton<WA::WebAuthnLog>::Instance().SetTag(WEBAUTHN_TEST_LOG_TAG);
bool ret = false;
-#ifdef GCOV_BUILD
- std::cout << "SET GCOV_PREFIX" << std::endl;
- setenv("GCOV_PREFIX", "/tmp", 1);
-#endif
try {
::testing::InitGoogleTest(&argc, argv);
ret = RUN_ALL_TESTS();
} catch (...) {
ret = true;
}
-#ifdef GCOV_BUILD
- std::cout << "The webauthn-server process need to be stopped to flush gcov"
- << std::endl;
-#endif
return ret;
}