diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d3ba5e1..825793b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -51,3 +51,5 @@ run_functional_test: - memory-report.xml - memory-report-download.xml - icwmpd_debug.txt + - bbf*.log + - core*.log diff --git a/gitlab-ci/functional-api-test.sh b/gitlab-ci/functional-api-test.sh index f7d1bcf..56ba627 100755 --- a/gitlab-ci/functional-api-test.sh +++ b/gitlab-ci/functional-api-test.sh @@ -8,11 +8,6 @@ pwd trap cleanup EXIT trap cleanup SIGINT -echo "Add X_IOWRT_EU_Dropbear Object that is needed for functional test" -DROPBEAR_OBJECT='{"parent_dm": "Device.", "object": "X_IOWRT_EU_Dropbear"}' -jq --argjson newObj "$DROPBEAR_OBJECT" '.daemon.services += [$newObj]' "/etc/bbfdm/services/core.json" > /tmp/updated_core.json -mv /tmp/updated_core.json /etc/bbfdm/services/core.json - supervisorctl restart bbfdmd echo "Compiling icmwp" @@ -63,11 +58,12 @@ for test in $(cat test/script/run_sequence.txt); do remove_icwmp_log echo "#### $test Ended with error ####" >> "$icwmp_master_log" echo "#### $test Ended with error ####" + exit 1 fi - sleep 1 + sleep 5 done -echo "Stop all services" +echo "Stop icwmpd service only" sleep 10 supervisorctl stop icwmpd diff --git a/gitlab-ci/shared.sh b/gitlab-ci/shared.sh index 13d01c0..e3a60cc 100644 --- a/gitlab-ci/shared.sh +++ b/gitlab-ci/shared.sh @@ -9,6 +9,8 @@ function log() function cleanup() { echo "" + supervisorctl stop all + cp /var/log/supervisor/*.log . } function check_ret() @@ -126,8 +128,8 @@ function build_icwmp() exec_cmd cp bbf_plugin/libcwmpdm.so ../bbf_plugin/ exec_cmd make install [ -f "/usr/sbin/icwmpd" ] && rm /usr/sbin/icwmpd - exec_cmd ln -s ${BINP}/src/icwmpd /usr/sbin/icwmpd - exec_cmd ln -s ${BINP}/bbf_plugin/libcwmpdm.so /usr/share/bbfdm/micro_services/icwmp.so + exec_cmd ln -sf ${BINP}/src/icwmpd /usr/sbin/icwmpd + exec_cmd ln -sf ${BINP}/bbf_plugin/libcwmpdm.so /usr/share/bbfdm/micro_services/icwmp.so cd .. } @@ -150,19 +152,6 @@ function check_valgrind_xml() { echo "Checking memory leaks..." cp /tmp/memory-report.xml memory-report.xml - echo "checking UninitCondition" - grep -q "UninitCondition" /tmp/memory-report.xml - error_on_zero $? - - echo "checking Leak_PossiblyLost" - grep -q "Leak_PossiblyLost" /tmp/memory-report.xml - error_on_zero $? - - echo "checking Leak_DefinitelyLost" - grep -q "Leak_DefinitelyLost" /tmp/memory-report.xml - error_on_zero $? - - echo "checking Leak_StillReachable" - grep -q "Leak_StillReachable" /tmp/memory-report.xml - error_on_zero $? + valgrind-ci memory-report.xml --summary + exec_cmd valgrind-ci memory-report.xml --abort-on-errors } diff --git a/src/datamodel_interface.c b/src/datamodel_interface.c index 7fbbea3..243bc15 100755 --- a/src/datamodel_interface.c +++ b/src/datamodel_interface.c @@ -755,11 +755,15 @@ int cwmp_set_parameter_value(const char *parameter_name, const char *parameter_v .status = true }; - if (param_len == 0 || parameter_name[param_len - 1] == '.' || parameter_value == NULL) + if (param_len == 0 || parameter_name[param_len - 1] == '.' || parameter_value == NULL) { + CWMP_LOG(ERROR, "Invalid inputs"); return FAULT_CPE_INVALID_ARGUMENTS; + } - if (CWMP_OK != instantiate_param_name(parameter_name, &inst_path)) + if (CWMP_OK != instantiate_param_name(parameter_name, &inst_path)) { + CWMP_LOG(ERROR, "Invalid instance entry"); return FAULT_CPE_INVALID_ARGUMENTS; + } CWMP_MEMSET(&b, 0, sizeof(struct blob_buf)); blob_buf_init(&b, 0); @@ -782,7 +786,7 @@ int cwmp_set_parameter_value(const char *parameter_name, const char *parameter_v } if (set_result.status == false) { - CWMP_LOG(INFO, "Set parameter value of %s with %s value is failed", parameter_name, parameter_value); + CWMP_LOG(ERROR, "Set parameter value of %s with %s value is failed", parameter_name, parameter_value); FREE(inst_path); return FAULT_CPE_INVALID_ARGUMENTS; } diff --git a/test/script/03_verify_set_method.sh b/test/script/03_verify_set_method.sh index bc08d70..5d08096 100755 --- a/test/script/03_verify_set_method.sh +++ b/test/script/03_verify_set_method.sh @@ -4,22 +4,23 @@ source ./test/script/common.sh source ./gitlab-ci/shared.sh TEST_NAME="SET RPC Method" +PARAM="Device.Schedules.Schedule.1.Enable" echo "Running: $TEST_NAME" remove_icwmp_log -curl $connection_request_path -X POST --data '{"name": "getParameterValues", "parameterNames": ["Device.X_IOWRT_EU_Dropbear.1.PasswordAuth"] }' >/dev/null 2>&1 +curl $connection_request_path -X POST --data '{"name": "getParameterValues", "parameterNames": ["'${PARAM}'"] }' >/dev/null 2>&1 check_ret $? wait_for_session_end check_session "GetParameterValues" param_value_before=$(print_tag_value "cwmp:GetParameterValuesResponse" "Value xsi:type=\"xsd:boolean\"") -if [ "$param_value_before" != "1" ]; then - echo "Error: Default value of 'Device.X_IOWRT_EU_Dropbear.1.PasswordAuth' is wrong, current_value($param_value_before) expected_value(1)" >> ./funl-test-debug.log +if [ "$param_value_before" != "0" ]; then + echo "Error: Default value of [${PARAM}] is wrong, current_value($param_value_before) expected_value(1)" >> ./funl-test-debug.log exit 1 fi remove_icwmp_log -curl $connection_request_path -X POST --data '{"name": "setParameterValues", "parameterValues": [["Device.X_IOWRT_EU_Dropbear.1.PasswordAuth",false]]}' >/dev/null 2>&1 +curl $connection_request_path -X POST --data '{"name": "setParameterValues", "parameterValues": [["'${PARAM}'",true]]}' >/dev/null 2>&1 check_ret $? wait_for_session_end check_session "SetParameterValues" @@ -30,17 +31,17 @@ if [ "$get_status" != "0" ]; then fi remove_icwmp_log -curl $connection_request_path -X POST --data '{"name": "getParameterValues", "parameterNames": ["Device.X_IOWRT_EU_Dropbear.1.PasswordAuth"] }' >/dev/null 2>&1 +curl $connection_request_path -X POST --data '{"name": "getParameterValues", "parameterNames": ["'${PARAM}'"] }' >/dev/null 2>&1 check_ret $? wait_for_session_end check_session "GetParameterValues" param_value_after=$(print_tag_value "cwmp:GetParameterValuesResponse" "Value xsi:type=\"xsd:boolean\"") -if [ "$param_value_after" != "0" ]; then - echo "Error: the value of 'Device.X_IOWRT_EU_Dropbear.1.PasswordAuth' is wrong, current_value($param_value_after) expected_value(0)" >> ./funl-test-debug.log +if [ "$param_value_after" != "1" ]; then + echo "Error: the value of [${PARAM}] is wrong, current_value($param_value_after) expected_value(0)" >> ./funl-test-debug.log exit 1 fi -curl $connection_request_path -X POST --data '{"name": "setParameterValues", "parameterValues": [["Device.X_IOWRT_EU_Dropbear.1.PasswordAuth",true]]}' >/dev/null 2>&1 +curl $connection_request_path -X POST --data '{"name": "setParameterValues", "parameterValues": [["'${PARAM}'",false]]}' >/dev/null 2>&1 wait_for_session_end echo "PASS: $TEST_NAME"