diff options
author | Loïc Hoguin <[email protected]> | 2014-05-28 22:07:54 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2014-05-28 22:17:51 +0200 |
commit | 58b99e7f457bc056e91d2d1721cbb65fcd517afe (patch) | |
tree | 16f20657dcb4f1713ff3bfc02de875b85e7875c4 /plugins/ct.mk | |
parent | b47d3f4c3e097aa28a08f72931d2ce8c50039681 (diff) | |
download | erlang.mk-58b99e7f457bc056e91d2d1721cbb65fcd517afe.tar.gz erlang.mk-58b99e7f457bc056e91d2d1721cbb65fcd517afe.tar.bz2 erlang.mk-58b99e7f457bc056e91d2d1721cbb65fcd517afe.zip |
Cut erlang.mk into many small components
* The build.config says what gets into the generated erlang.mk.
* The default erlang.mk in the repository hasn't changed yet.
* Clean targets were separated into "clean" and "distclean".
* The "help" target was added to display some help message.
I probably broke a couple things...
Diffstat (limited to 'plugins/ct.mk')
-rw-r--r-- | plugins/ct.mk | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/plugins/ct.mk b/plugins/ct.mk new file mode 100644 index 0000000..e3e33f5 --- /dev/null +++ b/plugins/ct.mk @@ -0,0 +1,74 @@ +# Copyright (c) 2013-2014, Loïc Hoguin <[email protected]> +# This file is part of erlang.mk and subject to the terms of the ISC License. + +.PHONY: build-ct-deps build-ct-suites tests-ct clean-ct distclean-ct + +# Configuration. + +CT_OPTS ?= +CT_SUITES ?= + +TEST_ERLC_OPTS ?= +debug_info +warn_export_vars +warn_shadow_vars +warn_obsolete_guard +TEST_ERLC_OPTS += -DTEST=1 -DEXTRA=1 +'{parse_transform, eunit_autoexport}' + +# Core targets. + +tests:: tests-ct + +clean:: clean-ct + +distclean:: distclean-ct + +help:: + @printf "%s\n" "" \ + "All your common_test suites have their associated targets." \ + "A suite named http_SUITE can be ran using the ct-http target." + +# Plugin-specific targets. + +ALL_TEST_DEPS_DIRS = $(addprefix $(DEPS_DIR)/,$(TEST_DEPS)) + +CT_RUN = ct_run \ + -no_auto_compile \ + -noshell \ + -pa $(realpath ebin) $(DEPS_DIR)/*/ebin \ + -dir test \ + -logdir logs \ + $(CT_OPTS) + +$(foreach dep,$(TEST_DEPS),$(eval $(call dep_target,$(dep)))) + +build-ct-deps: $(ALL_TEST_DEPS_DIRS) + @for dep in $(ALL_TEST_DEPS_DIRS) ; do $(MAKE) -C $$dep; done + +build-ct-suites: build-ct-deps + $(gen_verbose) erlc -v $(TEST_ERLC_OPTS) -o test/ \ + $(wildcard test/*.erl test/*/*.erl) -pa ebin/ + +tests-ct: ERLC_OPTS = $(TEST_ERLC_OPTS) +tests-ct: clean deps app build-ct-suites + @if [ -d "test" ] ; \ + then \ + mkdir -p logs/ ; \ + $(CT_RUN) -suite $(addsuffix _SUITE,$(CT_SUITES)) ; \ + fi + $(gen_verbose) rm -f test/*.beam + +define ct_suite_target +ct-$(1): ERLC_OPTS = $(TEST_ERLC_OPTS) +ct-$(1): clean deps app build-tests + @if [ -d "test" ] ; \ + then \ + mkdir -p logs/ ; \ + $(CT_RUN) -suite $(addsuffix _SUITE,$(1)) ; \ + fi + $(gen_verbose) rm -f test/*.beam +endef + +$(foreach test,$(CT_SUITES),$(eval $(call ct_suite_target,$(test)))) + +clean-ct: + $(gen_verbose) rm -rf test/*.beam + +distclean-ct: + $(gen_verbose) rm -rf logs/ |