[PATCH] openbsc[master]: channel_test: test nr of subslots for dyn pchan, with error

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/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Sun Sep 25 15:40:33 UTC 2016


Review at  https://gerrit.osmocom.org/937

channel_test: test nr of subslots for dyn pchan, with error

Add test_dyn_ts_subslots() and call from main(). Update channel_test.ok.

This includes erratic assert to show a bug for TCH/F_PDCH in PDCH mode: the nr
of subslots should be the same as for a normal PDCH, i.e. zero. This will be
adjusted along with the fix in an upcoming commit.

Change-Id: I09685be3fb3ed1ead4577b772a9fbc31967980d1
---
M openbsc/tests/channel/channel_test.c
M openbsc/tests/channel/channel_test.ok
2 files changed, 32 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/37/937/1

diff --git a/openbsc/tests/channel/channel_test.c b/openbsc/tests/channel/channel_test.c
index e339bff..e6d6925 100644
--- a/openbsc/tests/channel/channel_test.c
+++ b/openbsc/tests/channel/channel_test.c
@@ -90,11 +90,42 @@
 	OSMO_ASSERT(s_end);
 }
 
+void test_dyn_ts_subslots(void)
+{
+	struct gsm_bts_trx_ts ts;
+
+	printf("Testing subslot numbers for pchan types\n");
+
+	ts.pchan = GSM_PCHAN_TCH_F;
+	OSMO_ASSERT(ts_subslots(&ts) == 1);
+
+	ts.pchan = GSM_PCHAN_TCH_H;
+	OSMO_ASSERT(ts_subslots(&ts) == 2);
+
+	ts.pchan = GSM_PCHAN_PDCH;
+	OSMO_ASSERT(ts_subslots(&ts) == 0);
+
+	ts.pchan = GSM_PCHAN_TCH_F_PDCH;
+	ts.flags = 0; /* TCH_F mode */
+	OSMO_ASSERT(ts_subslots(&ts) == 1);
+	ts.flags = TS_F_PDCH_ACTIVE;
+	OSMO_ASSERT(ts_subslots(&ts) == 1 /* SHOULD BE 0 */);
+
+	ts.pchan = GSM_PCHAN_TCH_F_TCH_H_PDCH;
+	ts.dyn.pchan_is = GSM_PCHAN_TCH_F;
+	OSMO_ASSERT(ts_subslots(&ts) == 1);
+	ts.dyn.pchan_is = GSM_PCHAN_TCH_H;
+	OSMO_ASSERT(ts_subslots(&ts) == 2);
+	ts.dyn.pchan_is = GSM_PCHAN_PDCH;
+	OSMO_ASSERT(ts_subslots(&ts) == 0);
+}
+
 int main(int argc, char **argv)
 {
 	osmo_init_logging(&log_info);
 
 	test_request_chan();
+	test_dyn_ts_subslots();
 
 	return EXIT_SUCCESS;
 }
diff --git a/openbsc/tests/channel/channel_test.ok b/openbsc/tests/channel/channel_test.ok
index 7976aee..33c8193 100644
--- a/openbsc/tests/channel/channel_test.ok
+++ b/openbsc/tests/channel/channel_test.ok
@@ -1,2 +1,3 @@
 Testing the gsm_subscriber chan logic
 Reached, didn't crash, test passed
+Testing subslot numbers for pchan types

-- 
To view, visit https://gerrit.osmocom.org/937
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I09685be3fb3ed1ead4577b772a9fbc31967980d1
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list