66 test_dir ?= $(HOME)/test |
66 test_dir ?= $(HOME)/test |
67 build_dir = $(test_dir)/build |
67 build_dir = $(test_dir)/build |
68 |
68 |
69 OWN_PROJECTS=beremiz matiec |
69 OWN_PROJECTS=beremiz matiec |
70 |
70 |
|
71 tar_opts=--absolute-names --exclude=.hg --exclude=.git --exclude=.*.pyc --exclude=.*.swp |
|
72 |
71 # sha1 checksum of source is used to force copy/compile on each change |
73 # sha1 checksum of source is used to force copy/compile on each change |
72 |
74 |
73 define make_checksum_assign |
75 define make_checksum_assign |
74 $(1)_checksum = $(shell tar --exclude=.hg --exclude=.git --exclude=.*.swp -c $(workspace)/$(1) | sha1sum | cut -d ' ' -f 1) |
76 $(1)_checksum = $(shell tar $(tar_opts) -c $(workspace)/$(1) | sha1sum | cut -d ' ' -f 1) |
75 endef |
77 endef |
76 $(foreach project,$(OWN_PROJECTS),$(eval $(call make_checksum_assign,$(project)))) |
78 $(foreach project,$(OWN_PROJECTS),$(eval $(call make_checksum_assign,$(project)))) |
77 |
79 |
78 $(build_dir): |
80 $(build_dir): |
79 mkdir -p $(build_dir) |
81 mkdir -p $(build_dir) |
80 |
82 |
81 define make_src_rule |
83 define make_src_rule |
82 $(build_dir)/$(1)/$($(1)_checksum).sha1: $(build_dir) $(workspace)/$(1) |
84 $(build_dir)/$(1)/$($(1)_checksum).sha1: $(build_dir) $(workspace)/$(1) |
83 rm -rf $(build_dir)/$(1) |
85 rm -rf $(build_dir)/$(1) |
84 cp -a $(workspace)/$(1) $(build_dir)/$(1) |
86 tar -C $(workspace) $(tar_opts) -c $(1) | tar -C $(build_dir) -x |
|
87 #cp -a $(workspace)/$(1) $(build_dir)/$(1) |
85 touch $$@ |
88 touch $$@ |
86 endef |
89 endef |
87 $(foreach project,$(OWN_PROJECTS),$(eval $(call make_src_rule,$(project)))) |
90 $(foreach project,$(OWN_PROJECTS),$(eval $(call make_src_rule,$(project)))) |
88 |
91 |
89 $(build_dir)/matiec/iec2c: | $(build_dir)/matiec/$(matiec_checksum).sha1 |
92 $(build_dir)/matiec/iec2c: | $(build_dir)/matiec/$(matiec_checksum).sha1 |
97 touch $@ |
100 touch $@ |
98 |
101 |
99 ide_tests = $(subst $(src)/ide_tests/,,$(wildcard $(src)/ide_tests/*.sikuli)) |
102 ide_tests = $(subst $(src)/ide_tests/,,$(wildcard $(src)/ide_tests/*.sikuli)) |
100 |
103 |
101 define idetest_command |
104 define idetest_command |
102 (fluxbox &); BEREMIZPATH=$(build_dir)/beremiz sikulix -r $(src)/ide_tests/$(1) | tee test_stdout.txt; exit $$$${pipestatus[0]} |
105 (fluxbox >/dev/null 2>&1 &); BEREMIZPATH=$(build_dir)/beremiz sikulix -r $(src)/ide_tests/$(1) | tee test_stdout.txt; exit $$$${pipestatus[0]} |
103 endef |
106 endef |
104 |
107 |
105 # Xnest based interactive sessions for tests edit and debug. |
108 # Xnest based interactive sessions for tests edit and debug. |
106 # Would be nice with something equivalent to xvfb-run, waiting for USR1. |
109 # Would be nice with something equivalent to xvfb-run, waiting for USR1. |
107 # Arbitrary "sleep 1" is probably enough for interactive use |
110 # Arbitrary "sleep 1" is probably enough for interactive use |
108 define xnest_run |
111 define xnest_run |
109 Xnest :42 -geometry 1920x1080+0+0 & export xnestpid=$$!; sleep 1; DISPLAY=:42 $(1); export res=$$?; kill $${xnestpid} 2>/dev/null; exit $${res} |
112 Xnest :42 -geometry 1920x1080+0+0 & export xnestpid=$$!; sleep 1; DISPLAY=:42 $(1); export res=$$?; kill $${xnestpid} 2>/dev/null; exit $${res} |
110 endef |
113 endef |
111 |
114 |
|
115 define prep_test |
|
116 rm -rf $(test_dir)/$(1)_idetest |
|
117 mkdir $(test_dir)/$(1)_idetest |
|
118 cd $(test_dir)/$(1)_idetest |
|
119 endef |
|
120 |
112 xserver_command ?= xvfb-run -s '-screen 0 1920x1080x24' |
121 xserver_command ?= xvfb-run -s '-screen 0 1920x1080x24' |
113 |
122 |
114 define make_idetest_rule |
123 define make_idetest_rule |
115 $(test_dir)/$(1)_idetest/.passed: own_apps |
124 $(test_dir)/$(1)_idetest/.passed: own_apps |
116 rm -rf $(test_dir)/$(1)_idetest |
125 $(call prep_test,$(1)); $(xserver_command) bash -c '$(call idetest_command,$(1))' |
117 mkdir $(test_dir)/$(1)_idetest |
|
118 cd $(test_dir)/$(1)_idetest; $(xserver_command) bash -c '$(call idetest_command, $(1))' |
|
119 touch $$@ |
126 touch $$@ |
120 |
127 |
121 # Manually invoked rule {testname}.sikuli |
128 # Manually invoked rule {testname}.sikuli |
122 $(1): $(test_dir)/$(1)_idetest/.passed |
129 $(1): $(test_dir)/$(1)_idetest/.passed |
123 |
130 |
124 # Manually invoked rule xnest_{testname}.sikuli |
131 # Manually invoked rule xnest_{testname}.sikuli |
125 # runs test in xnest so that one can see what happens |
132 # runs test in xnest so that one can see what happens |
126 xnest_$(1): own_apps |
133 xnest_$(1): own_apps |
127 rm -rf $(test_dir)/$(1)_idetest |
134 $(call prep_test,$(1)); $$(call xnest_run, bash -c '$(call idetest_command,$(1))') |
128 mkdir $(test_dir)/$(1)_idetest |
|
129 cd $(test_dir)/$(1)_idetest; $$(call xnest_run, bash -c '$(call idetest_command, $(1))') |
|
130 |
135 |
131 ide_tests_targets += $(test_dir)/$(1)_idetest/.passed |
136 ide_tests_targets += $(test_dir)/$(1)_idetest/.passed |
132 endef |
137 endef |
133 $(foreach idetest,$(ide_tests),$(eval $(call make_idetest_rule,$(idetest)))) |
138 $(foreach idetest,$(ide_tests),$(eval $(call make_idetest_rule,$(idetest)))) |
134 |
139 |
137 |
142 |
138 xnest_xterm: own_apps |
143 xnest_xterm: own_apps |
139 $(call xnest_run, bash -c '(fluxbox &);xterm') |
144 $(call xnest_run, bash -c '(fluxbox &);xterm') |
140 |
145 |
141 xnest_sikuli: own_apps |
146 xnest_sikuli: own_apps |
142 $(call xnest_run, bash -c '(fluxbox &);(xterm -e sikulix &);xterm') |
147 $(call xnest_run, bash -c '(fluxbox &);(BEREMIZPATH=$(build_dir)/beremiz xterm -e sikulix &);xterm') |
143 |
148 |
144 |
149 |
145 # in case VNC would be used |
150 # in case VNC would be used |
146 #xvfb-run -s '-screen 0 1920x1080x24' bash -c '(fluxbox &);(x11vnc &);xterm;' |
151 #xvfb-run -s '-screen 0 1920x1080x24' bash -c '(fluxbox &);(x11vnc &);xterm;' |
147 |
152 |