Optimize module test

This commit is contained in:
Vivek Kumar Dutta 2023-09-05 16:46:52 +05:30
parent d6931cff6c
commit 8610bef0a3
No known key found for this signature in database
GPG key ID: 65C818099F37097D
12 changed files with 41 additions and 57 deletions

View file

@ -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/

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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/

View file

@ -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()
{

View file

@ -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

View file

@ -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 "<kind>UninitCondition</kind>" ${2}
@ -182,6 +184,5 @@ function check_valgrind_xml() {
function generate_report()
{
exec_cmd tap-junit --name "${1}" --input "${2}" --output report
sync
}

View file

@ -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

View file

@ -12,6 +12,8 @@
*
*/
#include <math.h>
#include "wifi.h"
#ifdef BBF_WIFI_DATAELEMENTS