69 |
69 |
70 # |
70 # |
71 # SOURCE and BUILD |
71 # SOURCE and BUILD |
72 # |
72 # |
73 |
73 |
74 OWN_PROJECTS=beremiz matiec |
74 BUILT_PROJECTS=beremiz matiec open62541 |
75 |
75 |
76 tar_opts=--absolute-names --exclude=.hg --exclude=.git --exclude=.*.pyc --exclude=.*.swp |
76 tar_opts=--absolute-names --exclude=.hg --exclude=.git --exclude=.*.pyc --exclude=.*.swp |
77 |
77 |
78 # sha1 checksum of source is used to force copy/compile on each change |
78 # sha1 checksum of source is used to force copy/compile on each change |
79 |
79 |
80 define make_checksum_assign |
80 define make_checksum_assign |
81 $(1)_checksum = $(shell tar $(tar_opts) -c $(workspace)/$(1) | sha1sum | cut -d ' ' -f 1) |
81 $(1)_checksum = $(shell tar $(tar_opts) -c $(workspace)/$(1) | sha1sum | cut -d ' ' -f 1) |
82 endef |
82 endef |
83 $(foreach project,$(OWN_PROJECTS),$(eval $(call make_checksum_assign,$(project)))) |
83 $(foreach project,$(BUILT_PROJECTS),$(eval $(call make_checksum_assign,$(project)))) |
84 |
84 |
85 $(build_dir): |
85 $(build_dir): |
86 mkdir -p $(build_dir) |
86 mkdir -p $(build_dir) |
87 |
87 |
88 define make_src_rule |
88 define make_src_rule |
89 $(build_dir)/$(1)/$($(1)_checksum).sha1: $(build_dir) $(workspace)/$(1) |
89 $(build_dir)/$(1)/$($(1)_checksum).sha1: $(build_dir) $(workspace)/$(1) |
90 rm -rf $(build_dir)/$(1) |
90 rm -rf $(build_dir)/$(1) |
91 tar -C $(workspace) $(tar_opts) -c $(1) | tar -C $(build_dir) -x |
91 tar -C $(workspace) $(tar_opts) -c $(1) | tar -C $(build_dir) -x |
92 touch $$@ |
92 touch $$@ |
93 endef |
93 endef |
94 $(foreach project,$(OWN_PROJECTS),$(eval $(call make_src_rule,$(project)))) |
94 $(foreach project,$(BUILT_PROJECTS),$(eval $(call make_src_rule,$(project)))) |
95 |
95 |
96 $(build_dir)/matiec/iec2c: | $(build_dir)/matiec/$(matiec_checksum).sha1 |
96 $(build_dir)/matiec/iec2c: | $(build_dir)/matiec/$(matiec_checksum).sha1 |
97 cd $(build_dir)/matiec && \ |
97 cd $(build_dir)/matiec && \ |
98 autoreconf -i && \ |
98 autoreconf -i && \ |
99 ./configure && \ |
99 ./configure && \ |
100 make |
100 make |
101 |
101 |
102 own_apps: $(build_dir)/matiec/iec2c $(build_dir)/beremiz/$(beremiz_checksum).sha1 |
102 $(build_dir)/open62541/build/bin/libopen62541.a: | $(build_dir)/open62541/$(open62541_checksum).sha1 |
|
103 cd $(build_dir)/open62541 && \ |
|
104 rm -rf build && mkdir build && cd build && \ |
|
105 cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUA_NAMESPACE_ZERO=FULL .. && \ |
|
106 make |
|
107 |
|
108 built_apps: $(build_dir)/matiec/iec2c $(build_dir)/beremiz/$(beremiz_checksum).sha1 $(build_dir)/open62541/build/bin/libopen62541.a |
103 touch $@ |
109 touch $@ |
104 |
110 |
105 define log_command |
111 define log_command |
106 $(call $(1),$(2)) | tee test_stdout.txt; exit $$$${PIPESTATUS[0]} |
112 $(call $(1),$(2)) | tee test_stdout.txt; exit $$$${PIPESTATUS[0]} |
107 endef |
113 endef |
140 endef |
146 endef |
141 |
147 |
142 xserver_command ?= xvfb-run -s '-screen 0 1920x1080x24' |
148 xserver_command ?= xvfb-run -s '-screen 0 1920x1080x24' |
143 |
149 |
144 define make_idetest_rule |
150 define make_idetest_rule |
145 $(test_dir)/$(1)_results/.passed: own_apps |
151 $(test_dir)/$(1)_results/.passed: built_apps |
146 $(call prep_test,$(1)); $(xserver_command) bash -c '$(call log_command,$(2),$(1))' |
152 $(call prep_test,$(1)); $(xserver_command) bash -c '$(call log_command,$(2),$(1))' |
147 touch $$@ |
153 touch $$@ |
148 |
154 |
149 # Manually invoked rule {testname}.sikuli |
155 # Manually invoked rule {testname}.sikuli |
150 $(1): $(test_dir)/$(1)_results/.passed |
156 $(1): $(test_dir)/$(1)_results/.passed |
151 |
157 |
152 # Manually invoked rule xnest_{testname}.sikuli |
158 # Manually invoked rule xnest_{testname}.sikuli |
153 # runs test in xnest so that one can see what happens |
159 # runs test in xnest so that one can see what happens |
154 xnest_$(1): own_apps |
160 xnest_$(1): built_apps |
155 $(call prep_test,$(1)); $$(call xnest_run, bash -c '$(call log_command,$(2),$(1))') |
161 $(call prep_test,$(1)); $$(call xnest_run, bash -c '$(call log_command,$(2),$(1))') |
156 |
162 |
157 ide_tests_targets += $(test_dir)/$(1)_results/.passed |
163 ide_tests_targets += $(test_dir)/$(1)_results/.passed |
158 endef |
164 endef |
159 $(foreach idetest,$(sikuli_ide_tests),$(eval $(call make_idetest_rule,$(idetest),sikuli_idetest_command))) |
165 $(foreach idetest,$(sikuli_ide_tests),$(eval $(call make_idetest_rule,$(idetest),sikuli_idetest_command))) |
160 $(foreach idetest,$(pytest_ide_tests),$(eval $(call make_idetest_rule,$(idetest),pytest_idetest_command))) |
166 $(foreach idetest,$(pytest_ide_tests),$(eval $(call make_idetest_rule,$(idetest),pytest_idetest_command))) |
161 |
167 |
162 ide_tests : $(ide_tests_targets) |
168 ide_tests : $(ide_tests_targets) |
163 echo "$(ide_tests_targets) : Passed" |
169 echo "$(ide_tests_targets) : Passed" |
164 |
170 |
165 xnest_xterm: own_apps |
171 xnest_xterm: built_apps |
166 $(call xnest_run, bash -c '(fluxbox &);xterm') |
172 $(call xnest_run, bash -c '(fluxbox &);xterm') |
167 |
173 |
168 xnest_sikuli: own_apps |
174 xnest_sikuli: built_apps |
169 $(call xnest_run, bash -c '(fluxbox &);(BEREMIZPATH=$(build_dir)/beremiz xterm -e sikulix &);xterm') |
175 $(call xnest_run, bash -c '(fluxbox &);(BEREMIZPATH=$(build_dir)/beremiz xterm -e sikulix &);xterm') |
170 |
176 |
171 xvfb_sikuli: own_apps |
177 xvfb_sikuli: built_apps |
172 echo "******************************************" |
178 echo "******************************************" |
173 echo "On host, run 'xvncviewer 127.0.0.1:5900' to see sikuli X session" |
179 echo "On host, run 'xvncviewer 127.0.0.1:5900' to see sikuli X session" |
174 echo "Docker container must be created with TESTDEBUG=YES. For example :" |
180 echo "Docker container must be created with TESTDEBUG=YES. For example :" |
175 echo "./clean_docker_container.sh && ./build_docker_image.sh && TESTDEBUG=YES ./create_docker_container.sh && ./do_test_in_docker.sh xvfb_sikuli" |
181 echo "./clean_docker_container.sh && ./build_docker_image.sh && TESTDEBUG=YES ./create_docker_container.sh && ./do_test_in_docker.sh xvfb_sikuli" |
176 echo "******************************************" |
182 echo "******************************************" |
186 define clitest_command |
192 define clitest_command |
187 BEREMIZPATH=$(build_dir)/beremiz source $(src)/cli_tests/$(1) |
193 BEREMIZPATH=$(build_dir)/beremiz source $(src)/cli_tests/$(1) |
188 endef |
194 endef |
189 |
195 |
190 define make_clitest_rule |
196 define make_clitest_rule |
191 $(test_dir)/$(1)_results/.passed: own_apps |
197 $(test_dir)/$(1)_results/.passed: built_apps |
192 $(call prep_test,$(1)); bash -c '$(call log_command,$(2),$(1))' |
198 $(call prep_test,$(1)); bash -c '$(call log_command,$(2),$(1))' |
193 touch $$@ |
199 touch $$@ |
194 |
200 |
195 # Manually invoked rule |
201 # Manually invoked rule |
196 $(1): $(test_dir)/$(1)_results/.passed |
202 $(1): $(test_dir)/$(1)_results/.passed |