fix functional test and improvements

This commit is contained in:
suvendhu 2022-06-22 14:39:17 +05:30
parent ea2e94fea0
commit 887c2db3e1
6 changed files with 44 additions and 28 deletions

View file

@ -23,6 +23,8 @@ echo "Running the api test cases"
ubus-api-validator -f ./test/api/json/tr069.validation.json > ./api-test-result.log
check_ret $?
sleep 5
echo "Stop all services"
supervisorctl stop icwmpd
@ -36,14 +38,6 @@ cp ./memory-report.xml ./api-test-memory-report.xml
#report part
exec_cmd tap-junit --input ./api-test-result.log --output report
echo "Checking memory leaks ..."
grep -q "<kind>UninitCondition</kind>" memory-report.xml
error_on_zero $?
grep -q "<kind>Leak_PossiblyLost</kind>" memory-report.xml
error_on_zero $?
grep -q "<kind>Leak_DefinitelyLost</kind>" memory-report.xml
error_on_zero $?
check_valgrind_xml
echo "Functional API test :: PASS"

View file

@ -72,17 +72,6 @@ cp ./memory-report.xml ./funl-test-memory-report.xml
#report part
exec_cmd tap-junit --input ./funl-test-result.log --output report
echo "Checking memory leaks..."
grep -q "<kind>UninitCondition</kind>" memory-report.xml
error_on_zero $?
grep -q "<kind>Leak_PossiblyLost</kind>" memory-report.xml
error_on_zero $?
grep -q "<kind>Leak_DefinitelyLost</kind>" memory-report.xml
error_on_zero $?
grep -q "<kind>Leak_StillReachable</kind>" memory-report.xml
error_on_zero $?
check_valgrind_xml
echo "Functional test :: PASS"

View file

@ -138,3 +138,18 @@ function install_uspd()
exec_cmd make
exec_cmd cp uspd /usr/sbin/uspd
}
function check_valgrind_xml() {
echo "Checking memory leaks..."
grep -q "<kind>UninitCondition</kind>" memory-report.xml
error_on_zero $?
grep -q "<kind>Leak_PossiblyLost</kind>" memory-report.xml
error_on_zero $?
grep -q "<kind>Leak_DefinitelyLost</kind>" memory-report.xml
error_on_zero $?
grep -q "<kind>Leak_StillReachable</kind>" memory-report.xml
error_on_zero $?
}

2
http.c
View file

@ -304,6 +304,7 @@ static void http_cr_new_client(int client, bool service_available)
char *username = cwmp_main.conf.cpe_userid;
char *password = cwmp_main.conf.cpe_passwd;
memset(auth_digest_buffer, 0, BUFSIZ);
if (!username || !password) {
// if we dont have username or password configured proceed with connecting to ACS
service_available = false;
@ -326,6 +327,7 @@ static void http_cr_new_client(int client, bool service_available)
if (!service_available || !method_is_get) {
goto http_end;
}
int auth_check = validate_http_digest_auth("GET", "/", auth_digest_buffer + strlen("Authorization: Digest "), REALM, username, password, 300);
if (auth_check == -1) { /* invalid nonce */
internal_error = true;

View file

@ -22,11 +22,13 @@ exec_cmd uci set cwmp.cpe.custom_notify_json="/etc/icwmpd/custom_notification_va
uci commit cwmp
supervisorctl start icwmpd
sleep 7
check_cwmp_status
sleep 2
supervisorctl stop icwmpd
check_valgrind_xml
notif1=`uci -c /var/state get cwmp.@notifications[0].active | grep "Device.Users."`
if [[ $notif1 != *"Device.Users."* ]]; then
echo "FAIL: active notifications list doesn't contain Device.Users. parameter"
@ -53,9 +55,13 @@ exec_cmd uci set cwmp.cpe.custom_notify_json="/etc/icwmpd/custom_notification_in
uci commit cwmp
supervisorctl start icwmpd
sleep 7
check_cwmp_status
sleep 2
supervisorctl stop icwmpd
check_valgrind_xml
notif1=`uci -c /var/state get cwmp.@notifications[0].active | grep "Device.Users."`
if [[ $notif1 == *"Device.Users."* ]]; then
echo "FAIL: the json file is invalid, the active notifcation list shouldn't contain Device.Users. parameter"
@ -88,9 +94,12 @@ exec_cmd uci set cwmp.cpe.custom_notify_json="/etc/icwmpd/custom_notification_fo
uci commit cwmp
supervisorctl start icwmpd
sleep 7
check_cwmp_status
sleep 2
supervisorctl stop icwmpd
check_valgrind_xml
notif1=`uci -c /var/state get cwmp.@notifications[0].active | grep "Device.Users."`
if [[ $notif1 != *"Device.Users."* ]]; then
echo "FAIL: active notifications list doesn't contain Device.Users. parameter"
@ -123,9 +132,12 @@ exec_cmd uci set cwmp.cpe.custom_notify_json="/etc/icwmpd/custom_notification_in
uci commit cwmp
supervisorctl start icwmpd
sleep 7
check_cwmp_status
sleep 2
supervisorctl stop icwmpd
check_valgrind_xml
notif1=`uci -c /var/state get cwmp.@notifications[0].active | grep "Device.Users."`
if [[ $notif1 != *"Device.Users."* ]]; then
echo "FAIL: active notifications list doesn't contain Device.Users. parameter"

View file

@ -22,8 +22,12 @@ fi
rm /etc/icwmpd/dm_enabled_notify
remove_icwmp_log
echo "Restarting icwmpd in order to apply the new firmware" >> ./funl-test-debug.log
supervisorctl restart icwmpd >> ./funl-test-debug.log
sleep 5
supervisorctl stop icwmpd >> ./funl-test-debug.log
check_valgrind_xml
supervisorctl start icwmpd >> ./funl-test-debug.log
check_cwmp_status
sleep 2
check_session "TransferComplete"
received_command_key=$(print_tag_value "cwmp:TransferComplete" "CommandKey")
if [ "$sent_command_key" != "$received_command_key" ]; then