This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/19456 ) Change subject: tests: vty: Extend test to do some numeric range validations ...................................................................... tests: vty: Extend test to do some numeric range validations As per current status, the numeric tests are expected to fail due to a couple bugs which will be fixed in next commits. Change-Id: Id5b17bd96d7af4ed9a77ebbea0e6be4b0fcbde6c --- M tests/vty/vty_test.c M tests/vty/vty_test.ok 2 files changed, 40 insertions(+), 0 deletions(-) Approvals: laforge: Looks good to me, but someone else must approve Hoernchen: Looks good to me, approved Jenkins Builder: Verified diff --git a/tests/vty/vty_test.c b/tests/vty/vty_test.c index 9627b6d..7146a1d 100644 --- a/tests/vty/vty_test.c +++ b/tests/vty/vty_test.c @@ -22,6 +22,7 @@ #include <stdio.h> #include <string.h> #include <errno.h> +#include <limits.h> #include <sys/types.h> #include <sys/socket.h> @@ -438,6 +439,19 @@ return CMD_WARNING; } +DEFUN(cfg_numeric_range, cfg_numeric_range_cmd, +#if ULONG_MAX == 18446744073709551615UL + "numeric-range <0-18446744073709551615>", +#else + "numeric-range <0-4294967295>", +#endif + "testing numeric range\n" + "the numeric range\n") +{ + printf("Called: 'return-success'\n"); + return CMD_SUCCESS; +} + void test_vty_add_cmds() { install_element(CONFIG_NODE, &cfg_ret_warning_cmd); @@ -461,6 +475,8 @@ install_element_ve(&cfg_ambiguous_nr_2_cmd); install_element_ve(&cfg_ambiguous_str_1_cmd); install_element_ve(&cfg_ambiguous_str_2_cmd); + + install_element_ve(&cfg_numeric_range_cmd); } void test_is_cmd_ambiguous() @@ -482,6 +498,21 @@ destroy_test_vty(&test, vty); } +void test_numeric_range() +{ + struct vty *vty; + struct vty_test test; + + printf("Going to test test_numeric_range()\n"); + vty = create_test_vty(&test); + + OSMO_ASSERT(do_vty_command(vty, "numeric-range 0") == CMD_ERR_NO_MATCH); + OSMO_ASSERT(do_vty_command(vty, "numeric-range 40000") == CMD_ERR_NO_MATCH); + OSMO_ASSERT(do_vty_command(vty, "numeric-range -400000") == CMD_ERR_NO_MATCH); + + destroy_test_vty(&test, vty); +} + int main(int argc, char **argv) { struct vty_app_info vty_info = { @@ -535,6 +566,8 @@ test_is_cmd_ambiguous(); + test_numeric_range(); + /* Leak check */ OSMO_ASSERT(talloc_total_blocks(stats_ctx) == 1); diff --git a/tests/vty/vty_test.ok b/tests/vty/vty_test.ok index d2c9611..d81c6c7 100644 --- a/tests/vty/vty_test.ok +++ b/tests/vty/vty_test.ok @@ -311,4 +311,11 @@ Going to execute 'ambiguous_str arg keyword' Called: 'ambiguous_str ARG keyword' Returned: 0, Current node: 1 '%s> ' +Going to test test_numeric_range() +Going to execute 'numeric-range 0' +Returned: 2, Current node: 1 '%s> ' +Going to execute 'numeric-range 40000' +Returned: 2, Current node: 1 '%s> ' +Going to execute 'numeric-range -400000' +Returned: 2, Current node: 1 '%s> ' All tests passed -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/19456 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: Id5b17bd96d7af4ed9a77ebbea0e6be4b0fcbde6c Gerrit-Change-Number: 19456 Gerrit-PatchSet: 2 Gerrit-Owner: pespin <pespin at sysmocom.de> Gerrit-Reviewer: Hoernchen <ewild at sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge at osmocom.org> Gerrit-Reviewer: pespin <pespin at sysmocom.de> Gerrit-MessageType: merged -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200730/e77125ce/attachment.htm>