neels has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bsc/+/21984 )


Change subject: handover_test: vty echo
......................................................................

handover_test: vty echo

Echo each handover_test command on the test output, to help with
understanding the exact point of a test failure.

Even nicer would be a general echo of all VTY commands, but the VTY
currently does not support that feature. Refraining from a libosmocore
patch just for these test scripts...

Change-Id: Ifc307a7d0b7e3caa355f8cee88778762b529ad71
---
M tests/handover/handover_test.c
1 file changed, 22 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/84/21984/1

diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c
index 167f1ce..d422a9d 100644
--- a/tests/handover/handover_test.c
+++ b/tests/handover/handover_test.c
@@ -741,6 +741,11 @@
        return &ts->lchan[atoi(argv[3])];
 }

+static int vty_step = 1;
+
+#define VTY_ECHO() \
+       fprintf(stderr, "\n%d: %s\n", vty_step++, vty->buf)
+
 #define TS_USE " (TCH/F|TCH/H-|TCH/-H|TCH/HH|PDCH" \
               "|tch/f|tch/h-|tch/-h|tch/hh|pdch" \
               "|-|*)"
@@ -764,6 +769,7 @@
 {
        int i;
        int n = atoi(argv[0]);
+       VTY_ECHO();
        for (i = 0; i < n; i++)
                _create_bts(1, NULL, 0);
        return CMD_SUCCESS;
@@ -779,6 +785,7 @@
       " shorthands: cs+4 = CCCH+SDCCH4; dyn = TCH/F_TCH/H_PDCH\n")
 {
        int num_trx = atoi(argv[0]);
+       VTY_ECHO();
        _create_bts(num_trx, argv + 1, argc - 1);
        return CMD_SUCCESS;
 }
@@ -794,6 +801,7 @@
        const char *tch_type = argv[1];
        const char *codec = argv[2];
        struct gsm_lchan *lchan;
+       VTY_ECHO();
        fprintf(stderr, "- Creating mobile at BTS %s on "
                "%s with %s codec\n", bts_nr_str, tch_type, codec);
        lchan = create_lchan(bts_by_num_str(bts_nr_str),
@@ -878,6 +886,7 @@
       "meas-rep " MEAS_REP_ARGS,
       MEAS_REP_DOC MEAS_REP_ARGS_DOC)
 {
+       VTY_ECHO();
        return _meas_rep(vty, argc, argv);
 }

@@ -888,6 +897,7 @@
       MEAS_REP_ARGS_DOC)
 {
        int count = atoi(argv[0]);
+       VTY_ECHO();
        argv += 1;
        argc -= 1;

@@ -900,6 +910,7 @@
       "congestion-check",
       "Trigger a congestion check\n")
 {
+       VTY_ECHO();
        fprintf(stderr, "- Triggering congestion check\n");
        hodec2_congestion_check(bsc_gsmnet);
        return CMD_SUCCESS;
@@ -909,6 +920,7 @@
       "expect-no-chan",
       "Expect that no channel request was sent from BSC to any cell\n")
 {
+       VTY_ECHO();
        fprintf(stderr, "- Expecting no channel request\n");
        if (new_chan_req) {
                fprintf(stderr, " * Got channel request at %s\n", 
gsm_lchan_name(new_chan_req));
@@ -962,6 +974,7 @@
       "Expect a channel request from BSC to a cell for a specific lchan\n"
       LCHAN_ARGS_DOC)
 {
+       VTY_ECHO();
        _expect_chan_activ(parse_lchan_args(argv));
        return CMD_SUCCESS;
 }
@@ -971,6 +984,7 @@
       "Expect a handover of a given lchan\n"
       LCHAN_ARGS_DOC)
 {
+       VTY_ECHO();
        _expect_ho_req(parse_lchan_args(argv));
        return CMD_SUCCESS;
 }
@@ -979,6 +993,7 @@
       "ho-detect",
       "Send Handover Detection to the most recent HO target lchan\n")
 {
+       VTY_ECHO();
        if (!last_chan_req) {
                fprintf(stderr, "Cannot ack handover/assignment, because no 
chan request\n");
                exit(1);
@@ -991,6 +1006,7 @@
       "ho-complete",
       "Send Handover Complete for the most recent HO target lchan\n")
 {
+       VTY_ECHO();
        if (!last_chan_req) {
                fprintf(stderr, "Cannot ack handover/assignment, because no 
chan request\n");
                exit(1);
@@ -1013,6 +1029,7 @@
 {
        struct gsm_lchan *from = parse_lchan_args(argv);
        struct gsm_lchan *to = parse_lchan_args(argv+4);
+       VTY_ECHO();

        _expect_chan_activ(to);
        _expect_ho_req(from);
@@ -1026,6 +1043,7 @@
       "ho-failed",
       "Fail the most recent handover request\n")
 {
+       VTY_ECHO();
        if (!last_chan_req) {
                fprintf(stderr, "Cannot fail handover, because no chan 
request\n");
                exit(1);
@@ -1048,6 +1066,7 @@
 {
        struct gsm_bts *bts = bts_by_num_str(argv[0]);
        struct gsm_bts_trx *trx = trx_by_num_str(bts, argv[1]);
+       VTY_ECHO();
        argv += 2;
        argc -= 2;
        if (!_expect_ts_use(bts, trx, argv))
@@ -1060,6 +1079,7 @@
        "Define which codec should be used for new TCH/F lchans (for 
set-ts-use)\n"
        "Configure the TCH/F codec to use\nAMR\nEFR\nFR\n")
 {
+       VTY_ECHO();
        osmo_talloc_replace_string(ctx, &codec_tch_f, argv[0]);
        return CMD_SUCCESS;
 }
@@ -1069,6 +1089,7 @@
        "Define which codec should be used for new TCH/H lchans (for 
set-ts-use)\n"
        "Configure the TCH/H codec to use\nAMR\nHR\n")
 {
+       VTY_ECHO();
        osmo_talloc_replace_string(ctx, &codec_tch_h, argv[0]);
        return CMD_SUCCESS;
 }
@@ -1082,6 +1103,7 @@
 {
        struct gsm_bts *bts = bts_by_num_str(argv[0]);
        struct gsm_bts_trx *trx = trx_by_num_str(bts, argv[1]);
+       VTY_ECHO();
        argv += 2;
        argc -= 2;
        if (!_set_ts_use(bts, trx, argv))

--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/21984
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ifc307a7d0b7e3caa355f8cee88778762b529ad71
Gerrit-Change-Number: 21984
Gerrit-PatchSet: 1
Gerrit-Owner: neels <[email protected]>
Gerrit-MessageType: newchange

Reply via email to