# HG changeset patch # User Edouard Tisserant # Date 1712244709 -7200 # Node ID a6ec38dcbfb5f7675b5790620f86a84154483819 # Parent 1d383b4c0a2351854185492c90d9d1b0250affec Modbus: add CI test + test project diff -r 1d383b4c0a23 -r a6ec38dcbfb5 tests/Makefile --- a/tests/Makefile Wed Apr 03 13:02:50 2024 +0200 +++ b/tests/Makefile Thu Apr 04 17:31:49 2024 +0200 @@ -71,7 +71,7 @@ # SOURCE and BUILD # -BUILT_PROJECTS=beremiz matiec open62541 +BUILT_PROJECTS=beremiz matiec open62541 Modbus tar_opts=--absolute-names --exclude=.hg --exclude=.git --exclude=.*.pyc --exclude=.*.swp @@ -105,7 +105,12 @@ cmake -D UA_ENABLE_ENCRYPTION=OPENSSL .. && \ make -built_apps: $(build_dir)/matiec/iec2c $(build_dir)/beremiz/$(beremiz_checksum).sha1 $(build_dir)/open62541/build/bin/libopen62541.a +$(build_dir)/Modbus/libmb.a: | $(build_dir)/Modbus/$(Modbus_checksum).sha1 + cd $(build_dir)/Modbus && \ + make + + +built_apps: $(build_dir)/matiec/iec2c $(build_dir)/beremiz/$(beremiz_checksum).sha1 $(build_dir)/open62541/build/bin/libopen62541.a $(build_dir)/Modbus/libmb.a touch $@ define log_command diff -r 1d383b4c0a23 -r a6ec38dcbfb5 tests/cli_tests/modbus_test_tcp.bash --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/cli_tests/modbus_test_tcp.bash Thu Apr 04 17:31:49 2024 +0200 @@ -0,0 +1,15 @@ +#!/bin/bash + +# Run python example throug command line, and check usual output + +coproc setsid $BEREMIZPYTHONPATH $BEREMIZPATH/Beremiz_cli.py -k --project-home $BEREMIZPATH/tests/projects/modbus_test_tcp build transfer run; + +while read -u ${COPROC[0]} line; do + echo "$line" + if [[ "$line" == "TEST OK" ]]; then + pkill -9 -s $COPROC_PID + exit 0 + fi +done + +exit 42 diff -r 1d383b4c0a23 -r a6ec38dcbfb5 tests/projects/modbus_test_tcp/beremiz.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/projects/modbus_test_tcp/beremiz.xml Thu Apr 04 17:31:49 2024 +0200 @@ -0,0 +1,6 @@ + + + + + + diff -r 1d383b4c0a23 -r a6ec38dcbfb5 tests/projects/modbus_test_tcp/modbus_0@modbus/baseconfnode.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/projects/modbus_test_tcp/modbus_0@modbus/baseconfnode.xml Thu Apr 04 17:31:49 2024 +0200 @@ -0,0 +1,2 @@ + + diff -r 1d383b4c0a23 -r a6ec38dcbfb5 tests/projects/modbus_test_tcp/modbus_0@modbus/confnode.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/projects/modbus_test_tcp/modbus_0@modbus/confnode.xml Thu Apr 04 17:31:49 2024 +0200 @@ -0,0 +1,2 @@ + + diff -r 1d383b4c0a23 -r a6ec38dcbfb5 tests/projects/modbus_test_tcp/plc.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/projects/modbus_test_tcp/plc.xml Thu Apr 04 17:31:49 2024 +0200 @@ -0,0 +1,390 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + "beremiz" + "Modbus" + +If Modbus library is installed elsewhere, then place corresponding paths +in CFLAGS/LDFLAGS in project settings. + +For GNU/Linux to install Modbus library in parent directory run following commands: +$ hg clone https://bitbucket.org/mjsousa/modbus Modbus +$ cd Modbus +$ make + +After that Modbus extension is ready to be used in Beremiz projects.]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + T#1s + + + + + + + 32767 + + + + + + + + + + + + + + Counter + + + + + + + + + + + MasterWriteToReg0 + + + + + + + MasterReadFromReg1 + + + + + + + + + + + + + SlaveHoldReg0 + + + + + + + + + + + SlaveInputReg0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CounterReadBack + + + + + + + 5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +