|
@@ -1,14 +1,11 @@
|
|
|
# MySQL/OTP
|
|
|
#
|
|
|
# This Makefile should be complete enough for this project to be used as an
|
|
|
-## erlang.mk dependency.
|
|
|
-#
|
|
|
-# We use rebar for eunit with coverage since erlang.mk doesn't have this yet.
|
|
|
-# 'make tests' is not usable. Try 'rebar eunit' or 'make eunit-coverage'.
|
|
|
+# erlang.mk dependency.
|
|
|
#
|
|
|
# Additional targets:
|
|
|
#
|
|
|
-# - eunit-coverage: Creates doc/eunit.html with the coverage and eunit output.
|
|
|
+# - tests-report: Creates doc/eunit.html with the coverage and eunit output.
|
|
|
# - gh-pages: Generates docs and eunit reports and commits these in the
|
|
|
# gh-pages which Github publishes automatically when pushed.
|
|
|
|
|
@@ -19,19 +16,14 @@ SHELL_PATH = -pa ebin
|
|
|
|
|
|
include erlang.mk
|
|
|
|
|
|
-.PHONY: gh-pages eunit eunit-report CHANGELOG.md
|
|
|
+.PHONY: gh-pages tests-report CHANGELOG.md
|
|
|
|
|
|
CHANGELOG.md:
|
|
|
./changelog.sh > $@
|
|
|
|
|
|
-eunit:
|
|
|
- @mkdir -p .eunit
|
|
|
- @rm -f .eunit/index.html # make sure we don't get an old one if cover=false
|
|
|
- @rebar eunit | tee .eunit/output
|
|
|
-
|
|
|
# Update the local 'gh-pages' branch with pregenerated output files
|
|
|
# (trick from https://groups.google.com/forum/#!topic/github/XYxkdzxpgCo)
|
|
|
-gh-pages: docs eunit-report
|
|
|
+gh-pages: docs tests-report
|
|
|
@if [ $$(git name-rev --name-only HEAD) != master ] ; then \
|
|
|
echo "Not on master. Aborting." ; \
|
|
|
false ; \
|
|
@@ -47,16 +39,17 @@ gh-pages: docs eunit-report
|
|
|
@rm gitindex.tmp
|
|
|
@echo "Committed $$(git describe --tags) in the gh-pages branch."
|
|
|
|
|
|
-# Build eunit.html containing the coverage report and the eunit output in the
|
|
|
+# Build eunit.html containing the coverage report and the test output in the
|
|
|
# doc directory.
|
|
|
-eunit-report: eunit
|
|
|
- @(echo '<!DOCTYPE html>' ; \
|
|
|
- cat .eunit/index.html | sed 's!</body></html>!!' ; \
|
|
|
- echo '<h3>Output of <code>make eunit</code></h3><pre>' ; \
|
|
|
- sed 's/&/\&/g; s/</\</g; s/>/\>/g;' .eunit/output ; \
|
|
|
+tests-report: test_command=$(MAKE) --no-print-directory tests COVER=1 \
|
|
|
+ COVER_REPORT_DIR= EUNIT_OPTS={verbose,true}
|
|
|
+tests-report:
|
|
|
+ @rm -f cover/*.html
|
|
|
+ @$(test_command) | tee tests.output
|
|
|
+ @$(MAKE) --no-print-directory cover-report
|
|
|
+ @(cat cover/index.html | sed 's!</body></html>!!' ; \
|
|
|
+ echo '<h3>Output of <code>$(test_command)</code></h3><pre>' ; \
|
|
|
+ sed 's/&/\&/g; s/</\</g; s/>/\>/g;' tests.output ; \
|
|
|
echo '</pre>' ; \
|
|
|
- echo '<p><em>Generated using rebar and EUnit,' ; \
|
|
|
- date -u '+%d %h %Y %H:%M:%S UTC.' ; \
|
|
|
- echo '</em></p>' ; \
|
|
|
echo '</body></html>') > doc/eunit.html
|
|
|
- @cp .eunit/*.COVER.html doc/
|
|
|
+ @cp cover/*.COVER.html doc/
|