1if HAVE_TS_TOOLS
2
3include @top_srcdir@/include.mk
4
5SUITE_MODULES_BLA = $(sort $(wildcard @srcdir@/*_SUITE.erl))
6SUITE_MODULES = $(SUITE_MODULES_BLA:@srcdir@/%=%)
7
8SUITE_MODULES_DATADIR = $(wildcard @srcdir@/*_SUITE_data)
9
10SUITE_MODULES_DATADIR_MODS_BLA = $(wildcard @srcdir@/*_SUITE_data/*.erl)
11SUITE_MODULES_DATADIR_MODS = $(SUITE_MODULES_DATADIR_MODS_BLA:@srcdir@/%=%)
12
13MODULES = $(SUITE_MODULES) $(SUITE_MODULES_DATADIR_MODS) testsuite.erl
14
15EBIN_DIR=@top_builddir@/testsuite
16EBIN_FILES=$(MODULES:%.erl=$(EBIN_DIR)/%.beam)
17
18LOG_DIR=@builddir@/logs
19
20ERLC_FLAGS = $(ERLC_GENERIC_FLAGS) -DSHOW_LOG +nowarn_export_all
21
22include @top_srcdir@/erlang_deps.mk
23
24ALL_SUITES = $(SUITE_MODULES:%.erl=%)
25SUITES     = all
26GRPS       = all
27CASES      = all
28
29USE_COVER    = no
30USE_DEBUGGER = no
31TRACES       =
32
33EXTRA_DIST = $(MODULES) $(SUITE_MODULES_DATADIR)
34
35
36all-local: $(EBIN_FILES)
37
38clean-local:
39	$(AM_V_at)rm -fr $(EBIN_FILES) $(LOG_DIR)
40	$(AM_V_at)rm -fr $(wildcard @builddir@/*_SUITE_data/temp)
41	$(AM_V_at)find @builddir@/*_SUITE_data -type d  -empty -delete 2>/dev/null || true
42
43$(EBIN_DIR)/%.beam: %.erl
44	$(AM_V_at)$(MKDIR_P) $(shell dirname $@)
45	$(AM_V_at)$(ERLC) $(ERLC_FLAGS) -M -MF $(@:$(EBIN_DIR)/%.beam=$(DEPDIR)/%.Pbeam) -MT $@ $<
46	$(AM_V_ERLC)$(ERLC) $(ERLC_FLAGS) -o $(shell dirname $@) $<
47
48distclean-local:
49	$(AM_V_at)rm -fr $(DEPDIR)
50
51$(LOG_DIR):
52	$(AM_V_at)mkdir -p $@
53
54common_test: all $(LOG_DIR)
55	$(AM_V_at)echo "  RUN     $@ [suites=$(SUITES) - groups=$(GRPS) - cases=$(CASES)]"
56	$(AM_V_at)echo "      - use cover   : $(USE_COVER)"
57	$(AM_V_at)echo "      - use debugger: $(USE_DEBUGGER)"
58	$(AM_V_at)echo "      - traces      : $(TRACES)"
59	$(AM_V_at)USE_COVER=$(USE_COVER) USE_DEBUGGER=$(USE_DEBUGGER) TRACES="$(TRACES)" \
60		@builddir@/run_common_test "$(ALL_SUITES)" "$(SUITES)" "$(GRPS)" "$(CASES)"
61
62check-local: common_test
63
64list-checks:
65	$(AM_V_at)echo
66	$(AM_V_at)echo " CHECKS:"
67	$(AM_V_at)for c in $(ALL_SUITES); do echo "    - $$c"; done
68	$(AM_V_at)echo
69
70.PHONY: common_test list-checks
71
72else
73
74check-local:
75	$(AM_V_at)echo
76	$(AM_V_at)echo "  SKIPPED - Tests cannot be executed because on or more required applications are missing"
77	$(AM_V_at)echo
78	$(AM_V_at)((test "x$(CT_RUN)" = "x")                            && echo "    - ct_run(1) is missing")                   || true
79	$(AM_V_at)((test "$(ERLANG_LIB_DIR_common_test)" = "not found") && echo "    - \"common_test\" application is missing") || true
80	$(AM_V_at)((test "$(ERLANG_LIB_DIR_eunit)" = "not found")       && echo "    - \"eunit\" application is missing")       || true
81	$(AM_V_at)((test "$(ERLANG_LIB_DIR_inets)" = "not found")       && echo "    - \"inets\" application is missing")       || true
82	$(AM_V_at)((test "$(ERLANG_LIB_DIR_tools)" = "not found")       && echo "    - \"tools\" application is missing")       || true
83	$(AM_V_at)echo
84
85endif
86