--- a/tests/Makefile Fri Feb 18 15:00:04 2022 +0100
+++ b/tests/Makefile Fri Feb 18 15:12:06 2022 +0100
@@ -68,10 +68,12 @@
OWN_PROJECTS=beremiz matiec
+tar_opts=--absolute-names --exclude=.hg --exclude=.git --exclude=.*.pyc --exclude=.*.swp # sha1 checksum of source is used to force copy/compile on each change
define make_checksum_assign
-$(1)_checksum = $(shell tar --exclude=.hg --exclude=.git --exclude=.*.swp -c $(workspace)/$(1) | sha1sum | cut -d ' ' -f 1)
+$(1)_checksum = $(shell tar $(tar_opts) -c $(workspace)/$(1) | sha1sum | cut -d ' ' -f 1) $(foreach project,$(OWN_PROJECTS),$(eval $(call make_checksum_assign,$(project))))
@@ -81,7 +83,8 @@
$(build_dir)/$(1)/$($(1)_checksum).sha1: $(build_dir) $(workspace)/$(1)
- cp -a $(workspace)/$(1) $(build_dir)/$(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))))
@@ -99,7 +102,7 @@
ide_tests = $(subst $(src)/ide_tests/,,$(wildcard $(src)/ide_tests/*.sikuli))
- (fluxbox &); 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) | tee test_stdout.txt; exit $$$${pipestatus[0]} # Xnest based interactive sessions for tests edit and debug.
@@ -109,13 +112,17 @@
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
- rm -rf $(test_dir)/$(1)_idetest
- mkdir $(test_dir)/$(1)_idetest
- cd $(test_dir)/$(1)_idetest; $(xserver_command) bash -c '$(call idetest_command, $(1))'
+ $(call prep_test,$(1)); $(xserver_command) bash -c '$(call idetest_command,$(1))' # Manually invoked rule {testname}.sikuli
@@ -124,9 +131,7 @@
# Manually invoked rule xnest_{testname}.sikuli
# runs test in xnest so that one can see what happens
- rm -rf $(test_dir)/$(1)_idetest
- mkdir $(test_dir)/$(1)_idetest
- cd $(test_dir)/$(1)_idetest; $$(call xnest_run, bash -c '$(call idetest_command, $(1))')
+ $(call prep_test,$(1)); $$(call xnest_run, bash -c '$(call idetest_command,$(1))') ide_tests_targets += $(test_dir)/$(1)_idetest/.passed
@@ -139,7 +144,7 @@
$(call xnest_run, bash -c '(fluxbox &);xterm')
- $(call xnest_run, bash -c '(fluxbox &);(xterm -e sikulix &);xterm')
+ $(call xnest_run, bash -c '(fluxbox &);(BEREMIZPATH=$(build_dir)/beremiz xterm -e sikulix &);xterm') # in case VNC would be used
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/ide_tests/new_project.sikuli/new_project.py Fri Feb 18 15:12:06 2022 +0100
@@ -0,0 +1,149 @@
+""" This test opens, builds and runs exemple project named "python". +Test succeeds if runtime's stdout behaves as expected +# allow module import from current test directory's parent +addImportPath(os.path.dirname(getBundlePath())) +# common test definitions module +from sikuliberemiz import * +# Start the app without any project given +proc,app = StartBeremizApp() +new_project_path = os.path.join(os.path.abspath(os.path.curdir), "new_test_project") +# New project path must exist (usually created in directory selection dialog) +os.mkdir(new_project_path) +# To detect when actions did finish because IDE content isn't changing +idle = IDEIdleObserver(app) +# To send keyboard shortuts +# Create new project (opens new project directory selection dialog) +# Move to "Home" section of file selecor, otherwise address is +# "file ignored" at first run +# Enter directory by name +type(new_project_path + Key.ENTER) +# When prompted for creating first program select type ST +type(Key.TAB*4) # go to lang dropdown +type(Key.DOWN*2) # change selected language +type(Key.ENTER) # validate +# Focus on Variable grid +{printf("Test OK\\n");fflush(stdout);} +# Focus project tree and select root item +# FIXME: Select other field to ensure URI is validated +# Close project config editor +# Focus seems undefined at that time (FIXME) +# Force focussing on "something" so that next shortcut is taken +stdoutIdle = stdoutIdleObserver(proc) +found = waitPatternInStdout(proc, "Test OK", 10) --- a/tests/ide_tests/sikuliberemiz.py Fri Feb 18 15:00:04 2022 +0100
+++ b/tests/ide_tests/sikuliberemiz.py Fri Feb 18 15:12:06 2022 +0100
@@ -4,15 +4,16 @@
from threading import Thread, Event
-home = os.environ["HOME"]
beremiz_path = os.environ["BEREMIZPATH"]
python_bin = os.environ.get("BEREMIZPYTHONPATH", "/usr/bin/python")
def StartBeremizApp(projectpath=None, exemple=None):
Starts Beremiz IDE, waits for main window to appear, maximize it.
@@ -90,18 +91,23 @@
+ "Save": ("s",Key.CTRL), + "Address": ("l",Key.CTRL)} # to reach address bar in GTK's file selector def __getattr__(self, name):
+ if typeof(fkey) != tuple:
@@ -127,7 +133,6 @@
def _OnIDEWindowChange(self, event):
def Wait(self, period, timeout):
@@ -162,7 +167,7 @@
self.thread = Thread(target = self._waitStdoutProc).start()
+ def _waitStdoutProc(self): a = self.proc.stdout.read(1)
if len(a) == 0 or a is None:
--- a/tests/tools/Docker/beremiz-sikuli/build_in_docker.sh Fri Feb 18 15:00:04 2022 +0100
+++ b/tests/tools/Docker/beremiz-sikuli/build_in_docker.sh Fri Feb 18 15:12:06 2022 +0100
@@ -3,6 +3,6 @@
CONTAINER=beremiz_sikuli_current
-docker exec -i -t $CONTAINER bash -i -c do_test $1
+docker exec -i -t $CONTAINER bash -i -c "do_tests $1"