Added functional api test

This commit is contained in:
vdutta 2021-06-03 17:22:30 +05:30
parent 33ba4343cc
commit be51cda3c4
8 changed files with 242 additions and 81 deletions

3
.gitignore vendored
View file

@ -31,4 +31,5 @@ missing
/config.sub
/libtool
/ltmain.sh
*.gcno
*.gcda

View file

@ -42,3 +42,4 @@ run_api_test:
- timestamp.log
- api-test-coverage.xml
- memory-report.xml
- api-result.log

View file

@ -9,30 +9,28 @@ trap cleanup SIGINT
date +%s > timestamp.log
echo "Compiling icmwp"
autoreconf -i
./configure --enable-acs=multi --enable-debug
make clean
make
check_ret $?
build_cwmp
echo "Starting dependent services"
supervisorctl status all
supervisorctl update
supervisorctl restart all
ubus wait_for usp.raw
exec_cmd ubus wait_for usp.raw tr069
supervisorctl status all
echo "Running the api test cases"
ubus call tr069 status
ubus-api-validator -f ./test/api/json/tr069.validation.json > ./api-result.log
check_ret $?
echo "Stop dependent services"
echo "Stop all services"
supervisorctl stop all
#report part
#GitLab-CI output
gcovr -r .
# Artefact
gcovr -r . --xml -o ./api-test-coverage.xml
#gcovr -r . --xml -o ./api-test-coverage.xml
#GitLab-CI output
#gcovr -r .
#report part
exec_cmd tap-junit --input ./api-result.log --output report
echo "Checking memory leaks ..."
grep -q "<kind>UninitCondition</kind>" memory-report.xml

View file

@ -6,3 +6,6 @@ pwd
cp ./gitlab-ci/iopsys-supervisord.conf /etc/supervisor/conf.d/
cp -rf ./test/files/* /
# copy schema for validation test
cp -r ./schemas/ubus/*.json /usr/share/rpcd/schemas/

View file

@ -34,4 +34,19 @@ function exec_cmd()
echo "Failed to execute $@"
exit 1
fi
}
}
function build_cwmp()
{
COV_CFLAGS='-g -O0'
#COV_CFLAGS='-g -O0 -fprofile-arcs -ftest-coverage'
#COV_LDFLAGS='--coverage'
make clean >/dev/null 2>&1
# compile obuspa
autoreconf -i
./configure CFLAGS="$COV_CFLAGS" LDFLAGS="$COV_LDFLAGS" --enable-acs=multi --enable-debug
make
check_ret $?
}

View file

@ -0,0 +1,210 @@
{
"object": "tr069",
"methods": [
{
"method": "hello",
"rc": 3
},
{
"method": "status",
"rc": 0
},
{
"method": "command",
"args": {
},
"rc": 2
},
{
"method": "status",
"rc": 0
},
{
"method": "inform",
"args": {
},
"rc": 0
},
{
"method": "status",
"rc": 0
},
{
"method": "inform",
"args": {
"GetRPCMethods": "true"
},
"rc": 0
},
{
"method": "status",
"rc": 0
},
{
"method": "inform",
"args": {
"GetRPCMethods": "false"
},
"rc": 0
},
{
"method": "inform",
"args": {
"event": "1 BOOT"
},
"rc": 0
},
{
"method": "inform",
"args": {
"event": "2 PERIODIC"
},
"rc": 0
},
{
"method": "inform",
"args": {
"event": "3 SCHEDULED"
},
"rc": 0
},
{
"method": "status",
"rc": 0
},
{
"method": "inform",
"args": {
"event": "4 VALUE CHANGE"
},
"rc": 0
},
{
"method": "inform",
"args": {
"event": "6 CONNECTION REQUEST"
},
"rc": 0
},
{
"method": "status",
"rc": 0
},
{
"method": "inform",
"args": {
"event": "8 DIAGNOSTICS COMPLETE"
},
"rc": 0
},
{
"method": "status",
"rc": 0
},
{
"method": "inform",
"args": {
"GetRPCMethods": "true",
"event": "1 BOOT"
},
"rc": 0
},
{
"method": "status",
"rc": 0
},
{
"method": "inform",
"args": {
"GetRPCMethods": "true",
"event": "2 PERIODIC"
},
"rc": 0
},
{
"method": "inform",
"args": {
"GetRPCMethods": "true",
"event": "3 SCHEDULED"
},
"rc": 0
},
{
"method": "status",
"rc": 0
},
{
"method": "inform",
"args": {
"GetRPCMethods": "true",
"event": "4 VALUE CHANGE"
},
"rc": 0
},
{
"method": "inform",
"args": {
"GetRPCMethods": "true",
"event": "6 CONNECTION REQUEST"
},
"rc": 0
},
{
"method": "status",
"rc": 0
},
{
"method": "inform",
"args": {
"GetRPCMethods": "true",
"event": "8 DIAGNOSTICS COMPLETE"
},
"rc": 0
},
{
"method": "inform",
"args": {
"event": "0 garbage"
},
"rc": 0
},
{
"method": "status",
"rc": 0
},
{
"method": "command",
"args": {
"command": "reload_end_session"
},
"rc": 0
},
{
"method": "status",
"rc": 0
},
{
"method": "command",
"args": {
"command": "action_end_session"
},
"rc": 0
},
{
"method": "status",
"rc": 0
},
{
"method": "command",
"args": {
"command": "garbage"
},
"rc": 0
},
{
"method": "status",
"rc": 0
}
]
}

View file

@ -1,4 +0,0 @@
config uspd 'usp'
option granularitylevel '0'
option debug '0'
option loglevel '1'

View file

@ -1,63 +0,0 @@
#!/bin/sh /etc/rc.common
START=98
STOP=10
USE_PROCD=1
PROG=/usr/sbin/uspd
validate_uspd_usp_section()
{
uci_validate_section uspd uspd "usp" \
'enabled:bool:true' \
'granularitylevel:uinteger' \
'debug:bool:false' \
'loglevel:uinteger' \
'sock:string' \
'transaction_timeout:string'
}
configure_uspd()
{
local enabled debug sock transaction_timeout
config_load uspd
validate_uspd_usp_section || {
log "Validation of usp section failed"
return 1;
}
[ ${enabled} -eq 0 ] && exit 0
if [ ${debug} -eq 1 ]; then
procd_set_param stdout 1
procd_set_param stderr 1
fi
if [ -n "${sock}" ]; then
procd_append_param command -s ${sock}
fi
if [ -n "${transaction_timeout}" ]; then
procd_append_param command -t ${transaction_timeout}
fi
}
start_service() {
procd_open_instance usp
procd_set_param command ${PROG}
configure_uspd
procd_set_param respawn
procd_close_instance
}
reload_service() {
stop
start
}
service_triggers()
{
procd_add_config_trigger "config.change" "uspd" /etc/init.d/uspd restart
}