]> rtime.felk.cvut.cz Git - l4.git/blob - l4/mk/runux.mk
update
[l4.git] / l4 / mk / runux.mk
1 # -*- Makefile -*-
2 #
3 # DROPS (Dresden Realtime OPerating System) Component
4 #
5 # Makefile-Template to run tests with Fiasco-UX
6 #
7 # install.inc is used, see there for further documentation
8
9 ifeq ($(origin _L4DIR_MK_RUNUX_MK),undefined)
10 _L4DIR_MK_RUNUX_MK=y
11
12 ROLE = runux.mk
13 .general.d:     $(L4DIR)/mk/runux.mk
14
15 # set a mode, so binary.inc is satisfied
16 MODE    ?= l4env
17
18 # include all Makeconf.locals, define common rules/variables
19 include $(L4DIR)/mk/Makeconf
20 include $(L4DIR)/mk/binary.inc
21
22 # if we have a system set, build
23 ifneq ($(SYSTEM),)
24
25 ##
26 # !WARNING!
27 #
28 # This is a preliminary test to allow l4check to run Fiasco-UX tests for
29 # multiple SYSTEMS. This currently only works for x86.
30 ifneq ($(ARCH),x86)
31 $(error "$(ROLE) currently does not support $(ARCH).")
32 endif
33
34 # now check if the current API has a FIASCOUX variable set and if so use it
35 # XXX could be overloaded by $(OSYSTEM) == $(ARCH)-$(L4API) or $(SYSTEM)
36 ifneq ($(FIASCOUX_$(L4API)),)
37 FIASCOUX = $(FIASCOUX_$(L4API))
38 else
39 $(warning "Using generic(?) Fiasco UX "$(FIASCOUX)" to test $(L4API).")
40 endif
41
42 # the testapplication
43 # test if variables are set
44 ifeq ($(TEST_SERVER),)
45 DO_TARGET       := no_ptest
46 else
47 DO_TARGET       := ptest
48 endif
49 # TEST_CLIENT might be empty. Testing server stand-alone
50 ifneq ($(TEST_CLIENT),)
51 TEST_CLIENT_PARAM = $(addprefix -c ,$(TEST_CLIENT))
52 endif
53 ifneq ($(BASE_SERVERS),)
54 $(warning $(BASE_SERVERS))
55 BASESERVERS     = $(foreach server, $(BASE_SERVERS), -b $(server) $(BASE_SERVERS_PARAM_$(server)))
56 endif
57
58 # expected output and what to do on mismatch
59 EXPECTED_OUT    ?= expected.txt
60 TIMEOUT         ?= 10
61 DEBUG_PERL      ?= 0
62 TMP_OUT         ?= tmp_out.txt
63
64 # specify files to delete when doing 'make clean'
65 DEL_ON_CLEAN    = $(TMP_OUT) core
66
67 ifneq ($(DEBUG_PERL),0)
68 DEBUG_PERL_     = -v
69 else
70 DEBUG_PERL_     =
71 endif
72
73 ifneq ($(MEMORY),)
74 MEMORY_         = -m $(MEMORY)
75 endif
76
77 ifneq ($(FIASCOUX_PARAM),)
78 FIASCOUX_PARAM_ = -p $(FIASCOUX_PARAM)
79 endif
80
81 # allow failure of test
82
83 # If EXPECT_FAIL is set, the test if the output matches must fail, otherwise
84 # ptest will return an error.
85 ifeq ($(EXPECT_FAIL),1)
86 EXPECT_FAIL_    = --expectfail
87 else
88 EXPECT_FAIL_    =
89 endif
90
91 # do keep ALL output
92 #
93 # if FILTER_KEEP_ALL is set, the Fiasco UX output is only filtered for escape
94 # sequences. All other output is printed into temporary file
95 ifeq ($(FILTER_KEEP_ALL),1)
96 FILTER_KEEP_    = --filterlevel=0
97 else
98 FILTER_KEEP_    =
99 endif
100
101 # no framebuffer device
102 #
103 # If NO_FBUF_DEV is set, Fiasco UX will not open an X window to display
104 # graphical output. This is useful for testing graphical applications.
105 ifeq ($(NO_FBUF_DEV),1)
106 NO_FBUF_DEV_    = --nofb
107 else
108 NO_FBUF_DEV_    =
109 endif
110
111 # enable symbols and lines per default
112 USE_SYMBOLS     ?= y
113 USE_LINES       ?= y
114
115 ifeq ($(USE_SYMBOLS),y)
116 USE_SYMBOLS_    = --symbols
117 else
118 USE_SYMBOLS_    =
119 endif
120 ifeq ($(USE_LINES),y)
121 USE_LINES_      = --lines
122 else
123 USE_LINES_      =
124 endif
125
126 all:: $(DO_TARGET)
127
128 # install.inc eventually defines rules for every target
129 include $(L4DIR)/mk/install.inc
130
131 no_ptest:
132         @echo "No test defined, skipping"
133
134 ptest:: $(EXPECTED_OUT) $(BID_OBJ_Makefile).inc
135         $(VERBOSE)echo "Running Fiasco UX to test $(TEST_SERVER)"
136         $(VERBOSE)EXPECTED_OUT=$(EXPECTED_OUT) PKGNAME=$(PKGNAME) \
137                 L4DIR=$(L4DIR) OBJ_BASE=$(OBJ_BASE) TMP_OUT=$(TMP_OUT) \
138                 COMPARE_CMD=$(COMPARE_CMD) \
139                 $(L4DIR)/mk/ptest -s $(TEST_SERVER) $(TEST_CLIENT_PARAM) \
140                 -f $(FIASCOUX) $(FIASCOUX_PARAM_) -t $(TIMEOUT) \
141                 -O OBJ-$(SYSTEM) \
142                 $(BASESERVERS) $(DEBUG_PERL_) $(MEMORY_) $(EXPECT_FAIL_) \
143                 $(FILTER_KEEP_) $(NO_FBUF_DEV_) $(USE_SYMBOLS_) $(USE_LINES_)
144
145 genexp:: $(EXPECTED_OUT) $(BID_OBJ_Makefile).inc
146
147 $(EXPECTED_OUT):
148         $(VERBOSE)echo "Running Fiasco UX to generate expected output"
149         $(VERBOSE)EXPECTED_OUT=$(EXPECTED_OUT) PKGNAME=$(PKGNAME) \
150                 L4DIR=$(L4DIR) OBJ_BASE=$(OBJ_BASE) TMP_OUT=$(TMP_OUT) \
151                 COMPARE=$(COMPARE_CMD) \
152                 $(L4DIR)/mk/ptest -s $(TEST_SERVER) $(TEST_CLIENT_PARAM) \
153                 -f $(FIASCOUX) $(FIASCOUX_PARAM_) -t $(TIMEOUT) \
154                 -O OBJ-$(SYSTEM) \
155                 $(BASESERVERS) $(DEBUG_PERL_) $(MEMORY_) $(EXPECT_FAIL_) \
156                 $(FILTER_KEEP_) $(NO_FBUF_DEV_) $(USE_SYMBOLS_) $(USE_LINES_) \
157                 --generate
158         $(VERBOSE)touch .expect-autogenerated
159
160 plainrun:: $(BID_OBJ_Makefile).inc
161         $(VERBOSE)echo "Starting Fiasco UX"
162         $(VERBOSE)EXPECTED_OUT=$(EXPECTED_OUT) PKGNAME=$(PKGNAME) \
163                 L4DIR=$(L4DIR) OBJ_BASE=$(OBJ_BASE) TMP_OUT=$(TMP_OUT) \
164                 COMPARE_CMD=$(COMPARE_CMD) \
165                 $(L4DIR)/mk/ptest -s $(TEST_SERVER) $(TEST_CLIENT_PARAM) \
166                 -f $(FIASCOUX) $(FIASCOUX_PARAM_) -t $(TIMEOUT) \
167                 -O OBJ-$(SYSTEM) \
168                 $(BASESERVERS) $(DEBUG_PERL_) $(MEMORY_) $(FILTER_KEEP_) \
169                 $(NO_FBUF_DEV_) $(USE_SYMBOLS_) $(USE_LINES_) --plainrun
170
171 endif # system defined
172
173 ptest genexp plainrun:: $(foreach arch,$(TARGET_SYSTEMS),\
174                         $(OBJ_DIR)/OBJ-$(arch)/$(BID_OBJ_Makefile))
175         $(if $(TARGET_SYSTEMS),  $(VERBOSE)set -e ; \
176             for d in $(TARGET_SYSTEMS) ; do \
177                 PWD=$(OBJ_DIR)/OBJ-$$d $(MAKE) -C $(OBJ_DIR)/OBJ-$$d -f $(BID_OBJ_Makefile) \
178                         $@ ; done )
179
180 .PHONY: all ptest genexp plainrun clean cleanall help no_ptest
181 -include $(DEPSVAR)
182
183 help::
184         @echo "Specify a target:"
185         @echo "all       - run test"
186         @echo "test      - run test"
187         @echo "genexp    - generate file with expected output"
188         @echo "plainrun  - just run binaries (no filter, no comparison)"
189         @echo "clean     - delete generated intermediate files"
190         @echo "cleanall  - delete all generated files (include genexp target)"
191         @echo "help      - this help"
192         @echo
193
194 endif   # _L4DIR_MK_RUNUX_MK undefined