RN rnmake  3.0.0
Rules.test.mk
Go to the documentation of this file.
1 ################################################################################
2 #
3 # Rules.test.mk
4 #
5 ifdef RNMAKE_DOXY
6 /*!
7 \file
8 
9 \brief Provides "test" targets.
10 
11 This file is automatically included by \ref Rules.mk when one or more of the
12 test make goals are specified.
13 
14 \pkgsynopsis
15 RN Make System
16 
17 \pkgfile{Rules.test.mk}
18 
19 \pkgauthor{Daniel Packard,daniel@roadnarrows.com}
20 \pkgauthor{Robin Knight,robin.knight@roadnarrows.com}
21 
22 \pkgcopyright{2005-2018,RoadNarrows LLC,http://www.roadnarrows.com}
23 
24 \license{MIT}
25 
26 \EulaBegin
27 \EulaEnd
28 
29 \cond RNMAKE_DOXY
30  */
31 endif
32 #
33 ################################################################################
34 
35 _RULES_TEST_MK = 1
36 
37 RNMAKE_TEST_ENABLED = y
38 
39 GOALS_WITH_SUBDIRS += run-test
40 
41 # Add test targets to local programs
42 RNMAKE_LOC_PGMS += $(RNMAKE_TEST_PGMS)
43 
44 GOALS_WITH_SUBDIRS += test
45 
46 # colors
47 color_test = $(color_pre)$(color_light_blue)
48 
49 # Make specific test programs
50 .PHONY: test
51 test: pkgbanner all subdirs-test
52  $(footer)
53 
54 # Run test programs
55 .PHONY: run-test
56 run-test: pkgbanner echo-run-test do-test subdirs-run-test
57  $(footer)
58 
59 .PHONY: echo-run-test
60 echo-run-test:
61  $(call printEchoTgtGoalDesc,Run all tests)
62 
63 .PHONY: do-test
64 do-test:
65  @for f in $(RNMAKE_TEST_PGMS); \
66  do \
67  printf "\n$(color_test) $$f$(color_end)\n"; \
68  if [ -x ./$(LOCDIR_BIN)/$$f ]; \
69  then \
70  ./$(LOCDIR_BIN)/$$f; \
71  else \
72  printf "$(color_error)Program $$f does not exist. Did you 'make test' first?$(color_end)\n\n"; \
73  break; \
74  fi; \
75  done;
76  $(footer)
77 
78 
79 ifdef RNMAKE_DOXY
80 /*! \endcond RNMAKE_DOXY */
81 endif