summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2024-04-21 10:18:55 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2024-04-21 10:18:55 +0200
commit2dc7a161a09518edae9e04a77fca569460d6a560 (patch)
tree5c893311826fc1ae7090352fb2f17a2d3d3a560e /Makefile
parenta1ca197bc99c2d5c2977630cc4c9dbfd5461d9c1 (diff)
parent05bea3e922aa7aec5cba3242d3f34b5c10fad24e (diff)
downloaddevtools-2dc7a161a09518edae9e04a77fca569460d6a560.tar.xz
merged with upstreamHEADmaster
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile24
1 files changed, 20 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index b468a75..46e0e6b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
V=$(shell git describe)
-SHELL=/bin/bash
+SHELL=/bin/bash -o pipefail
BUILDTOOLVER ?= $(V)
# builds with relf-referencing wildcards are not deterministic, switch of parallel builds
@@ -123,6 +123,13 @@ ARCHBUILD_LINKS = \
COMPLETIONS = $(addprefix $(BUILDDIR)/,$(patsubst %.in,%,$(wildcard contrib/completion/*/*)))
+CASES ?= test/case
+JOBS ?= $(shell nproc)
+BATS_EXTRA_ARGS ?=
+BATS_ARGS ?= --jobs $(JOBS) $(BATS_EXTRA_ARGS) --verbose-run
+COVERAGE_DIR ?= $(BUILDDIR)/coverage
+
+
all: binprogs library conf completion man configfiles
binprogs: $(BINPROGS)
library: $(LIBRARY)
@@ -223,10 +230,10 @@ $(eval $(call buildInScript,build/bin,src/,.in,755))
$(eval $(call buildInScript,build/lib,src/lib/,,644))
$(foreach completion,$(wildcard contrib/completion/*),$(eval $(call buildInScript,build/$(completion),$(completion)/,.in,444)))
-$(BUILDDIR)/doc/man/%: doc/man/%.asciidoc doc/asciidoc.conf doc/man/include/footer.asciidoc
+$(BUILDDIR)/doc/man/%: doc/man/%.asciidoc doc/man/include/footer.asciidoc
$(GEN_MSG)
@mkdir -p $(BUILDDIR)/doc/man
- @a2x --no-xmllint --asciidoc-opts="-f doc/asciidoc.conf" -d manpage -f manpage --destination-dir=$(BUILDDIR)/doc/man -a pkgdatadir=$(DATADIR) $<
+ @asciidoctor --backend=manpage --destination-dir=$(BUILDDIR)/doc/man --attribute pkgdatadir=$(DATADIR) $<
conf:
@install -d $(BUILDDIR)/makepkg.conf.d
@@ -306,8 +313,17 @@ dist:
upload:
scp devtools32-$(V).tar.gz devtools32-$(V).tar.gz.sig sources.archlinux32.org:httpdocs/sources/
+test: binprogs library conf completion man
+ @mkdir -p $(COVERAGE_DIR)
+ bats $(BATS_ARGS) $(CASES) | tee $(COVERAGE_DIR)/bats-report.xml
+
+coverage: binprogs library conf completion man
+ kcov --include-path=src $(COVERAGE_DIR) bats $(BATS_ARGS) $(CASES)
+ jq -r '. | ["Percent covered", .percent_covered], ["Covered lines", .covered_lines], ["Total lines", .total_lines], ["Percent low", .percent_low], ["Percent high", .percent_high] | @tsv' \
+ $(COVERAGE_DIR)/bats.*/coverage.json
+
check: $(BINPROGS_SRC) $(LIBRARY_SRC) contrib/completion/bash/devtools.in config/makepkg/x86_64.conf contrib/makepkg/PKGBUILD.proto
shellcheck $^
-.PHONY: all binprogs library completion conf man clean install uninstall tag dist upload check
+.PHONY: all binprogs library completion conf man clean install uninstall tag dist upload test coverage check
.DELETE_ON_ERROR: