Skip to content

Commit 20f4b36

Browse files
author
Thomas Arts
committed
More primitive testing, but at least we know what we're doing
1 parent 1834c41 commit 20f4b36

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

Makefile

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,37 +43,40 @@ locked-deps:
4343
##
4444
## Test targets
4545
##
46-
TEST_LOG_FILE := eunit.log
46+
TEST_LOG_FILE := $(shell pwd)/eunit.log
4747
testclean:
4848
@rm -f $(TEST_LOG_FILE)
4949

50-
TMP_CONFIG=rebar.config.tmp
50+
eunit: compile
51+
$(REBAR) eunit
5152

5253
# Tricking rebar3 to use the dependencies from the top-level _build directory.
54+
# One needs to have ran `make eunit` before we can make test-deps to find
55+
# directories in _build/test
5356
testdep-% :
5457
@echo "--- Running EUnit tests for $* ---"
5558
@rm -rf _build/deptest+test _build/deptest
5659
@(cd $(TEST_DEPS_DIR)/$* && \
57-
cp rebar.config $(TMP_CONFIG) && \
58-
echo "" >> $(TMP_CONFIG) && \
59-
echo '{profiles, [{deptest, [{base_dir, "../../.."}]}]}.' >> $(TMP_CONFIG) && \
60-
REBAR_CONFIG=$(TMP_CONFIG) $(REBAR) as deptest eunit) || echo "Eunit: $* FAILED" >> $(TEST_LOG_FILE)
61-
@(cd $(TEST_DEPS_DIR)/$* && rm -f $(TMP_CONFIG))
60+
$(REBAR) eunit && \
61+
(echo "Eunit: $* PASSED" >> $(TEST_LOG_FILE) ) ) || echo "Eunit: $* FAILED" >> $(TEST_LOG_FILE)
6262

63-
test-deps : deps compile testclean $(patsubst %, testdep-%, $(TEST_DEPS))
63+
## need to make test before to get TEST_DEPS dir established
64+
test-deps : compile testclean $(patsubst %, testdep-%, $(TEST_DEPS))
65+
echo Tested the dependencies: $(TEST_DEPS)
6466

6567
# Test each dependency individually in its own VM
6668
test : test-deps
67-
$(REBAR) eunit
6869
@if test -s $(TEST_LOG_FILE) ; then \
69-
cat $(TEST_LOG_FILE) && \
70-
exit `wc -l < $(TEST_LOG_FILE)`; \
70+
cat $(TEST_LOG_FILE) | grep FAILED && \
71+
exit `cat $(TEST_LOG_FILE) | grep FAILED | wc -l`; \
7172
fi
73+
$(REBAR) eunit
74+
7275

7376
##
7477
## Release targets
7578
##
76-
rel: locked-deps compile
79+
rel: locked-deps compile
7780
$(REBAR) as rel release
7881

7982
relclean:
@@ -147,7 +150,7 @@ orgs-README:
147150
@mv README.txt README
148151

149152
APPS = kernel stdlib sasl erts ssl tools os_mon runtime_tools crypto inets \
150-
xmerl webtool snmp public_key mnesia eunit syntax_tools compiler
153+
xmerl snmp public_key mnesia eunit syntax_tools compiler
151154
COMBO_PLT = $(HOME)/.$(REPO)_combo_dialyzer_plt
152155

153156
check_plt: compile

0 commit comments

Comments
 (0)