chiark / gitweb /
Add test coverage and generate report with lcov
[elogind.git] / Makefile.am
index 70da1e4a2c315242d24d993b6230c15e97282afc..9105274c0da0101720d4506db7e9d08aad3c8948 100644 (file)
@@ -32,16 +32,16 @@ SUBDIRS = . po
 .SECONDARY:
 
 LIBUDEV_CURRENT=4
-LIBUDEV_REVISION=5
+LIBUDEV_REVISION=6
 LIBUDEV_AGE=3
 
 LIBGUDEV_CURRENT=1
 LIBGUDEV_REVISION=3
 LIBGUDEV_AGE=1
 
-LIBSYSTEMD_LOGIN_CURRENT=7
-LIBSYSTEMD_LOGIN_REVISION=1
-LIBSYSTEMD_LOGIN_AGE=7
+LIBSYSTEMD_LOGIN_CURRENT=8
+LIBSYSTEMD_LOGIN_REVISION=0
+LIBSYSTEMD_LOGIN_AGE=8
 
 LIBSYSTEMD_DAEMON_CURRENT=0
 LIBSYSTEMD_DAEMON_REVISION=10
@@ -51,9 +51,9 @@ LIBSYSTEMD_ID128_CURRENT=0
 LIBSYSTEMD_ID128_REVISION=23
 LIBSYSTEMD_ID128_AGE=0
 
-LIBSYSTEMD_JOURNAL_CURRENT=10
-LIBSYSTEMD_JOURNAL_REVISION=2
-LIBSYSTEMD_JOURNAL_AGE=10
+LIBSYSTEMD_JOURNAL_CURRENT=11
+LIBSYSTEMD_JOURNAL_REVISION=0
+LIBSYSTEMD_JOURNAL_AGE=11
 
 # Dirs of external packages
 dbuspolicydir=@dbuspolicydir@
@@ -65,7 +65,7 @@ pkgconfigdatadir=$(datadir)/pkgconfig
 pkgconfiglibdir=$(libdir)/pkgconfig
 polkitpolicydir=$(datadir)/polkit-1/actions
 bashcompletiondir=@bashcompletiondir@
-rpmmacrosdir=$(sysconfdir)/rpm
+rpmmacrosdir=$(prefix)/lib/rpm/macros.d
 sysvinitdir=$(SYSTEM_SYSVINIT_PATH)
 sysvrcnddir=$(SYSTEM_SYSVRCND_PATH)
 varlogdir=$(localstatedir)/log
@@ -174,6 +174,7 @@ AM_CPPFLAGS = \
        -I $(top_srcdir)/src/core \
        -I $(top_srcdir)/src/libudev \
        -I $(top_srcdir)/src/udev \
+       -I $(top_builddir)/src/udev \
        -I $(top_srcdir)/src/libsystemd-bus \
        $(OUR_CPPFLAGS)
 
@@ -222,6 +223,7 @@ install-target-wants-hook:
        what="$(SYSINIT_TARGET_WANTS)" && wants=sysinit.target && $(add-wants)
        what="$(SOCKETS_TARGET_WANTS)" && wants=sockets.target && $(add-wants)
        what="$(TIMERS_TARGET_WANTS)" && wants=timers.target && $(add-wants)
+       what="$(SLICES_TARGET_WANTS)" && wants=slices.target && $(add-wants)
 
 define add-wants
        [ -z "$$what" ] || ( \
@@ -289,7 +291,8 @@ bin_PROGRAMS = \
        systemd-nspawn \
        systemd-detect-virt \
        systemd-delta \
-       systemd-analyze
+       systemd-analyze \
+       systemd-run
 
 dist_bin_SCRIPTS = \
        src/kernel-install/kernel-install
@@ -376,6 +379,9 @@ dist_systemunit_DATA = \
        units/paths.target \
        units/suspend.target \
        units/swap.target \
+       units/slices.target \
+       units/system.slice \
+       units/x-.slice \
        units/systemd-initctl.socket \
        units/systemd-shutdownd.socket \
        units/syslog.socket \
@@ -389,7 +395,6 @@ dist_systemunit_DATA = \
        units/sound.target \
        units/bluetooth.target \
        units/smartcard.target \
-       units/quotaon.service \
        units/systemd-ask-password-wall.path \
        units/systemd-ask-password-console.path \
        units/systemd-udevd-control.socket \
@@ -495,6 +500,17 @@ EXTRA_DIST += \
        units/rc-local.service.in \
        units/halt-local.service.in
 
+# automake is broken and can't handle files with a dash in front
+# http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14728#8
+units-install-hook:
+       mv $(DESTDIR)$(systemunitdir)/x-.slice $(DESTDIR)/$(systemunitdir)/-.slice
+
+units-uninstall-hook:
+       rm -f $(DESTDIR)/$(systemunitdir)/-.slice
+
+INSTALL_DATA_HOOKS += units-install-hook
+UNINSTALL_DATA_HOOKS += units-uninstall-hook
+
 dist_doc_DATA = \
        README \
        NEWS \
@@ -512,6 +528,9 @@ MANPAGES_ALIAS =
 
 include Makefile-man.am
 
+.PHONY: man
+man: $(MANPAGES) $(MANPAGES_ALIAS) $(HTML_FILES) $(HTML_ALIAS)
+
 XML_FILES = \
        ${patsubst %.1,%.xml,${patsubst %.3,%.xml,${patsubst %.5,%.xml,${patsubst %.7,%.xml,${patsubst %.8,%.xml,$(MANPAGES)}}}}}
 HTML_FILES = \
@@ -841,6 +860,10 @@ libsystemd_core_la_SOURCES = \
        src/core/timer.h \
        src/core/path.c \
        src/core/path.h \
+       src/core/slice.c \
+       src/core/slice.h \
+       src/core/scope.c \
+       src/core/scope.h \
        src/core/load-dropin.c \
        src/core/load-dropin.h \
        src/core/execute.c \
@@ -873,12 +896,18 @@ libsystemd_core_la_SOURCES = \
        src/core/dbus-snapshot.h \
        src/core/dbus-device.c \
        src/core/dbus-device.h \
+       src/core/dbus-path.c \
+       src/core/dbus-path.h \
+       src/core/dbus-slice.c \
+       src/core/dbus-slice.h \
+       src/core/dbus-scope.c \
+       src/core/dbus-scope.h \
        src/core/dbus-execute.c \
        src/core/dbus-execute.h \
        src/core/dbus-kill.c \
        src/core/dbus-kill.h \
-       src/core/dbus-path.c \
-       src/core/dbus-path.h \
+       src/core/dbus-cgroup.c \
+       src/core/dbus-cgroup.h \
        src/core/cgroup.c \
        src/core/cgroup.h \
        src/core/selinux-access.c \
@@ -905,10 +934,6 @@ libsystemd_core_la_SOURCES = \
        src/core/namespace.h \
        src/core/tcpwrap.c \
        src/core/tcpwrap.h \
-       src/core/cgroup-attr.c \
-       src/core/cgroup-attr.h \
-       src/core/cgroup-semantics.c \
-       src/core/cgroup-semantics.h \
        src/core/securebits.h \
        src/core/initreq.h \
        src/core/special.h \
@@ -1090,7 +1115,9 @@ tests += \
        test-prioq \
        test-fileio \
        test-time \
-       test-hashmap
+       test-hashmap \
+       test-list \
+       test-tables
 
 EXTRA_DIST += \
        test/sched_idle_bad.service \
@@ -1128,6 +1155,10 @@ test_ns_SOURCES = \
 test_ns_LDADD = \
        libsystemd-core.la
 
+test_ns_CFLAGS = \
+       $(AM_CFLAGS) \
+       $(DBUS_CFLAGS)
+
 test_loopback_SOURCES = \
        src/test/test-loopback.c
 
@@ -1190,6 +1221,27 @@ test_hashmap_CFLAGS = \
 test_hashmap_LDADD = \
        libsystemd-core.la
 
+test_list_SOURCES = \
+       src/test/test-list.c
+
+test_list_CFLAGS = \
+       $(AM_CFLAGS)
+
+test_list_LDADD = \
+       libsystemd-core.la
+
+test_tables_SOURCES = \
+       src/test/test-tables.c \
+       src/shared/test-tables.h
+
+test_tables_CFLAGS = \
+       $(AM_CFLAGS) \
+       $(DBUS_CFLAGS)
+
+test_tables_LDADD = \
+       libsystemd-core.la \
+       libsystemd-logs.la
+
 test_prioq_SOURCES = \
        src/test/test-prioq.c
 
@@ -1337,6 +1389,44 @@ test_sched_prio_LDADD = \
        libsystemd-core.la \
        libsystemd-daemon.la
 
+# ------------------------------------------------------------------------------
+## .PHONY so it always rebuilds it
+.PHONY: coverage lcov-run lcov-report
+
+# run lcov from scratch, always
+coverage:
+       $(MAKE) lcov-run
+       $(MAKE) lcov-report
+
+coverage_dir = coverage
+coverage_opts = --base-directory $(srcdir) --directory $(builddir) --rc 'geninfo_adjust_src_path=$(abspath $(srcdir))=>$(abspath $(builddir))'
+
+if ENABLE_COVERAGE
+# reset run coverage tests
+lcov-run:
+       @rm -rf $(coverage_dir)
+       lcov $(coverage_opts) --zerocounters
+       -$(MAKE) check
+
+# generate report based on current coverage data
+lcov-report:
+       $(MKDIR_P) $(coverage_dir)
+       lcov $(coverage_opts) --compat-libtool --capture --no-external \
+               | sed 's|$(abspath $(builddir))|$(abspath $(srcdir))|' > $(coverage_dir)/.lcov.info
+       genhtml -t "systemd test coverage" -o $(coverage_dir) $(coverage_dir)/.lcov.info
+       @echo "Coverage report generated in $(abs_builddir)/$(coverage_dir)/index.html"
+
+# lcov doesn't work properly with vpath builds, make sure that bad
+# output is not uploaded by mistake.
+coverage-sync: coverage
+       test "$(builddir)" = "$(srcdir)"
+       rsync -rlv --delete --omit-dir-times coverage/ $(www_target)/coverage
+
+else
+lcov-run lcov-report:
+       echo "Need to reconfigure with --enable-coverage"
+endif
+
 # ------------------------------------------------------------------------------
 systemd_initctl_SOURCES = \
        src/initctl/initctl.c
@@ -1413,10 +1503,18 @@ nodist_systemunit_DATA += \
 SYSINIT_TARGET_WANTS += \
        systemd-modules-load.service
 
+if ENABLE_TMPFILES
+nodist_systemunit_DATA += \
+       units/kmod-static-nodes.service
+
+SYSINIT_TARGET_WANTS += \
+       kmod-static-nodes.service
+endif
 endif
 
 EXTRA_DIST += \
-       units/systemd-modules-load.service.in
+        units/systemd-modules-load.service.in \
+        units/kmod-static-nodes.service.in
 
 # ------------------------------------------------------------------------------
 if ENABLE_TMPFILES
@@ -1690,7 +1788,20 @@ systemd_nspawn_LDADD = \
        libsystemd-capability.la \
        libsystemd-shared.la \
        libsystemd-daemon.la \
-       libsystemd-id128-internal.la
+       libsystemd-id128-internal.la \
+       libsystemd-bus.la
+
+# ------------------------------------------------------------------------------
+systemd_run_SOURCES = \
+       src/run/run.c
+
+systemd_run_LDADD = \
+       libsystemd-label.la \
+       libsystemd-capability.la \
+       libsystemd-shared.la \
+       libsystemd-daemon.la \
+       libsystemd-id128-internal.la \
+       libsystemd-bus.la
 
 # ------------------------------------------------------------------------------
 systemd_stdio_bridge_SOURCES = \
@@ -1963,6 +2074,7 @@ libudev_la_LDFLAGS = \
 
 libudev_la_LIBADD = \
        libsystemd-shared.la \
+       libsystemd-label.la \
        libsystemd-daemon-internal.la \
        libsystemd-id128-internal.la
 
@@ -2021,6 +2133,7 @@ dist_udevrules_DATA += \
        rules/99-systemd.rules \
        rules/42-usb-hid-pm.rules \
        rules/50-udev-default.rules \
+       rules/60-keyboard.rules \
        rules/60-persistent-storage-tape.rules \
        rules/60-persistent-serial.rules \
        rules/60-persistent-input.rules \
@@ -2084,6 +2197,19 @@ rootlibexec_PROGRAMS += \
 noinst_LTLIBRARIES += \
        libudev-core.la
 
+src/udev/keyboard-keys.txt: Makefile
+       $(AM_V_at)$(MKDIR_P) $(dir $@)
+       $(AM_V_GEN)$(CPP) $(CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) -dM -include linux/input.h - < /dev/null | $(AWK) '/^#define[ \t]+KEY_[^ ]+[ \t]+[0-9]/ { if ($$2 != "KEY_MAX") { print $$2 } }' | sed 's/^KEY_COFFEE$$/KEY_SCREENLOCK/' > $@
+
+src/udev/keyboard-keys-from-name.gperf: src/udev/keyboard-keys.txt Makefile
+       $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct key { const char* name; unsigned short id; };"; print "%null-strings"; print "%%";} { print tolower(substr($$1 ,5)) ", " $$1 }' < $< > $@
+
+src/udev/keyboard-keys-from-name.h: src/udev/keyboard-keys-from-name.gperf Makefile
+       $(AM_V_GPERF)$(GPERF) -L ANSI-C -t -N keyboard_lookup_key -H hash_key_name -p -C < $< > $@
+
+src/udev/keyboard-keys-to-name.h: src/udev/keyboard-keys.txt Makefile
+       $(AM_V_GEN)$(AWK) 'BEGIN{ print "const char* const key_names[KEY_CNT] = { "} { print "[" $$1 "] = \"" $$1 "\"," } END{print "};"}' < $< > $@
+
 libudev_core_la_SOURCES = \
        src/udev/udev.h \
        src/udev/udev-event.c \
@@ -2095,10 +2221,22 @@ libudev_core_la_SOURCES = \
        src/udev/udev-builtin-btrfs.c \
        src/udev/udev-builtin-hwdb.c \
        src/udev/udev-builtin-input_id.c \
+       src/udev/udev-builtin-keyboard.c \
        src/udev/udev-builtin-net_id.c \
        src/udev/udev-builtin-path_id.c \
        src/udev/udev-builtin-usb_id.c
 
+nodist_libudev_core_la_SOURCES = \
+       src/udev/keyboard-keys-from-name.h \
+       src/udev/keyboard-keys-to-name.h
+
+BUILT_SOURCES += \
+       $(nodist_libudev_core_la_SOURCES)
+
+CLEANFILES += \
+       src/udev/keyboard-keys-from-name.gperf \
+       src/udev/keyboard-keys.txt
+
 libudev_core_la_CFLAGS = \
        $(AM_CFLAGS) \
        $(BLKID_CFLAGS) \
@@ -2550,7 +2688,6 @@ dist_udevkeymap_DATA = \
        keymaps/medion-fid2060 \
        keymaps/medionnb-a555 \
        keymaps/micro-star \
-       keymaps/module-asus-w3j \
        keymaps/module-ibm \
        keymaps/module-lenovo \
        keymaps/module-sony \
@@ -2562,6 +2699,7 @@ dist_udevkeymap_DATA = \
        keymaps/oqo-model2 \
        keymaps/samsung-other \
        keymaps/samsung-series-9 \
+       keymaps/samsung-series-3 \
        keymaps/samsung-sq1us \
        keymaps/samsung-sx20s \
        keymaps/toshiba-satellite_a100 \
@@ -2576,6 +2714,7 @@ dist_udevkeymapforcerel_DATA = \
        keymaps-force-release/hp-other \
        keymaps-force-release/samsung-other \
        keymaps-force-release/samsung-series-9 \
+       keymaps-force-release/samsung-series-3 \
        keymaps-force-release/common-volume-keys
 
 src/udev/keymap/keys.txt: Makefile
@@ -2626,6 +2765,7 @@ libsystemd_id128_la_LDFLAGS = \
 
 libsystemd_id128_la_LIBADD = \
        libsystemd-shared.la \
+       libsystemd-label.la \
        libsystemd-daemon-internal.la
 
 libsystemd_id128_internal_la_SOURCES = \
@@ -2781,6 +2921,14 @@ test_journal_verify_LDADD = \
        libsystemd-journal-internal.la \
        libsystemd-id128-internal.la
 
+test_journal_interleaving_SOURCES = \
+       src/journal/test-journal-interleaving.c
+
+test_journal_interleaving_LDADD = \
+       libsystemd-shared.la \
+       libsystemd-journal-internal.la \
+       libsystemd-id128-internal.la
+
 test_mmap_cache_SOURCES = \
        src/journal/test-mmap-cache.c
 
@@ -2956,6 +3104,7 @@ tests += \
        test-journal-match \
        test-journal-stream \
        test-journal-verify \
+       test-journal-interleaving \
        test-mmap-cache \
        test-catalog
 
@@ -3516,11 +3665,117 @@ lib_LTLIBRARIES += \
        libnss_myhostname.la
 endif
 
+# ------------------------------------------------------------------------------
+if ENABLE_MACHINED
+systemd_machined_SOURCES = \
+       src/machine/machined.c \
+       src/machine/machined.h
+
+systemd_machined_CFLAGS = \
+       $(libsystemd_machine_core_la_CFLAGS)
+
+systemd_machined_LDADD = \
+       libsystemd-machine-core.la \
+       $(libsystemd_machine_core_la_LIBADD)
+
+rootlibexec_PROGRAMS += \
+       systemd-machined
+
+libsystemd_machine_core_la_SOURCES = \
+       src/machine/machined-dbus.c \
+       src/machine/machine.c \
+       src/machine/machine.h \
+       src/machine/machine-dbus.c
+
+libsystemd_machine_core_la_CFLAGS = \
+       $(AM_CFLAGS) \
+       $(DBUS_CFLAGS)
+
+libsystemd_machine_core_la_LIBADD = \
+       libsystemd-label.la \
+       libsystemd-audit.la \
+       libsystemd-shared.la \
+       libsystemd-daemon.la \
+       libsystemd-dbus.la \
+       libsystemd-id128-internal.la \
+       libudev.la
+
+noinst_LTLIBRARIES += \
+       libsystemd-machine-core.la
+
+machinectl_SOURCES = \
+       src/machine/machinectl.c
+
+machinectl_CFLAGS = \
+       $(AM_CFLAGS) \
+       $(DBUS_CFLAGS)
+
+machinectl_LDADD = \
+       libsystemd-shared.la \
+       libsystemd-dbus.la \
+       libudev.la
+
+rootbin_PROGRAMS += \
+       machinectl
+
+test_machine_tables_SOURCES = \
+       src/machine/test-machine-tables.c
+
+test_machine_tables_CFLAGS = \
+       $(AM_CFLAGS) \
+       $(DBUS_CFLAGS)
+
+test_machine_tables_LDADD = \
+       libsystemd-machine-core.la
+
+tests += \
+       test-machine-tables
+
+nodist_systemunit_DATA += \
+       units/systemd-machined.service
+
+dist_systemunit_DATA += \
+       units/machine.slice
+
+dist_dbussystemservice_DATA += \
+       src/machine/org.freedesktop.machine1.service
+
+dist_dbuspolicy_DATA += \
+       src/machine/org.freedesktop.machine1.conf
+
+SYSTEM_UNIT_ALIASES += \
+       systemd-machined.service dbus-org.freedesktop.machine1.service
+
+EXTRA_DIST += \
+       units/systemd-machined.service.in
+
+endif
+
 # ------------------------------------------------------------------------------
 if ENABLE_LOGIND
 systemd_logind_SOURCES = \
        src/login/logind.c \
-       src/login/logind.h \
+       src/login/logind.h
+
+nodist_systemd_logind_SOURCES = \
+       src/login/logind-gperf.c
+
+systemd_logind_CFLAGS = \
+       $(libsystemd_logind_core_la_CFLAGS)
+
+systemd_logind_LDADD = \
+       libsystemd-logind-core.la \
+       $(libsystemd_logind_core_la_LIBADD)
+
+if HAVE_ACL
+systemd_logind_SOURCES += \
+       src/login/logind-acl.c
+
+systemd_logind_LDADD += \
+       libsystemd-acl.la
+endif
+
+libsystemd_logind_core_la_SOURCES = \
        src/login/logind-dbus.c \
        src/login/logind-device.c \
        src/login/logind-device.h \
@@ -3541,28 +3796,21 @@ systemd_logind_SOURCES = \
        src/login/logind-user-dbus.c \
        src/login/logind-acl.h
 
-nodist_systemd_logind_SOURCES = \
-       src/login/logind-gperf.c
-
-systemd_logind_CFLAGS = \
+libsystemd_logind_core_la_CFLAGS = \
        $(AM_CFLAGS) \
-       $(DBUS_CFLAGS)
+        $(DBUS_CFLAGS)
 
-systemd_logind_LDADD = \
+libsystemd_logind_core_la_LIBADD = \
        libsystemd-label.la \
        libsystemd-audit.la \
        libsystemd-shared.la \
        libsystemd-daemon.la \
        libsystemd-dbus.la \
+       libsystemd-id128-internal.la \
        libudev.la
 
-if HAVE_ACL
-systemd_logind_SOURCES += \
-       src/login/logind-acl.c
-
-systemd_logind_LDADD += \
-       libsystemd-acl.la
-endif
+noinst_LTLIBRARIES += \
+       libsystemd-logind-core.la
 
 systemd_user_sessions_SOURCES = \
        src/login/user-sessions.c
@@ -3625,10 +3873,23 @@ test_inhibit_CFLAGS = \
        $(AM_CFLAGS) \
        $(DBUS_CFLAGS)
 
+test_login_tables_SOURCES = \
+       src/login/test-login-tables.c
+
+test_login_tables_CFLAGS = \
+       $(AM_CFLAGS) \
+       $(DBUS_CFLAGS)
+
+test_login_tables_LDADD = \
+       libsystemd-logind-core.la
+
 manual_tests += \
        test-login \
        test-inhibit
 
+tests += \
+       test-login-tables
+
 libsystemd_login_la_SOURCES = \
        src/login/sd-login.c
 
@@ -3691,6 +3952,9 @@ nodist_systemunit_DATA += \
        units/systemd-logind.service \
        units/systemd-user-sessions.service
 
+dist_systemunit_DATA += \
+       units/user.slice
+
 dist_dbussystemservice_DATA += \
        src/login/org.freedesktop.login1.service
 
@@ -3946,6 +4210,8 @@ substitutions = \
        '|SUSHELL=$(SUSHELL)|' \
        '|DEBUGTTY=$(DEBUGTTY)|' \
        '|KILL=$(KILL)|' \
+       '|KMOD=$(KMOD)|' \
+       '|MKDIR_P=$(MKDIR_P)|' \
        '|QUOTAON=$(QUOTAON)|' \
        '|QUOTACHECK=$(QUOTACHECK)|' \
        '|SYSTEM_SYSVINIT_PATH=$(sysvinitdir)|' \