Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile20
1 files changed, 18 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 708bec7..b3e32a0 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-SHELL=/bin/bash
+SHELL=/bin/bash -o pipefail
V=1.1.1
BUILDTOOLVER ?= $(V)
@@ -52,6 +52,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
binprogs: $(BINPROGS)
library: $(LIBRARY)
@@ -168,8 +175,17 @@ dist:
git archive --format=tar --prefix=devtools-$(V)/ v$(V) | gzip > devtools-$(V).tar.gz
gpg --detach-sign --use-agent devtools-$(V).tar.gz
+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: