summaryrefslogtreecommitdiff
path: root/cesar/bsu/test/utest
diff options
context:
space:
mode:
authorlaranjeiro2010-05-17 10:57:17 +0000
committerlaranjeiro2010-05-17 10:57:17 +0000
commit2e201988c004cd336bbb528fd23fd3d671b86552 (patch)
tree428cf2fc2ef9981196a57f0b841742480f63e7e5 /cesar/bsu/test/utest
parent23909e2782fbc74de857a34dd3c2fa2f8f1cc41f (diff)
cesar/{bsu, cp/{beacon, sta/action}}: order the bsu to track the avln
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@7093 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/bsu/test/utest')
-rw-r--r--cesar/bsu/test/utest/Makefile2
-rw-r--r--cesar/bsu/test/utest/src/bsut.c20
-rw-r--r--cesar/bsu/test/utest/src/ca.c5
-rw-r--r--cesar/bsu/test/utest/src/interface.c2
-rw-r--r--cesar/bsu/test/utest/src/pbproc_stub.c21
-rw-r--r--cesar/bsu/test/utest/src/schedules.c1
-rw-r--r--cesar/bsu/test/utest/src/tests.c4
7 files changed, 50 insertions, 5 deletions
diff --git a/cesar/bsu/test/utest/Makefile b/cesar/bsu/test/utest/Makefile
index 5397d99af7..c96eee634b 100644
--- a/cesar/bsu/test/utest/Makefile
+++ b/cesar/bsu/test/utest/Makefile
@@ -1,7 +1,7 @@
BASE = ../../..
HOST_PROGRAMS = bsu
bsu_SOURCES = tests.c bsu.c interface.c bsut.c schedules.c \
- ca.c sar.c phy.c
+ ca.c sar.c phy.c pbproc_stub.c
bsu_MODULES = lib bsu mac/common hal/timer/stub
include $(BASE)/common/make/top.mk
diff --git a/cesar/bsu/test/utest/src/bsut.c b/cesar/bsu/test/utest/src/bsut.c
index b72700f102..e78324c15f 100644
--- a/cesar/bsu/test/utest/src/bsut.c
+++ b/cesar/bsu/test/utest/src/bsut.c
@@ -23,7 +23,7 @@ void
bsu_timer_event_process (void *ud);
void
-bsu_avln_schedules_beacon_not_received (bsu_t *ctx, bsu_avln_t *avln);
+bsu_avln_schedules_decrease_countdown (bsu_t *ctx, bsu_avln_t *avln);
void
bsu_update__persistent_schedules (bsu_t *ctx, bsu_beacon_t *beacon);
@@ -82,7 +82,8 @@ test_case_bsu_process (test_t test)
test_fail_unless (t.bsu->avlns[0].sync.beacon_nb == 2);
blk_release_desc ((blk_t*) bneighbour);
/* Our AVLN. */
- bsu_track_avln (0x2, 0x5, t.mac_config.tei);
+ bsu_track_avln (0x2, 0x5, t.mac_config.tei,
+ MAC_COEXISTENCE_AV_ONLY_MODE);
bsu_test_create_beacon (&t, &beacon);
beacon.vf.nid = 0x2;
b = bsu_beacon_write (&beacon, BSU_BEACON_TYPE_CENTRAL,
@@ -96,6 +97,7 @@ test_case_bsu_process (test_t test)
test_fail_unless (t.bsu->sta_avln->sync.init == false);
bp_rx.snid = 0x5;
bp_rx.bts = 0;
+ t.mac_config.tei = 1;
b = bsu_beacon_write (&beacon, BSU_BEACON_TYPE_CENTRAL,
&t.mac_config, &bp_tx);
b->phy_pb.pb_rx.pb_measurement.crc_error = false;
@@ -263,7 +265,7 @@ test_case_bsu_timer_event_cco_ucco (test_t test, bsu_test_t *t,
t->bsu->beacon.beacon_period_start_date = t->bsu->aclf->bpsd[0] - 1;
for (i = 0; i < 7; i++)
{
- bsu_avln_schedules_beacon_not_received (t->bsu, &cmp_avln);
+ bsu_avln_schedules_decrease_countdown (t->bsu, &cmp_avln);
bsu_timer_event_process (t->bsu);
test_fail_unless (t->ul.beacon != INVALID_PTR);
test_fail_unless (t->ul.bparams != INVALID_PTR);
@@ -297,6 +299,10 @@ test_case_bsu_timer_event (test_t test)
bsu_test_t t;
bsu_avln_t cmp_avln;
bsu_test_init (&t);
+ bsu_beacon_t beacon;
+ bsu_test_create_beacon (&t, &beacon);
+ bsu_update (&beacon, BSU_UPDATE_STA_TYPE_STA);
+ bsu_power_on (0);
bsu_activate (true);
bsu_test_avln_create (&t, t.bsu->sta_avln);
bsu_test_avln_create (&t, &cmp_avln);
@@ -305,7 +311,7 @@ test_case_bsu_timer_event (test_t test)
for (j = 0; j < 10; j++)
{
bsu_timer_event_process (t.bsu);
- bsu_avln_schedules_beacon_not_received (t.bsu, &cmp_avln);
+ bsu_avln_schedules_decrease_countdown (t.bsu, &cmp_avln);
for (i = 0; i < BSU_ACLF_BPSD_NB; i++)
test_fail_unless (
t.bsu->aclf->bpsd[i] = (i+j+1) * BSU_ACLF_BP_50HZ_TCK);
@@ -382,6 +388,10 @@ test_case_bsu_activate (test_t test)
{
u32 bpsd[4];
uint i;
+ bsu_beacon_t beacon;
+ bsu_test_create_beacon (&t, &beacon);
+ bsu_update (&beacon, BSU_UPDATE_STA_TYPE_UCCO);
+ bsu_power_on (0);
bsu_activate (true);
test_fail_unless (t.bsu->activate == true);
bsu_aclf_beacon_period_start_date (t.bsu->aclf, bpsd, COUNT(bpsd));
@@ -444,6 +454,7 @@ test_case_bsu_persistent_schedules_update__cscma_cscd_permanent (
bsu_beacon_t beacon;
test_within (test);
bsu_test_init (&t);
+ memset (&t.bsu->beacon, 0, sizeof (bsu_beacon_t));
t.bsu->beacon.vf.nm = BSU_BEACON_NM_CSMA_ONLY;
bsu_test_create_beacon (&t, &beacon);
beacon.bmis.ps.nb = ps_nb;
@@ -471,6 +482,7 @@ test_case_bsu_persistent_schedules_update__cscma_cscd_non_permanent (
bsu_beacon_t beacon;
test_within (test);
bsu_test_init (&t);
+ memset (&t.bsu->beacon, 0, sizeof (bsu_beacon_t));
t.bsu->beacon.vf.nm = BSU_BEACON_NM_CSMA_ONLY;
bsu_test_create_beacon (&t, &beacon);
beacon.bmis.ps.nb = ps_nb;
diff --git a/cesar/bsu/test/utest/src/ca.c b/cesar/bsu/test/utest/src/ca.c
index ead27075ca..28332962a7 100644
--- a/cesar/bsu/test/utest/src/ca.c
+++ b/cesar/bsu/test/utest/src/ca.c
@@ -46,3 +46,8 @@ ca_alloc_update_beacon_periods (ca_t *ctx,
t->beacon_periods[i] = beacon_periods[i];
t->nb_beacon_periods = beacon_periods_nb;
}
+
+void
+ca_mfs_remove (ca_t *ca, mfs_tx_t *mfs)
+{
+}
diff --git a/cesar/bsu/test/utest/src/interface.c b/cesar/bsu/test/utest/src/interface.c
index fc18c5707f..b718426948 100644
--- a/cesar/bsu/test/utest/src/interface.c
+++ b/cesar/bsu/test/utest/src/interface.c
@@ -54,6 +54,7 @@ test_case_bsu_interface_tx (test_t t, bsu_beacon_type_t type)
{
test.bsu->avlns[0].sync.ntb_offset_tck = 0x3;
test.bsu->avlns[0].sync.fe = 0.34;
+ test.bsu->sta_avln = &test.bsu->avlns[0];
bsu_beacon_send (test.bsu, type, beacon, &params);
test_fail_unless (test.sar.beacon == beacon);
test_fail_unless (test.sar.mfs->beacon == true);
@@ -96,6 +97,7 @@ test_case_bsu_interface_rx (test_t t)
bsu_test_create_beacon (&test, &bbeacon);
test.bsu->avlns[0].sync.ntb_offset_tck = 0x3;
test.bsu->avlns[0].sync.fe = 0.34;
+ test.bsu->sta_avln = &test.bsu->avlns[0];
beacon = bsu_beacon_write (&bbeacon,
BSU_BEACON_TYPE_CENTRAL,
&test.mac_config,
diff --git a/cesar/bsu/test/utest/src/pbproc_stub.c b/cesar/bsu/test/utest/src/pbproc_stub.c
new file mode 100644
index 0000000000..639503cf36
--- /dev/null
+++ b/cesar/bsu/test/utest/src/pbproc_stub.c
@@ -0,0 +1,21 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2010 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file bsu/test/utest/src/pbproc_stub.c
+ * \brief BSU unit tests
+ * \ingroup bsu
+ */
+#include "common/std.h"
+#include "mac/pbproc/pbproc.h"
+
+void
+pbproc_mfs_remove_all (mfs_tx_t *mfs)
+{
+ if (mfs->head)
+ blk_release_desc ((blk_t*) mfs->head);
+}
diff --git a/cesar/bsu/test/utest/src/schedules.c b/cesar/bsu/test/utest/src/schedules.c
index 76348f0201..8f8d58493f 100644
--- a/cesar/bsu/test/utest/src/schedules.c
+++ b/cesar/bsu/test/utest/src/schedules.c
@@ -94,6 +94,7 @@ test_case_ca_schedules (test_t test)
uint i, index;
u32 bpsd[BSU_ACLF_BPSD_NB-1];
ca_schedule_t *sched;
+ t.bsu->ca_index = 0;
index = t.bsu->ca_index;
bsu_test_avln_create (&t, &avln);
bsu_ca_schedules (t.bsu, t.bsu->sta_avln);
diff --git a/cesar/bsu/test/utest/src/tests.c b/cesar/bsu/test/utest/src/tests.c
index d46749f270..82fbf9a2ee 100644
--- a/cesar/bsu/test/utest/src/tests.c
+++ b/cesar/bsu/test/utest/src/tests.c
@@ -58,6 +58,10 @@ bsu_test_init (bsu_test_t *ctx)
memset (&ctx->bsu->beacon, 0, sizeof (bsu_beacon_t));
ctx->bsu->sta_avln = &ctx->bsu->avlns[0];
bsu_test_upper_layer_beacon_received_init (ctx);
+ bsu_beacon_t beacon;
+ bsu_test_create_beacon (ctx, &beacon);
+ bsu_update (&beacon, BSU_UPDATE_STA_TYPE_UCCO);
+ bsu_power_on (0);
}
void