--- a/tests/Makefile Fri Jul 15 14:40:55 2022 +0200
+++ b/tests/Makefile Fri Jul 15 14:42:08 2022 +0200
@@ -67,6 +67,10 @@
build_dir = $(test_dir)/build
OWN_PROJECTS=beremiz matiec
tar_opts=--absolute-names --exclude=.hg --exclude=.git --exclude=.*.pyc --exclude=.*.swp
@@ -85,7 +89,6 @@
$(build_dir)/$(1)/$($(1)_checksum).sha1: $(build_dir) $(workspace)/$(1)
tar -C $(workspace) $(tar_opts) -c $(1) | tar -C $(build_dir) -x
- #cp -a $(workspace)/$(1) $(build_dir)/$(1)
$(foreach project,$(OWN_PROJECTS),$(eval $(call make_src_rule,$(project))))
@@ -96,16 +99,29 @@
-# TODO: use packge (deb/snap ?)
own_apps: $(build_dir)/matiec/iec2c $(build_dir)/beremiz/$(beremiz_checksum).sha1
+ $(call $(1),$(2)) | tee test_stdout.txt; exit $$$${PIPESTATUS[0]} + rm -rf $(test_dir)/$(1)_results + mkdir $(test_dir)/$(1)_results + cd $(test_dir)/$(1)_results ide_test_dir = $(src)/ide_tests
sikuli_ide_tests = $(subst $(ide_test_dir)/,,$(wildcard $(ide_test_dir)/*.sikuli))
pytest_ide_tests = $(subst $(ide_test_dir)/,,$(wildcard $(ide_test_dir)/*.pytest))
define sikuli_idetest_command
- (fluxbox >/dev/null 2>&1 &); BEREMIZPATH=$(build_dir)/beremiz sikulix -r $(src)/ide_tests/$(1) | tee test_stdout.txt; exit $$$${PIPESTATUS[0]}
+ (fluxbox >/dev/null 2>&1 &); BEREMIZPATH=$(build_dir)/beremiz sikulix -r $(src)/ide_tests/$(1) @@ -113,7 +129,7 @@
PYTEST=$(dir $(BEREMIZPYTHONPATH))/pytest
define pytest_idetest_command
- (fluxbox >/dev/null 2>&1 &); PYTHONPATH=$(ide_test_dir) timeout -k $(KILL_DELAY) $(DELAY) $(PYTEST) --maxfail=1 --timeout=100 $(src)/ide_tests/$(1) | tee test_stdout.txt; exit $$$${PIPESTATUS[0]}
+ (fluxbox >/dev/null 2>&1 &); PYTHONPATH=$(ide_test_dir) timeout -k $(KILL_DELAY) $(DELAY) $(PYTEST) --maxfail=1 --timeout=100 $(src)/ide_tests/$(1) # Xnest based interactive sessions for tests edit and debug.
@@ -123,28 +139,22 @@
Xnest :42 -geometry 1920x1080+0+0 & export xnestpid=$$!; sleep 1; DISPLAY=:42 $(1); export res=$$?; kill $${xnestpid} 2>/dev/null; exit $${res}
- rm -rf $(test_dir)/$(1)_idetest
- mkdir $(test_dir)/$(1)_idetest
- cd $(test_dir)/$(1)_idetest
xserver_command ?= xvfb-run -s '-screen 0 1920x1080x24'
-$(test_dir)/$(1)_idetest/.passed: own_apps
- $(call prep_test,$(1)); $(xserver_command) bash -c '$(call $(2),$(1))'
+$(test_dir)/$(1)_results/.passed: own_apps + $(call prep_test,$(1)); $(xserver_command) bash -c '$(call log_command,$(2),$(1))' # Manually invoked rule {testname}.sikuli
-$(1): $(test_dir)/$(1)_idetest/.passed
+$(1): $(test_dir)/$(1)_results/.passed # Manually invoked rule xnest_{testname}.sikuli
# runs test in xnest so that one can see what happens
- $(call prep_test,$(1)); $$(call xnest_run, bash -c '$(call $(2),$(1))')
+ $(call prep_test,$(1)); $$(call xnest_run, bash -c '$(call log_command,$(2),$(1))') -ide_tests_targets += $(test_dir)/$(1)_idetest/.passed
+ide_tests_targets += $(test_dir)/$(1)_results/.passed $(foreach idetest,$(sikuli_ide_tests),$(eval $(call make_idetest_rule,$(idetest),sikuli_idetest_command)))
$(foreach idetest,$(pytest_ide_tests),$(eval $(call make_idetest_rule,$(idetest),pytest_idetest_command)))
@@ -166,8 +176,37 @@
echo "******************************************"
$(xserver_command) bash -c '(fluxbox &);(x11vnc &);(BEREMIZPATH=$(build_dir)/beremiz xterm -e sikulix &);xterm'
- rm -rf $(ide_tests_targets) $(build_dir)
+cli_test_dir = $(src)/cli_tests +cli_tests = $(subst $(cli_test_dir)/,,$(wildcard $(cli_test_dir)/*.bash)) + BEREMIZPATH=$(build_dir)/beremiz source $(src)/cli_tests/$(1) +define make_clitest_rule +$(test_dir)/$(1)_results/.passed: own_apps + $(call prep_test,$(1)); bash -c '$(call log_command,$(2),$(1))' +$(1): $(test_dir)/$(1)_results/.passed +cli_tests_targets += $(test_dir)/$(1)_results/.passed +$(foreach clitest,$(cli_tests),$(eval $(call make_clitest_rule,$(clitest),clitest_command))) +cli_tests: $(cli_tests_targets) + echo "$(cli_tests_targets) : Passed" + rm -rf $(test_dir)/*_results @@ -175,9 +214,6 @@