Commit b4505894 authored by Tomas Krizek's avatar Tomas Krizek

meson: remove remaining makefiles

parent 59f82eaa
# Measure code coverage using luacov and gcov
# C and Lua code is measured separately and resutls are combined together
# Define COVERAGE=1 during build *and* test runs to enable measurement.
# Beware: Tests are typically run in parallel and neither luacov not gcov
# support that, so we have to store results from each run separatelly
# and combine them.
@# combine trees of gcda files into one info file per tree
@mkdir -p '$(COVERAGE_STATSDIR)/tmp.c'
coverage-c: coverage-c-combine-gcda
@# combine info files for each tree into resulting file
@$(LCOV) -q $(addprefix --add-tracefile ,$(wildcard $(COVERAGE_STATSDIR)/tmp.c/*.info)) --output-file '$(COVERAGE_STAGE)'
@$(RM) -r '$(COVERAGE_STATSDIR)/tmp.c'
LUA_STATS_OUT := $(shell find '$(COVERAGE_STATSDIR)' -type f -name 'luacov.stats.out' 2> /dev/null)
LUA_INFOS_OUT := $(patsubst %.stats.out,,$(LUA_STATS_OUT))
coverage-lua-fix-paths: $(LUA_STATS_OUT)
@# map Lua install paths to source paths
@$(MAKE) PREFIX=$(PREFIX) install --dry-run --always-make | scripts/map_install_src.lua --sed > .luacov_path_map
@sed -i -f .luacov_path_map $^
@$(RM) .luacov_path_map
@# generate list of all Lua files to fill holes in luacov stats
@$(MAKE) PREFIX=$(PREFIX) install --dry-run --always-make | scripts/map_install_src.lua | cut -f 2 | grep '\.lua$$' | scripts/ > luacov.empty_stats.out %.stats.out coverage-lua-fix-paths
@scripts/luacov_to_info.lua $*.stats.out > $@
coverage-lua: $(LUA_INFOS_OUT) luacov.empty_stats.out
@echo '# Lua coverage in $(COVERAGE_STAGE)'
@# add missing files to luacov stats
@scripts/luacov_to_info.lua luacov.empty_stats.out >
@# combine info files for each tree into resulting file
@$(LCOV) -q $(addprefix --add-tracefile ,$(LUA_INFOS_OUT)) --add-tracefile --output-file '$(COVERAGE_STAGE)'
@$(RM) luacov.empty_stats.out
@$(LCOV) $(addprefix --add-tracefile ,$(wildcard $(COVERAGE_STAGE)*.info)) --output-file
@$(GENHTML) --no-function-coverage --no-branch-coverage -q -o coverage -p '$(realpath $(CURDIR))' -t 'Knot Resolver $(VERSION)-$(PLATFORM) coverage report' --legend
.PHONY: coverage-c-combine-gcda coverage-c coverage-lua-fix-paths coverage-lua coverage coverage-clean
# Options
BUILD_CFLAGS += --coverage
# Unit tests
tests_BIN := \
test_array \
test_lru \
test_map \
test_module \
test_pack \
test_queue \
test_rplan \
test_set \
test_trie \
test_utils \
test_zonecut \
#test_cache TODO: re-consider how best to test cache
mock_cmodule_CFLAGS := -fPIC
mock_cmodule_SOURCES := tests/mock_cmodule.c
$(eval $(call make_lib,mock_cmodule,tests))
# Dependencies
tests_DEPEND := $(libkres) $(mock_cmodule) $(mock_gomodule)
tests_LIBS := $(libkres_TARGET) $(libkres_LIBS) $(cmocka_LIBS) $(lmdb_LIBS)
# Make test binaries
define make_test
$(1)_CFLAGS := -fPIE
$(1)_SOURCES := tests/$(1).c
$(1)_LIBS := $(tests_LIBS)
$(1)_DEPEND := $(tests_DEPEND)
$(call make_bin,$(1),tests)
$(1): $$($(1))
$(shell ./scripts/ "$(TOPSRCDIR)" "$(COVERAGE_STATSDIR)/tests_unit" "$(1)") $(preload_syms) $(DEBUGGER) $$<
.PHONY: $(1)
# Targets
$(foreach test,$(tests_BIN),$(eval $(call make_test,$(test))))
check-unit: $(foreach test,$(tests_BIN),$(test))
.PHONY: check-unit
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment