--- a/.github/workflows/run_tests_in_docker.yml Sun Jul 17 18:07:46 2022 +0200
+++ b/.github/workflows/run_tests_in_docker.yml Sun Jul 17 18:17:43 2022 +0200
@@ -21,6 +21,13 @@
ref: 2a25f4dbf4e2b1e017a3a583db7dede4771fe523
+ - uses: actions/checkout@v3 + repository: open62541/open62541 - name: Cache docker image
--- a/fake_wx.py Sun Jul 17 18:07:46 2022 +0200
+++ b/fake_wx.py Sun Jul 17 18:17:43 2022 +0200
@@ -68,15 +68,17 @@
'Panel', 'PyCommandEvent', 'Dialog', 'PopupWindow', 'TextEntryDialog',
'Notebook', 'ListCtrl', 'TextDropTarget', 'PyControl', 'TextCtrl',
- 'SplitterWindow', 'Frame', 'Printout', 'StaticBitmap',
+ 'SplitterWindow', 'Frame', 'Printout', 'StaticBitmap', 'DropTarget', ('GetTranslation', get_translation)]),
('wx.lib.agw.advancedsplash',[]),
+ ('wx.dataview',['DataViewIndexListModel', 'PyDataViewIndexListModel']), ('wx.lib.buttons',['GenBitmapTextButton']),
('wx.adv',['EditableListBox']),
'Grid', 'PyGridTableBase', 'GridCellEditor', 'GridCellTextEditor',
'GridCellChoiceEditor']),
('wx.lib.agw.customtreectrl',['CustomTreeCtrl']),
('wx.lib.intctrl',['IntCtrl']),
('matplotlib.pyplot',[]),
('matplotlib.backends.backend_wxagg',['FigureCanvasWxAgg']),
--- a/tests/Makefile Sun Jul 17 18:07:46 2022 +0200
+++ b/tests/Makefile Sun Jul 17 18:17:43 2022 +0200
@@ -26,7 +26,7 @@
# build minimal beremiz and matiec to run tests
# For CI/CD scripts to catch and report all failures. Use cases :
@@ -71,7 +71,7 @@
-OWN_PROJECTS=beremiz matiec
+BUILT_PROJECTS=beremiz matiec open62541 tar_opts=--absolute-names --exclude=.hg --exclude=.git --exclude=.*.pyc --exclude=.*.swp
@@ -80,7 +80,7 @@
define make_checksum_assign
$(1)_checksum = $(shell tar $(tar_opts) -c $(workspace)/$(1) | sha1sum | cut -d ' ' -f 1)
-$(foreach project,$(OWN_PROJECTS),$(eval $(call make_checksum_assign,$(project))))
+$(foreach project,$(BUILT_PROJECTS),$(eval $(call make_checksum_assign,$(project)))) @@ -91,7 +91,7 @@
tar -C $(workspace) $(tar_opts) -c $(1) | tar -C $(build_dir) -x
-$(foreach project,$(OWN_PROJECTS),$(eval $(call make_src_rule,$(project))))
+$(foreach project,$(BUILT_PROJECTS),$(eval $(call make_src_rule,$(project)))) $(build_dir)/matiec/iec2c: | $(build_dir)/matiec/$(matiec_checksum).sha1
cd $(build_dir)/matiec && \
@@ -99,7 +99,13 @@
-own_apps: $(build_dir)/matiec/iec2c $(build_dir)/beremiz/$(beremiz_checksum).sha1
+$(build_dir)/open62541/build/bin/libopen62541.a: | $(build_dir)/open62541/$(open62541_checksum).sha1 + cd $(build_dir)/open62541 && \ + rm -rf build && mkdir build && cd build && \ + cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUA_NAMESPACE_ZERO=FULL .. && \ +built_apps: $(build_dir)/matiec/iec2c $(build_dir)/beremiz/$(beremiz_checksum).sha1 $(build_dir)/open62541/build/bin/libopen62541.a @@ -142,7 +148,7 @@
xserver_command ?= xvfb-run -s '-screen 0 1920x1080x24'
-$(test_dir)/$(1)_results/.passed: own_apps
+$(test_dir)/$(1)_results/.passed: built_apps $(call prep_test,$(1)); $(xserver_command) bash -c '$(call log_command,$(2),$(1))'
@@ -151,7 +157,7 @@
# 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 log_command,$(2),$(1))')
ide_tests_targets += $(test_dir)/$(1)_results/.passed
@@ -162,13 +168,13 @@
ide_tests : $(ide_tests_targets)
echo "$(ide_tests_targets) : Passed"
$(call xnest_run, bash -c '(fluxbox &);xterm')
+xnest_sikuli: built_apps $(call xnest_run, bash -c '(fluxbox &);(BEREMIZPATH=$(build_dir)/beremiz xterm -e sikulix &);xterm')
echo "******************************************"
echo "On host, run 'xvncviewer 127.0.0.1:5900' to see sikuli X session"
echo "Docker container must be created with TESTDEBUG=YES. For example :"
@@ -188,7 +194,7 @@
-$(test_dir)/$(1)_results/.passed: own_apps
+$(test_dir)/$(1)_results/.passed: built_apps $(call prep_test,$(1)); bash -c '$(call log_command,$(2),$(1))'
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cli_tests/opcua_test.bash Sun Jul 17 18:17:43 2022 +0200
@@ -0,0 +1,84 @@
+$BEREMIZPYTHONPATH - > >( + # Wait for server to print modified value + if [[ "$line" == 3.4 ]]; then + echo "PLC could write value" +from opcua import ua, Server +server.set_endpoint("opc.tcp://127.0.0.1:4840/freeopcua/server/") +uri = "http://beremiz.github.io" +idx = server.register_namespace(uri) +objects = server.get_objects_node() +testobj = objects.add_object(idx, "TestObject") +testvarout = testobj.add_variable(idx, "TestOut", 1.2) +testvar = testobj.add_variable(idx, "TestIn", 5.6) + print testvar.get_value() +# Start PLC with opcua test +setsid $BEREMIZPYTHONPATH $BEREMIZPATH/Beremiz_cli.py -k \ + --project-home $BEREMIZPATH/tests/projects/opcua_client build transfer run > >( + # Wait for PLC runtime to output expected value on stdout + if [[ "$line" == 1.2 ]]; then + echo "PLC could read value" +echo all subprocess started, start polling results +res=110 # default to ETIMEDOUT + if [[ -a ./SRVOK && -a ./PLCOK ]]; then +# Kill PLC and subprocess +echo will kill PLC:$PLC_PID and SERVER:$SERVER_PID --- a/tests/tools/Docker/beremiz-sikuli/Dockerfile Sun Jul 17 18:07:46 2022 +0200
+++ b/tests/tools/Docker/beremiz-sikuli/Dockerfile Sun Jul 17 18:17:43 2022 +0200
@@ -36,7 +36,7 @@
build-essential automake flex bison mercurial \
libgtk-3-dev libgl1-mesa-dev libglu1-mesa-dev \
libpython2.7-dev libssl-dev \
+ python2 virtualenv cmake # link obtained from https://raiman.github.io/SikuliX1/downloads.html
@@ -60,7 +60,7 @@
RUN ~/beremizenv/bin/pip install \
pytest pytest-timeout ddt \
lxml future matplotlib zeroconf2 enum34 pyro sslpsk posix_spawn \
- twisted nevow autobahn click\
+ twisted nevow autobahn click opcua \ # Point to python binary test scripts will use