blob: bf8535d14bf5762e8f876284eeaefad529cd8c21 [file] [log] [blame]
David Reiss77f6f7f2008-06-11 00:57:11 +00001# for testing erlang files directly. The set up for a
2# this type of test would be
3# files to test reside in lib/<app_name>/src and the test files which are
4# just plain erlang code reside in lib/<app_name>/test
5#
6# This color codes emitted while the tests run assume that you are using
7# a white-on-black display schema. If not, e.g. if you use a white
8# background, you will not be able to read the "WHITE" text.
9# You can override this by supplying your own "white" color,
10# which may in fact be black! You do this by defining an environment
11# variable named "MY_WHITE" and setting it to $'\e[0;30m' (which is
12# simply bash's way of specifying "Escape [ 0 ; 3 0 m").
13# Similarly, you can set your versions of the standard colors
14# found in colors.mk.
15
16test:
17 @TEST_MODULES=`ls *_test.erl`; \
18 trap "echo $(OFF)$(NO_COLOR); exit 1;" 1 2 3 6; \
19 for d in $$TEST_MODULES; do \
20 echo $${MY_GREEN:-$(GREEN)}"Testing File $$d" $${MY_WHITE:-$(WHITE)}; \
21 echo -n $${MY_BLUE:-$(BLUE)}; \
22 erl -name $(APP_NAME) $(TEST_LIBS) \
23 -s `basename $$d .erl` all -s init stop -noshell; \
24 if [ $$? -ne 0 ]; then \
25 echo $${MY_LRED:-$(LRED)}"$$d Test Failed"; \
26 fi; \
27 echo -n $(OFF)$(NO_COLOR); \
28 done
29