diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b758ac0..b3ff57f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,8 +10,9 @@ include: ref: '1.2' stages: - - static_code_analysis - - pipeline_test + - static_code_analysis + - pipeline_test + run_unit_test: stage: pipeline_test diff --git a/bbf_plugin/CMakeLists.txt b/bbf_plugin/CMakeLists.txt index 2da0069..9ee56f1 100644 --- a/bbf_plugin/CMakeLists.txt +++ b/bbf_plugin/CMakeLists.txt @@ -7,8 +7,6 @@ ADD_DEFINITIONS(-D_GNU_SOURCE) # Compile and install libcwmpdm.so ADD_LIBRARY(cwmpdm SHARED datamodel.c) -INSTALL(DIRECTORY DESTINATION usr/share/bbfdm/plugins) -INSTALL(TARGETS cwmpdm LIBRARY DESTINATION usr/share/bbfdm/plugins) # Copy libcwmpdm.so to the main repo add_custom_command( diff --git a/gitlab-ci/functional-api-test.sh b/gitlab-ci/functional-api-test.sh index 9420104..f34ee11 100755 --- a/gitlab-ci/functional-api-test.sh +++ b/gitlab-ci/functional-api-test.sh @@ -8,6 +8,11 @@ pwd trap cleanup EXIT trap cleanup SIGINT +echo "Add X_IOPSYS_EU_Dropbear Object that is needed for functional test" +DROPBEAR_OBJECT='{"parent_dm": "Device.", "object": "X_IOPSYS_EU_Dropbear"}' +jq --argjson newObj "$DROPBEAR_OBJECT" '.daemon.services += [$newObj]' "/etc/bbfdm/services/core.json" > /tmp/updated_core.json +mv /tmp/updated_core.json /etc/bbfdm/services/core.json + echo "Compiling icmwp" build_icwmp diff --git a/gitlab-ci/icwmp-base.conf b/gitlab-ci/icwmp-base.conf index 5df6e61..035e3ca 100644 --- a/gitlab-ci/icwmp-base.conf +++ b/gitlab-ci/icwmp-base.conf @@ -2,6 +2,10 @@ priority=3 command=/bin/bash -c "cd /tmp/firmware/ && python3 -m http.server 80" +[program:icwmp] +priority=12 +command=/bin/bash -c "/usr/bin/valgrind --xml=yes --xml-file=/tmp/memory-icwmp-report.xml --leak-check=full --show-reachable=yes --show-leak-kinds=all --errors-for-leak-kinds=all --error-exitcode=1 --track-origins=yes --leak-resolution=high --show-error-list=yes --child-silent-after-fork=yes /usr/sbin/dm-service -m icwmp" + [program:bbfdmd] priority=15 command=/bin/bash -c "/usr/sbin/bbfdmd" diff --git a/gitlab-ci/setup.sh b/gitlab-ci/setup.sh index 598e67a..f91de6a 100755 --- a/gitlab-ci/setup.sh +++ b/gitlab-ci/setup.sh @@ -6,6 +6,7 @@ pwd [ -d "/opt/dev/bbfdm" ] && cd /opt/dev/bbfdm && ./gitlab-ci/setup.sh && cd - cp -rf ./test/files/* / + echo "set ACS url in cwmp uci" url="http://acs:7547" uci set cwmp.acs.url=$url diff --git a/gitlab-ci/shared.sh b/gitlab-ci/shared.sh index 21dd5cb..fb4d7a8 100644 --- a/gitlab-ci/shared.sh +++ b/gitlab-ci/shared.sh @@ -126,6 +126,7 @@ function build_icwmp() exec_cmd make install [ -f "/usr/sbin/icwmpd" ] && rm /usr/sbin/icwmpd exec_cmd ln -s ${BINP}/src/icwmpd /usr/sbin/icwmpd + exec_cmd ln -s ${BINP}/bbf_plugin/libcwmpdm.so /usr/share/bbfdm/micro_services/icwmp.so cd .. } diff --git a/gitlab-ci/unit-test.sh b/gitlab-ci/unit-test.sh index ef1e41e..bbb81cd 100755 --- a/gitlab-ci/unit-test.sh +++ b/gitlab-ci/unit-test.sh @@ -13,13 +13,15 @@ echo "Compiling icmwp" build_icwmp echo "Starting dependent services" +supervisorctl reread supervisorctl update sleep 2 supervisorctl restart all -sleep 2 +sleep 5 supervisorctl stop icwmpd sleep 5 supervisorctl status all + ubus wait_for bbfdm echo "Clean cmocka" diff --git a/test/files/etc/bbfdm/services/icwmp.json b/test/files/etc/bbfdm/services/icwmp.json new file mode 100644 index 0000000..a973a4b --- /dev/null +++ b/test/files/etc/bbfdm/services/icwmp.json @@ -0,0 +1,25 @@ +{ + "daemon": { + "enable": "1", + "service_name": "icwmp", + "unified_daemon": false, + "services": [ + { + "parent_dm": "Device.", + "object": "ManagementServer" + }, + { + "parent_dm": "Device.", + "object": "CWMPManagementServer", + "proto": "usp" + }, + { + "parent_dm": "Device.", + "object": "XMPP" + } + ], + "config": { + "loglevel": "3" + } + } +}