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
f9c34a9600
commit
cdbab055a1
2 changed files with 3 additions and 21 deletions
|
|
@ -77,7 +77,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)
|
char *cmd_set_exec_func(struct cmd_input in, union cmd_result *res)
|
||||||
{
|
{
|
||||||
if (CWMP_STRLEN(in.first_input) == 0 || CWMP_STRLEN(in.second_input) == 0)
|
if (CWMP_STRLEN(in.first_input) == 0)
|
||||||
return "9003";
|
return "9003";
|
||||||
|
|
||||||
LIST_HEAD(faults_list);
|
LIST_HEAD(faults_list);
|
||||||
|
|
@ -212,7 +212,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)))
|
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";
|
return "9003";
|
||||||
|
|
||||||
if (!icwmp_validate_int_in_range(in.second_input, 0, 6))
|
if (!icwmp_validate_int_in_range(in.second_input, 0, 6))
|
||||||
|
|
@ -298,7 +298,7 @@ char *execute_cwmp_cli_command(char *cmd, char *args[])
|
||||||
|
|
||||||
struct cmd_input cmd_in = {
|
struct cmd_input cmd_in = {
|
||||||
args[0] ? args[0] : NULL,
|
args[0] ? args[0] : NULL,
|
||||||
args[0] && args[1] ? args[1] : NULL,
|
args[0] && args[1] ? args[1] : "",
|
||||||
args[0] && args[1] && args[2] ? args[2] : NULL
|
args[0] && args[1] && args[2] ? args[2] : NULL
|
||||||
};
|
};
|
||||||
union cmd_result cmd_out = {0};
|
union cmd_result cmd_out = {0};
|
||||||
|
|
|
||||||
|
|
@ -95,15 +95,6 @@ static void cwmp_execute_cli_unit_test(void **state)
|
||||||
assert_string_equal(fault, "9005");
|
assert_string_equal(fault, "9005");
|
||||||
FREE(fault);
|
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
|
* No argumenst: Not Valid
|
||||||
*/
|
*/
|
||||||
|
|
@ -183,15 +174,6 @@ static void cwmp_set_cli_unit_test(void **state)
|
||||||
assert_non_null(fault);
|
assert_non_null(fault);
|
||||||
assert_string_equal(fault, "9003");
|
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
|
* Set: Not null and valid inputs
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue