From 1d9e758e76679f7ca207d93b41212c22118a5b81 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Wed, 14 Jul 2021 00:22:02 +0200 Subject: handover_test: also show when an lchan is busy In expect-ts-use, indicate a busy lchan with letter '!'. The code is a bit complex because of the choice made earlier to show two TCH/H subslots as "TCH/HH", "TCH/H-" or "TCH/-H" depending on the subslot states: - show "-" as a shorthand for "all subslots UNUSED" - show a "TCH/" prefix only when there is any "H" or "F" following, i.e. when any subslot is actually established - if a subslot is busy (any other state besides ESTABLISHED and UNUSED), indicate the subslot as '!'. The spectrum of reported state strings for TCH/F is: TCH/F ! - For TCH/H: TCH/HH TCH/H- TCH/-H TCH/H! TCH/!H !- -! - The only current test affected is test_penalty_timer.ho_vty, where a failed handover leaves an lchan in LCHAN_ST_WAIT_AFTER_ERROR. Adjust that test. Rationale: I will soon add tests to verify the accurate timeout of a handover2 penalty timer. While implementing, I noticed that immediate retry of the handover ends up in timeslot 2, because timeslot 1 is still in WAIT_AFTER_ERROR. Instead of working around that, I would like to explicitly show the error state in the test -- it is an important aspect. Related: SYS#5198 Change-Id: I735ce7e2c3e0e450d3f76047d7e47691fe889cad --- tests/handover/handover_test.c | 42 +++++++++++++++++++++++--------- tests/handover/test_penalty_timer.ho_vty | 4 ++- 2 files changed, 33 insertions(+), 13 deletions(-) (limited to 'tests') diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c index 2c97f782a..60a31be2f 100644 --- a/tests/handover/handover_test.c +++ b/tests/handover/handover_test.c @@ -287,6 +287,34 @@ static struct gsm_bts *_create_bts(int num_trx, const char * const *ts_args, int return bts; } +char *lchans_use_str(struct gsm_bts_trx_ts *ts, const char *established_prefix, char established_char) +{ + char state_chars[8] = { 0 }; + struct gsm_lchan *lchan; + bool any_lchans_established = false; + bool any_lchans_in_use = false; + ts_for_n_lchans(lchan, ts, ts->max_primary_lchans) { + char state_char; + if (lchan_state_is(lchan, LCHAN_ST_UNUSED)) { + state_char = '-'; + } else { + any_lchans_in_use = true; + if (lchan_state_is(lchan, LCHAN_ST_ESTABLISHED)) { + any_lchans_established = true; + state_char = established_char; + } else { + state_char = '!'; + } + } + state_chars[lchan->nr] = state_char; + } + if (!any_lchans_in_use) + return "-"; + if (!any_lchans_established) + established_prefix = ""; + return talloc_asprintf(OTC_SELECT, "%s%s", established_prefix, state_chars); +} + const char *ts_use_str(struct gsm_bts_trx_ts *ts) { switch (ts->pchan_is) { @@ -297,20 +325,10 @@ const char *ts_use_str(struct gsm_bts_trx_ts *ts) return "-"; case GSM_PCHAN_TCH_F: - if (lchan_state_is(&ts->lchan[0], LCHAN_ST_ESTABLISHED)) - return "TCH/F"; - else - return "-"; + return lchans_use_str(ts, "TCH/", 'F'); case GSM_PCHAN_TCH_H: - if (lchan_state_is(&ts->lchan[0], LCHAN_ST_ESTABLISHED) - && lchan_state_is(&ts->lchan[1], LCHAN_ST_ESTABLISHED)) - return "TCH/HH"; - if (lchan_state_is(&ts->lchan[0], LCHAN_ST_ESTABLISHED)) - return "TCH/H-"; - if (lchan_state_is(&ts->lchan[1], LCHAN_ST_ESTABLISHED)) - return "TCH/-H"; - return "-"; + return lchans_use_str(ts, "TCH/", 'H'); default: return gsm_pchan_name(ts->pchan_is); diff --git a/tests/handover/test_penalty_timer.ho_vty b/tests/handover/test_penalty_timer.ho_vty index 7528a0fe6..22b9a9529 100644 --- a/tests/handover/test_penalty_timer.ho_vty +++ b/tests/handover/test_penalty_timer.ho_vty @@ -9,7 +9,9 @@ meas-rep lchan 0 0 1 0 rxlev 20 rxqual 0 ta 0 neighbors 30 expect-chan lchan 1 0 1 0 expect-ho-cmd lchan 0 0 1 0 ho-failed +# first BTS still services the call: expect-ts-use trx 0 0 states * TCH/F - - - - - - -expect-ts-use trx 1 0 states * - - - - - - - +# lchan 1 0 1 0 is in LCHAN_ST_WAIT_AFTER_ERROR because the handover failed: +expect-ts-use trx 1 0 states * ! - - - - - - meas-rep lchan 0 0 1 0 rxlev 20 rxqual 0 ta 0 neighbors 30 expect-no-chan -- cgit v1.2.3