mirror of
https://dev.iopsys.eu/bbf/icwmp.git
synced 2025-12-10 07:44:41 +01:00
Fix empty set in cli tool
This commit is contained in:
parent
8a43c6aeb4
commit
4f4a43b31d
4 changed files with 9 additions and 23 deletions
|
|
@ -14,8 +14,8 @@ include:
|
|||
- if: $CI_COMMIT_BRANCH == "devel"
|
||||
|
||||
stages:
|
||||
- unit_test
|
||||
- static_code_analysis
|
||||
- unit_test
|
||||
- functional_test
|
||||
- deploy
|
||||
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ function install_bbfdmd()
|
|||
if [ -n "${BBFDM_BRANCH}" ]; then
|
||||
exec_cmd git clone -b ${BBFDM_BRANCH} https://dev.iopsys.eu/bbf/bbfdm.git /opt/dev/bbfdm
|
||||
else
|
||||
exec_cmd git clone https://dev.iopsys.eu/bbf/bbfdm.git /opt/dev/bbfdm
|
||||
exec_cmd git clone -b release-7.2 https://dev.iopsys.eu/bbf/bbfdm.git /opt/dev/bbfdm
|
||||
fi
|
||||
|
||||
cd /opt/dev/bbfdm
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ static void display_get_cmd_result(struct cmd_input in __attribute__((unused)),
|
|||
*/
|
||||
char *cmd_set_exec_func(struct cmd_input in, union cmd_result *res __attribute__((unused)))
|
||||
{
|
||||
if (CWMP_STRLEN(in.first_input) == 0 || CWMP_STRLEN(in.second_input) == 0)
|
||||
if (CWMP_STRLEN(in.first_input) == 0)
|
||||
return "9003";
|
||||
|
||||
LIST_HEAD(faults_list);
|
||||
|
|
@ -201,7 +201,7 @@ static void display_get_notif_cmd_result(struct cmd_input in __attribute__((unus
|
|||
*/
|
||||
char *cmd_set_notif_exec_func(struct cmd_input in, union cmd_result *res __attribute__((unused)))
|
||||
{
|
||||
if (in.first_input == NULL || in.second_input == NULL)
|
||||
if (in.first_input == NULL || CWMP_STRLEN(in.second_input) == 0)
|
||||
return "9003";
|
||||
|
||||
if (!icwmp_validate_int_in_range(in.second_input, 0, 6))
|
||||
|
|
@ -285,7 +285,11 @@ char *execute_cwmp_cli_command(char *cmd, char *args[])
|
|||
if (strcmp(cmd, "help") == 0)
|
||||
goto cli_help;
|
||||
|
||||
struct cmd_input cmd_in = { args[0] ? args[0] : NULL, args[0] && args[1] ? args[1] : NULL, args[0] && args[1] && args[2] ? args[2] : NULL };
|
||||
struct cmd_input cmd_in = {
|
||||
args[0] ? args[0] : NULL,
|
||||
args[0] && args[1] ? args[1] : "",
|
||||
args[0] && args[1] && args[2] ? args[2] : NULL
|
||||
};
|
||||
union cmd_result cmd_out = { 0 };
|
||||
char *fault = NULL, *fault_ret = NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -95,15 +95,6 @@ static void cwmp_execute_cli_unit_test(void **state)
|
|||
assert_string_equal(fault, "9005");
|
||||
FREE(fault);
|
||||
|
||||
/*
|
||||
* One argument: Not Valid (9003)
|
||||
*/
|
||||
char *argsset_not_valid[] = {"Device.WiFi.SSID.1.SSID", NULL};
|
||||
fault = execute_cwmp_cli_command("set", argsset_not_valid);
|
||||
assert_non_null(fault);
|
||||
assert_string_equal(fault, "9003");
|
||||
FREE(fault);
|
||||
|
||||
/*
|
||||
* No argumenst: Not Valid
|
||||
*/
|
||||
|
|
@ -183,15 +174,6 @@ static void cwmp_set_cli_unit_test(void **state)
|
|||
assert_non_null(fault);
|
||||
assert_string_equal(fault, "9003");
|
||||
|
||||
/*
|
||||
* Set: only second input is null
|
||||
*/
|
||||
struct cmd_input input2_null = {"Device.WiFi.SSID.1.SSID", NULL};
|
||||
union cmd_result cmd_set_out_2 = { 0 };
|
||||
fault = cmd_set_exec_func(input2_null, &cmd_set_out_2);
|
||||
assert_non_null(fault);
|
||||
assert_string_equal(fault, "9003");
|
||||
|
||||
/*
|
||||
* Set: Not null and valid inputs
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue