diff options
author | Adrian Szyndela <adrian.s@samsung.com> | 2017-02-06 12:17:24 +0100 |
---|---|---|
committer | Adrian Szyndela <adrian.s@samsung.com> | 2017-02-15 16:02:28 +0100 |
commit | b0e9b25d25f0932f3da6d0613df16c8e33798fd2 (patch) | |
tree | 26b04866c9451884407e58625dcf98616184d714 /packaging | |
parent | 9f35da3aea7e5a30be531b5a858a4fa94707fcee (diff) | |
download | dbus-b0e9b25d25f0932f3da6d0613df16c8e33798fd2.tar.gz dbus-b0e9b25d25f0932f3da6d0613df16c8e33798fd2.tar.bz2 dbus-b0e9b25d25f0932f3da6d0613df16c8e33798fd2.zip |
tests: generating coverage version of the library
Additionally:
- immediate output of test results instead of caching and printing
at the end;
- removed manual-authz test, because it is not meant to be run
automatically.
Change-Id: I7354c21e0fa457ad7e2a4a53e1c898e5039b7f73
Diffstat (limited to 'packaging')
-rw-r--r-- | packaging/coverage.txt | 14 | ||||
-rw-r--r-- | packaging/dbus.spec | 87 |
2 files changed, 97 insertions, 4 deletions
diff --git a/packaging/coverage.txt b/packaging/coverage.txt new file mode 100644 index 00000000..b3674cb2 --- /dev/null +++ b/packaging/coverage.txt @@ -0,0 +1,14 @@ +How to analyze coverage: +1. read HACKING file. +2. gbs build adding --define '_with_coverage 1' +3. take *.o and *.gcno files from compilation (<gbs-build-root>/home/abuild/rpmbuild/BUILD/dbus-1.10.6/dbus/.libs) into a /safe/place + you may also use generated rpm package dbus-coverage-objects. +4. install coverage package (dbus-coverage) on the target +5. run test programs adding LD_LIBRARY_PATH=/usr/lib/dbus-tests/coverage-libs + Data gathering is cumulative, so you can run multiple programs one after another. + Use GCOV_PREFIX and GCOV_PREFIX_STRIP environment variables to set output directory. + If not set, data files (*.gcda) will be generated in /home/abuild/rpmbuild/BUILD/dbus-1.10.6 +6. download generated gcda files from the target to /safe/place +7. put source code *.c files together with object files into a /safe/place +8. run gcov /safe/place/*.o + or gcov -r /safe/place/*.o for only local source code output diff --git a/packaging/dbus.spec b/packaging/dbus.spec index a468e265..afaad50d 100644 --- a/packaging/dbus.spec +++ b/packaging/dbus.spec @@ -2,6 +2,7 @@ %bcond_with kdbus %bcond_with dbuspolicy +%bcond_with coverage Name: dbus Url: http://dbus.freedesktop.org/ @@ -82,6 +83,24 @@ Summary: Package with binaries and data for dbus tests %description tests This package contains installable tests. Tests are compatible with 'dbus-integration-tests' framework. +%if %{with coverage} +%package coverage +Summary: Special version of dbus library for getting coverage analysis + +%description coverage +Special version of dbus library for getting coverage analysis. *.gcda coverage files +are generated on each use of library in directory set by GCOV_PREFIX and GCOV_PREFIX_STRIP. +Use the library by modifying LD_LIBRARY_PATH. +This package is intended for debug/test use only. + +%package coverage-objects +Summary: Generated object files and gcov notes for coverage analysis + +%description coverage-objects +We need to keep objects and gcno files to analyze coverage. +This package is intended for debug/test use only. +%endif + %prep # COMMON2-BEGIN %setup -n dbus-%{version} -q @@ -96,6 +115,47 @@ export CXXFLAGS="${RPM_OPT_FLAGS} -fno-strict-aliasing" export CFLAGS="$CFLAGS -fstack-protector" export CXXFLAGS="$CXXFLAGS -fstack-protector" export V=1 + +# Support for generating separate packages with libraries generating coverage files +# WARNING: if coverage build is enabled, incremental builds will not work correctly. +# Use the option only to generate dbus-coverage packages. +%if %{with coverage} +%reconfigure \ + --disable-static \ + --with-pic \ + --with-dbus-user=dbus \ + --libexecdir=%{_libdir}/%{name} \ + --libdir=%{_libdir} \ + --with-init-scripts=suse \ + --enable-inotify \ + --disable-doxygen-docs \ + --disable-xml-docs \ +%if %{with_systemd} + --enable-systemd \ +%endif +%if %{with kdbus} + --enable-kdbus-transport \ +%if %{with dbuspolicy} + --enable-libdbuspolicy \ +%endif +%endif + --with-system-pid-file=/tmp/dbus_launch \ + --with-console-auth-dir=/var/run/dbus/at_console/ \ + --with-systemdsystemunitdir=%{_unitdir} \ + --enable-smack \ + --enable-cynara \ + --enable-modular-tests \ + --enable-installed-tests \ + --enable-compiler-coverage +make %{?_smp_mflags} +mkdir coverage +cp dbus/.libs/libdbus-1.so.3 coverage +mkdir coverage-objects +find dbus -name '*.o' -exec cp '{}' coverage-objects ';' +find dbus -name '*.gcno' -exec cp '{}' coverage-objects ';' + +%endif + %reconfigure \ --disable-static \ --with-pic \ @@ -160,13 +220,25 @@ install -m 0644 %{SOURCE7} %{buildroot}%{_sysconfdir}/profile.d/dbus.sh rm -rf %{buildroot}%{_datadir}/doc # build test binaries and copy test data -mkdir -p %{buildroot}/usr/lib/dbus-tests/test-suites/dbus-tests/ -mkdir -p %{buildroot}/usr/lib/dbus-tests/runner/ -%__cc %{_builddir}/%{name}-%{version}/test-runner.c -o %{buildroot}/usr/lib/dbus-tests/runner/dbus-tests -cp -fr %{buildroot}%{_libdir}/dbus/installed-tests/dbus/* %{buildroot}/usr/lib/dbus-tests/test-suites/dbus-tests/ +%define relative_dbus_tests_base_dir %{_prefix}/lib/dbus-tests +%define dbus_tests_base_dir %{buildroot}%{relative_dbus_tests_base_dir} +mkdir -p %{dbus_tests_base_dir}/test-suites/dbus-tests/ + +mkdir -p %{dbus_tests_base_dir}/runner/ +%__cc %{_builddir}/%{name}-%{version}/test-runner.c -o %{dbus_tests_base_dir}/runner/dbus-tests +cp -fr %{buildroot}%{_libdir}/dbus/installed-tests/dbus/* %{dbus_tests_base_dir}/test-suites/dbus-tests/ rm -fr %{buildroot}%{_libdir}/dbus/installed-tests/dbus rm -fr %{buildroot}/usr/share/installed-tests/dbus +%if %{with coverage} +%define relative_cov_lib_dir %{relative_dbus_tests_base_dir}/coverage-libs +%define cov_lib_dir %{buildroot}%{relative_cov_lib_dir} +mkdir -p %{cov_lib_dir} +mkdir -p %{cov_lib_dir}/objects +install -m 0755 coverage/* %{cov_lib_dir} +install -m 0644 coverage-objects/* %{cov_lib_dir}/objects +%endif + %pre # Add the "dbus" user and group /usr/sbin/groupadd -r -g %{dbus_user_uid} dbus 2>/dev/null || : @@ -246,4 +318,11 @@ rm -fr %{buildroot}/usr/share/installed-tests/dbus %{_prefix}/lib/dbus-tests/test-suites/dbus-tests %{_prefix}/lib/dbus-tests/runner/dbus-tests +%if %{with coverage} +%files coverage +%{relative_cov_lib_dir}/* +%files coverage-objects +%{relative_cov_lib_dir}/objects/* +%endif + %changelog |