diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7e74867f..6202b71e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,7 +30,6 @@ run_unit_test: artifacts: when: always paths: - - timestamp.log - unit-test-coverage.xml run_tools_test: @@ -43,7 +42,6 @@ run_tools_test: artifacts: when: always paths: - - timestamp.log - tools/out/datamodel_default.xml - tools/out/datamodel_hdm.xml - tools/out/datamodel.xls @@ -60,7 +58,6 @@ run_libbbfdm_api_functional_test: artifacts: when: always paths: - - timestamp.log - functional-api-test-coverage.xml run_libbbfdm_functional_test: @@ -75,7 +72,6 @@ run_libbbfdm_functional_test: artifacts: when: always paths: - - timestamp.log - functional-test-coverage.xml run_libbbfdm_memory_test: @@ -89,7 +85,6 @@ run_libbbfdm_memory_test: artifacts: when: always paths: - - timestamp.log - output-report-device-get.txt run_bbfd_functional_test: @@ -107,6 +102,5 @@ run_bbfd_functional_test: paths: - funl-result.log - funl-test-coverage.xml - - /tmp/memory-report.xml - - timestamp.log + - memory-report.xml - report/ diff --git a/gitlab-ci/iopsys-supervisord.conf b/gitlab-ci/bbfdm_services.conf old mode 100755 new mode 100644 similarity index 92% rename from gitlab-ci/iopsys-supervisord.conf rename to gitlab-ci/bbfdm_services.conf index 9ed06c2a..c99ebb67 --- a/gitlab-ci/iopsys-supervisord.conf +++ b/gitlab-ci/bbfdm_services.conf @@ -1,17 +1,15 @@ -[program:ubusd] -command=/bin/bash -c "/usr/sbin/ubusd" - -[program:rpcd] -command=/bin/bash -c "/usr/sbin/rpcd" - [program:bbfdmd] +priority=10 command=/bin/bash -c "/usr/bin/valgrind --xml=yes --xml-file=/tmp/memory-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/bbfdmd" [program:bbfdm_dataelementsd] +priority=11 command=/bin/bash -c "/usr/bin/valgrind --xml=yes --xml-file=/tmp/memory-report-dataelements.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/bbfdmd -m /tmp/wifi_dataelements.json" [program:bbfdm_bulkdatad] +priority=12 command=/bin/bash -c "/usr/bin/valgrind --xml=yes --xml-file=/tmp/memory-report-bulkdata.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/bbfdmd -m /etc/bulkdata/input.json" [program:bbfdm_periodicstatsd] +priority=13 command=/bin/bash -c "/usr/bin/valgrind --xml=yes --xml-file=/tmp/memory-report-periodicstats.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/bbfdmd -m /etc/periodicstats/input.json" diff --git a/gitlab-ci/bbfdmd-functional-test.sh b/gitlab-ci/bbfdmd-functional-test.sh index 28e74f2b..096407a9 100755 --- a/gitlab-ci/bbfdmd-functional-test.sh +++ b/gitlab-ci/bbfdmd-functional-test.sh @@ -5,15 +5,15 @@ pwd source ./gitlab-ci/shared.sh -echo "Starting supervisor" -supervisorctl shutdown -sleep 1 -supervisord -c /etc/supervisor/supervisord.conf -sleep 3 +echo "Starting services..." +cp ./gitlab-ci/bbfdm_services.conf /etc/supervisor/conf.d/ + +supervisorctl reread +supervisorctl update +sleep 10 supervisorctl status all exec_cmd ubus wait_for bbfdm -supervisorctl status all # debug logging echo "Checking ubus status [$(date '+%d/%m/%Y %H:%M:%S')]" @@ -54,8 +54,8 @@ supervisorctl status #report part gcovr -r . --xml -o ./funl-test-coverage.xml gcovr -r . -date +%s > timestamp.log +echo > memory-report.xml check_valgrind_xml "Main Service bbfdmd" "/tmp/memory-report.xml" check_valgrind_xml "Micro Service bbfdm_dataelementsd" "/tmp/memory-report-dataelements.xml" check_valgrind_xml "Micro Service bbfdm_bulkdatad" "/tmp/memory-report-bulkdata.xml" diff --git a/gitlab-ci/core_service.conf b/gitlab-ci/core_service.conf new file mode 100644 index 00000000..a7193d1f --- /dev/null +++ b/gitlab-ci/core_service.conf @@ -0,0 +1,7 @@ +[program:ubusd] +priority=1 +command=/bin/bash -c "/usr/sbin/ubusd" + +[program:rpcd] +priority=2 +command=/bin/bash -c "/usr/sbin/rpcd" diff --git a/gitlab-ci/functional-api-test.sh b/gitlab-ci/functional-api-test.sh index c04d13f6..ddaacbab 100755 --- a/gitlab-ci/functional-api-test.sh +++ b/gitlab-ci/functional-api-test.sh @@ -4,12 +4,6 @@ echo "Functional API Tests" pwd source ./gitlab-ci/shared.sh -echo "Starting supervisor" -supervisorctl shutdown -sleep 1 -supervisord -c /etc/supervisor/supervisord.conf -sleep 3 - supervisorctl status all echo "Running the functional API test cases" @@ -25,6 +19,5 @@ supervisorctl status gcovr -r . 2> /dev/null #throw away stderr # Artefact gcovr -r . 2> /dev/null --xml -o ./functional-api-test-coverage.xml -date +%s > timestamp.log echo "Functional API Test :: PASS" diff --git a/gitlab-ci/functional-test.sh b/gitlab-ci/functional-test.sh index 3c0342a2..43525774 100755 --- a/gitlab-ci/functional-test.sh +++ b/gitlab-ci/functional-test.sh @@ -4,12 +4,6 @@ echo "Functional Tests" pwd source ./gitlab-ci/shared.sh -echo "Starting supervisor" -supervisorctl shutdown -sleep 1 -supervisord -c /etc/supervisor/supervisord.conf -sleep 3 - supervisorctl status all echo "Running the functional test cases" @@ -25,6 +19,5 @@ supervisorctl status gcovr -r . 2> /dev/null #throw away stderr # Artefact gcovr -r . 2> /dev/null --xml -o ./functional-test-coverage.xml -date +%s > timestamp.log echo "Functional Test :: PASS" diff --git a/gitlab-ci/install-dependencies.sh b/gitlab-ci/install-dependencies.sh index c1bcd314..4107c649 100755 --- a/gitlab-ci/install-dependencies.sh +++ b/gitlab-ci/install-dependencies.sh @@ -5,9 +5,9 @@ echo "install dependencies of bbf" source ./gitlab-ci/shared.sh # install required packages -apt update -apt install -y python3-pip iproute2 libmxml-dev uuid-dev zip -pip3 install pexpect ubus +exec_cmd apt update +exec_cmd apt install -y python3-pip iproute2 libmxml-dev uuid-dev zip +exec_cmd pip3 install pexpect ubus # compile and install libbbf install_libbbf ${1} @@ -42,6 +42,3 @@ if [ -z "${1}" ]; then # install cwmpdm plugin install_libcwmpdm fi - -ls /usr/lib/bbfdm/ -ls /etc/bbfdm/json/ diff --git a/gitlab-ci/memory-test.sh b/gitlab-ci/memory-test.sh index 259a8cf6..84d5fab8 100755 --- a/gitlab-ci/memory-test.sh +++ b/gitlab-ci/memory-test.sh @@ -4,15 +4,15 @@ echo "Functional API Tests" pwd . ./gitlab-ci/shared.sh -date +%s > timestamp.log +echo "Starting services..." +cp ./gitlab-ci/bbfdm_services.conf /etc/supervisor/conf.d/ -echo "Starting supervisor" -supervisorctl shutdown -sleep 1 -supervisord -c /etc/supervisor/supervisord.conf -sleep 3 +supervisorctl reread +supervisorctl update +sleep 10 supervisorctl status all +exec_cmd ubus wait_for bbfdm function run_valgrind() { diff --git a/gitlab-ci/setup.sh b/gitlab-ci/setup.sh index dc913108..30893b29 100755 --- a/gitlab-ci/setup.sh +++ b/gitlab-ci/setup.sh @@ -1,7 +1,6 @@ #!/bin/bash -echo "preparation script" -pwd +echo "# Preparation script ..." # link '/bin/sh' to bash instead of dash ln -sf bash /bin/sh @@ -12,8 +11,11 @@ cp -r ./test/files/var/* /var/ cp -r ./test/files/tmp/* /tmp/ cp -r ./test/files/lib/* /lib/ -[ -z "${1}" ] && cp ./gitlab-ci/iopsys-supervisord.conf /etc/supervisor/conf.d/ +cp ./gitlab-ci/core_service.conf /etc/supervisor/conf.d/ rm -f /etc/bbfdm/dmmap/* -ls /etc/config/ +echo "Starting base services..." +supervisorctl reread +supervisorctl update +sleep 10 diff --git a/gitlab-ci/shared.sh b/gitlab-ci/shared.sh index 6cc07cae..3a4a151c 100755 --- a/gitlab-ci/shared.sh +++ b/gitlab-ci/shared.sh @@ -73,7 +73,7 @@ function install_libbbf() mkdir -p build cd build - cmake ../ -DCMAKE_C_FLAGS="$COV_CFLAGS " -DCMAKE_EXE_LINKER_FLAGS="$COV_LDFLAGS" -DWITH_OPENSSL=ON -DBBF_JSON_PLUGIN=ON -DBBF_DOTSO_PLUGIN=ON -DBBF_VENDOR_EXTENSION=ON -DBBF_WIFI_DATAELEMENTS=OFF -DBBF_VENDOR_LIST="$VENDOR_LIST" -DBBF_VENDOR_PREFIX="$VENDOR_PREFIX" -DBBF_MAX_OBJECT_INSTANCES=255 -DBBFDMD_MAX_MSG_LEN=1048576 -DCMAKE_INSTALL_PREFIX=/ + cmake ../ -DCMAKE_C_FLAGS="$COV_CFLAGS " -DCMAKE_EXE_LINKER_FLAGS="$COV_LDFLAGS -lm" -DWITH_OPENSSL=ON -DBBF_JSON_PLUGIN=ON -DBBF_DOTSO_PLUGIN=ON -DBBF_VENDOR_EXTENSION=ON -DBBF_WIFI_DATAELEMENTS=OFF -DBBF_VENDOR_LIST="$VENDOR_LIST" -DBBF_VENDOR_PREFIX="$VENDOR_PREFIX" -DBBF_MAX_OBJECT_INSTANCES=255 -DBBFDMD_MAX_MSG_LEN=1048576 -DCMAKE_INSTALL_PREFIX=/ exec_cmd_verbose make echo "installing libbbf" @@ -165,6 +165,8 @@ function error_on_zero() } function check_valgrind_xml() { + cat ${1} >> memory-report.xml + echo "${1}: Checking memory leaks..." echo "checking UninitCondition" grep -q "UninitCondition" ${2} @@ -182,6 +184,5 @@ function check_valgrind_xml() { function generate_report() { exec_cmd tap-junit --name "${1}" --input "${2}" --output report - sync } diff --git a/gitlab-ci/tools-test.sh b/gitlab-ci/tools-test.sh index c9369c1f..bb1e5129 100755 --- a/gitlab-ci/tools-test.sh +++ b/gitlab-ci/tools-test.sh @@ -6,11 +6,8 @@ source ./gitlab-ci/shared.sh # install required packages exec_cmd apt update -exec_cmd apt install -y python3-pip -exec_cmd apt install -y libxml2-utils -exec_cmd pip3 install jsonschema -exec_cmd pip3 install xlwt -exec_cmd pip3 install pylint +exec_cmd apt install -y python3-pip libxml2-utils +exec_cmd pip3 install jsonschema xlwt pylint echo "Validating PEP8 syntax on tools" exec_cmd_verbose pylint -d R,C,W0603 tools/*.py diff --git a/libbbfdm/dmtree/tr181/wifi.c b/libbbfdm/dmtree/tr181/wifi.c index 3e7b5723..1d381dbb 100644 --- a/libbbfdm/dmtree/tr181/wifi.c +++ b/libbbfdm/dmtree/tr181/wifi.c @@ -12,6 +12,8 @@ * */ +#include + #include "wifi.h" #ifdef BBF_WIFI_DATAELEMENTS