conf.d/display-manager.service.conf
sbin_PROGRAMS = faultd
-faultd_SOURCES = \
+
+faultdlib_SOURCES = \
src/action/action_executed_handler.c \
src/action/action_executor.c \
src/core/action.c \
src/event_types/service_failed_event.c \
src/event_types/faultd_started_event.c \
src/event_types/system_booted_event.c \
- src/faultd.c \
src/util/common.c \
src/util/log.c \
src/util/notify_queue.c \
src/util/systemd_dbus.c
if GLIB_MAINLOOP
-faultd_SOURCES += src/core/faultd-glib.c
+faultdlib_SOURCES += src/core/faultd-glib.c
endif
+faultd_SOURCES = \
+ $(faultdlib_SOURCES) \
+ src/faultd.c
+
# Add here source files of modules that must have ability to enable/disable during build
# This variable is parsed by Autoconf
EXTRA_faultd_SOURCES = \
test_LDFLAGS = -ldl
-test_LDADD = $(CMOCKA_LIBS) $(LIBSYSTEMD_LIBS) $(AUDIT_LIBS) \
- $(LIBEJDB_LIBS) $(JSON_C_LIBS)
+test_LDADD = \
+ $(faultd_LDADD) \
+ $(CMOCKA_LIBS) \
+ $(AUDIT_LIBS) \
+ $(LIBEJDB_LIBS)
test_CFLAGS = -I${top_srcdir}/src/util \
-D"FAULTD_MODNAME_T=$(call name_fix,$(modname))" \
- -DTEST_BUILD
+ -DTEST_BUILD \
+ --coverage
test_SOURCES = \
tests/unit/ejdb_tests.c \
tests/unit/runner.c \
tests/unit/helpers.c \
tests/unit/test_dbadapter.c \
- src/core/event.c \
- src/core/database.c \
- src/core/service.c \
- src/core/module.c \
- src/core/faultd-config.c \
- src/util/systemd_dbus.c \
- src/util/log.c \
- src/util/common.c \
- src/util/json-config.c \
- src/database/ejdb.c \
- src/event_types/action_executed_event.c \
- src/event_types/decision_made_event.c \
- src/event_types/faultd_started_event.c \
- src/event_types/resource_violation_event.c \
- src/event_types/service_failed_event.c \
- src/event_types/system_booted_event.c
+ $(faultdlib_SOURCES) \
+ $(EXTRA_faultd_SOURCES)
-TESTS = $(check_PROGRAMS)
+TESTS = $(check_PROGRAMS) tests/generate_coverage.sh
endif
generatorsdir = $(prefix)/lib/systemd/system-generators
--- /dev/null
+#!/bin/sh
+
+echo -e "\nCALCULATING TEST COVERAGE...\n"
+
+report=`find src -name "*.gcno" -print0 | xargs -0 gcov -r`
+final_percentage=`echo "$report" | tail -1 | cut -d ":" -f 2`
+
+echo "$report" | sed '$ d' | grep -v 'Creating'
+echo -e "TOTAL COVERAGE: $final_percentage lines were executed\n"