Use relative paths for the module tests

This commit is contained in:
vdutta 2022-02-18 10:56:24 +05:30 committed by Vivek Kumar Dutta
parent e6ff70f5d5
commit d0fc18c07a
11 changed files with 63 additions and 17 deletions

View file

@ -2,6 +2,12 @@ include:
- project: 'iopsys/gitlab-ci-pipeline'
file: '/static-code-analysis.yml'
variables:
DEBUG: 'TRUE'
SOURCE_FOLDER: "."
COMMON_IMAGE: iopsys/code-analysis:0.26
RUN_CPPCHECK: "cppcheck --enable=style --error-exitcode=1 -DBBF_VENDOR_IOPSYS -DBBF_VENDOR_OPENWRT --suppress=unreadVariable --suppress=knownConditionTrueFalse --suppress=nullPointerRedundantCheck --suppress=unknownMacro --suppress=internalAstError"
stages:
- static_code_analysis
- unit_test
@ -9,11 +15,6 @@ stages:
- memory_test
- uspd
variables:
DEBUG: 'TRUE'
SOURCE_FOLDER: "."
RUN_CPPCHECK: "cppcheck --enable=all --error-exitcode=1 -DBBF_VENDOR_IOPSYS -DBBF_VENDOR_OPENWRT --include=/usr/local/include/json-c/json.h -I./include/ --suppress=unusedFunction --suppress=unreadVariable --suppress=knownConditionTrueFalse --suppress=nullPointerRedundantCheck --suppress=unknownMacro --suppress=internalAstError"
run_unit_test:
stage: unit_test
image: iopsys/code-analysis:latest

View file

@ -4,6 +4,11 @@ echo "Functional API Tests"
pwd
source ./gitlab-ci/shared.sh
echo "Starting supervisor in current directory"
supervisorctl shutdown
sleep 1
supervisord -c supervisord.conf
# compile and install libbbf
install_libbbf

View file

@ -4,6 +4,11 @@ echo "Functional Tests"
pwd
source ./gitlab-ci/shared.sh
echo "Starting supervisor in current directory"
supervisorctl shutdown
sleep 1
supervisord -c supervisord.conf
# compile and install libbbf
install_libbbf

View file

@ -1,17 +1,19 @@
[program:ubusd]
autorestart=false
numprocs_start=0
startretries=0
priority=1
command=/bin/bash -c "/usr/sbin/ubusd"
[program:rpcd]
autorestart=false
numprocs_start=1
startretries=0
priority=2
command=/bin/bash -c "/usr/sbin/rpcd"
[program:bbf_ubus]
autorestart=false
numprocs_start=2
priority=3
stdout_logfile=/builds/iopsys/bbf/log_file
command=/bin/bash -c "/usr/bin/valgrind --xml=yes --xml-file=/builds/iopsys/bbf/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 /builds/iopsys/bbf/test/dynamicdm_ubus_test/bbf_ubus"
command=/bin/bash -c "/usr/bin/valgrind --xml=yes --xml-file=./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 ./test/dynamicdm_ubus_test/bbf_ubus"

View file

@ -2,9 +2,13 @@
echo "$0 preparation script"
pwd
source ./gitlab-ci/shared.sh
echo "Starting supervisor in current directory"
supervisorctl shutdown
sleep 1
supervisord -c supervisord.conf
# clean and make
# compile and install libbbf
install_libbbf

View file

@ -2,7 +2,12 @@
echo "Functional API Tests"
pwd
source ./gitlab-ci/shared.sh
. ./gitlab-ci/shared.sh
echo "Starting supervisor in current directory"
supervisorctl shutdown
sleep 1
supervisord -c supervisord.conf
# install required packages
exec_cmd apt update
@ -27,7 +32,7 @@ ret=0
function run_valgrind()
{
echo "Running bbf_dm $1 in valgrind"
valgrind --xml=yes --xml-file=/builds/iopsys/bbf/$2 --leak-check=full --show-reachable=yes --show-leak-kinds=all --errors-for-leak-kinds=all --error-exitcode=1 --track-origins=yes /builds/iopsys/bbf/test/bbf_test/bbf_dm $1 > /builds/iopsys/bbf/$3
valgrind --xml=yes --xml-file=$2 --leak-check=full --show-reachable=yes --show-leak-kinds=all --errors-for-leak-kinds=all --error-exitcode=1 --track-origins=yes ./test/bbf_test/bbf_dm $1 > $3
ret=$(( ret + $? ))
}

View file

@ -1,7 +1,6 @@
#!/bin/bash
echo "preparation script"
pwd
# link '/bin/sh' to bash instead of dash
@ -13,7 +12,5 @@ cp -r ./test/files/var/* /var/
cp -r ./test/files/tmp/* /tmp/
cp -r ./test/files/lib/* /lib/
cp ./gitlab-ci/iopsys-supervisord.conf /etc/supervisor/conf.d/
ls /etc/config/
ls /etc/supervisor/conf.d/

View file

@ -1,5 +1,9 @@
#!/bin/bash
if [ -z "${CI_PROJECT_PATH}" ]; then
CI_PROJECT_PATH=${PWD}
fi
function check_ret()
{
ret=$1

View file

@ -2,7 +2,12 @@
echo "Unit Tests"
pwd
source ./gitlab-ci/shared.sh
. ./gitlab-ci/shared.sh
echo "Starting supervisor in current directory"
supervisorctl shutdown
sleep 1
supervisord -c supervisord.conf
# compile and install libbbf
install_libbbf

18
supervisord.conf Normal file
View file

@ -0,0 +1,18 @@
[supervisord]
logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false ; true to run in foreground
[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)
chmod=0700 ; sockef file mode (default 0700)
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
[include]
files = ./gitlab-ci/iopsys-supervisord.conf

View file

@ -7,9 +7,9 @@
#include <libbbf_api/dmuci.h>
#include <libbbfdm/dmentry.h>
#define DROPBEAR_FILE_PATH "/builds/iopsys/bbf/test/files/etc/bbfdm/json/X_IOPSYS_EU_Dropbear.json"
#define DROPBEAR_FILE_PATH "../files/etc/bbfdm/json/X_IOPSYS_EU_Dropbear.json"
#define DROPBEAR_JSON_PATH "/etc/bbfdm/json/X_IOPSYS_EU_Dropbear.json"
#define LIBBBF_TEST_PATH "/builds/iopsys/bbf/test/bbf_test/libbbf_test.so"
#define LIBBBF_TEST_PATH "../bbf_test/libbbf_test.so"
#define LIBBBF_TEST_BBFDM_PATH "/usr/lib/bbfdm/libbbf_test.so"
static struct ubus_context *ubus_ctx = NULL;