e7f9616b39
The new test system is written with py.test. These tests are more comprehensive, run faster by an order of magnitude, and are far more maintainable. The tests themselves conform to PEP8.
75 lines
1.7 KiB
Makefile
75 lines
1.7 KiB
Makefile
.PHONY: all
|
|
all: yadm.md contrib
|
|
|
|
yadm.md: yadm.1
|
|
@groff -man -Tascii ./yadm.1 | col -bx | sed 's/^[A-Z]/## &/g' | sed '/yadm(1)/d' > yadm.md
|
|
|
|
.PHONY: contrib
|
|
contrib:
|
|
@echo "CONTRIBUTORS\n" > CONTRIBUTORS
|
|
@git shortlog -ns master gh-pages dev dev-pages | cut -f2 >> CONTRIBUTORS
|
|
|
|
.PHONY: pdf
|
|
pdf:
|
|
@groff -man -Tps ./yadm.1 > yadm.ps
|
|
@open yadm.ps
|
|
@sleep 1
|
|
@rm yadm.ps
|
|
|
|
.PHONY: test
|
|
test: bats shellcheck
|
|
|
|
.PHONY: parallel
|
|
parallel:
|
|
ls test/*bats | time parallel -q -P0 -- docker run --rm -v "$$PWD:/yadm:ro" yadm/testbed bash -c 'bats {}'
|
|
|
|
.PHONY: pytest
|
|
pytest:
|
|
@echo Running all pytest tests
|
|
@pytest -v
|
|
|
|
.PHONY: bats
|
|
bats:
|
|
@echo Running all bats tests
|
|
@GPG_AGENT_INFO= bats test
|
|
|
|
.PHONY: shellcheck
|
|
shellcheck:
|
|
@echo Running shellcheck
|
|
@shellcheck --version || true
|
|
@shellcheck -s bash yadm bootstrap test/*.bash completion/yadm.bash_completion
|
|
@cd test; \
|
|
for bats_file in *bats; do \
|
|
sed 's/^@test.*{/function test() {/' "$$bats_file" > "/tmp/$$bats_file.bash"; \
|
|
shellcheck -s bash "/tmp/$$bats_file.bash"; \
|
|
test_result="$$?"; \
|
|
rm -f "/tmp/$$bats_file.bash"; \
|
|
[ "$$test_result" -ne 0 ] && exit 1; \
|
|
done; true
|
|
|
|
.PHONY: testhost
|
|
testhost:
|
|
@target=HEAD
|
|
@rm -rf /tmp/testhost
|
|
@git show $(target):yadm > /tmp/testhost
|
|
@chmod a+x /tmp/testhost
|
|
@echo Starting testhost target=\"$$target\"
|
|
@docker run -w /root --hostname testhost --rm -it -v "/tmp/testhost:/bin/yadm:ro" yadm/testbed:latest bash
|
|
|
|
.PHONY: man
|
|
man:
|
|
groff -man -Tascii ./yadm.1 | less
|
|
|
|
.PHONY: wide
|
|
wide:
|
|
man ./yadm.1
|
|
|
|
.PHONY: sync-clock
|
|
sync-clock:
|
|
docker run --rm --privileged alpine hwclock -s
|
|
|
|
.PHONY: .env
|
|
.env:
|
|
virtualenv --python=python3 .env
|
|
.env/bin/pip3 install --upgrade pip setuptools
|
|
.env/bin/pip3 install --upgrade pytest pylint==1.9.2 flake8==3.5.0
|