pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/41708?usp=email )

Change subject: vty: assert in optional param followed by optional-multi-choice 
param: Reproduce [1/2]
......................................................................

vty: assert in optional param followed by optional-multi-choice param: 
Reproduce [1/2]

The test added below makes cmd_make_descvec() assert in
"OSMO_ASSERT(multiple);" line, so it's expected to fail during CI.
Follow-up patch provides a fixes for it.

Change-Id: I6ad93a304ce498ba9d57fc7e2fd238e6c16e29e0
Related: b55f4d2df21b966c3953264d8961f259814f4650
Related: OS#6360
(cherry picked from commit aafa7c02edba4a215fec9d01c48d21c3a1addc1d)
---
M tests/vty/vty_transcript_test.c
M tests/vty/vty_transcript_test.vty
2 files changed, 37 insertions(+), 0 deletions(-)

Approvals:
  osmith: Looks good to me, approved
  pespin: Verified




diff --git a/tests/vty/vty_transcript_test.c b/tests/vty/vty_transcript_test.c
index 5602c50..5f8157a 100644
--- a/tests/vty/vty_transcript_test.c
+++ b/tests/vty/vty_transcript_test.c
@@ -207,6 +207,17 @@
        return CMD_SUCCESS;
 }

+DEFUN(multi3, multi3_cmd,
+      "multi3 (foo|bar) [(one|two|three)]",
+      "multi3 test command\n" "foo\nbar\n" "1\n2\n3\n")
+{
+       OSMO_ASSERT(argc > 0);
+       vty_out(vty, "ok argc=%d %s%s%s%s", argc, argv[0],
+               argc > 1 ? " " : "", argc > 1 ? argv[1] : "",
+               VTY_NEWLINE);
+       return CMD_SUCCESS;
+}
+
 #define X(f) (1 << f)

 enum {
@@ -380,6 +391,7 @@
        install_element_ve(&multi0_cmd);
        install_element_ve(&multi1_cmd);
        install_element_ve(&multi2_cmd);
+       install_element_ve(&multi3_cmd);

        install_element(CONFIG_NODE, &cfg_attr_test_cmd);
        install_node(&attr_test_node, NULL);
diff --git a/tests/vty/vty_transcript_test.vty 
b/tests/vty/vty_transcript_test.vty
index 7df2a60..a1c044a 100644
--- a/tests/vty/vty_transcript_test.vty
+++ b/tests/vty/vty_transcript_test.vty
@@ -3,6 +3,7 @@
   multi0 (one|two|three)
   multi1 ([one]|[two]|[three])
   multi2 [(one|two|three)]
+  multi3 (foo|bar) [(one|two|three)]

 vty_transcript_test> multi0 ?
   one    1
@@ -67,6 +68,27 @@
 vty_transcript_test> multi2
 ok argc=0

+vty_transcript_test> multi3 ?
+  foo  foo
+  bar  bar
+
+vty_transcript_test> multi3 foo ?
+  [one]    1
+  [two]    2
+  [three]  3
+
+vty_transcript_test> multi3 foo
+ok argc=1 foo
+
+vty_transcript_test> multi3 bar
+ok argc=1 bar
+
+vty_transcript_test> multi3 foo one
+ok argc=2 foo one
+
+vty_transcript_test> multi3 bar three
+ok argc=2 bar three
+
 vty_transcript_test> multi0 thr
 ok argc=1 three
 
@@ -76,6 +98,9 @@
 vty_transcript_test> multi2 t
 % Ambiguous command.
 
+vty_transcript_test> multi3 foo t
+% Ambiguous command.
+
 vty_transcript_test> single0 one
 ok argc=1 one


--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/41708?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: libosmocore
Gerrit-Branch: pespin/rel-1.12.0
Gerrit-Change-Id: I6ad93a304ce498ba9d57fc7e2fd238e6c16e29e0
Gerrit-Change-Number: 41708
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-CC: fixeria <[email protected]>

Reply via email to