summaryrefslogtreecommitdiff
path: root/cesar/test_general/maximus
diff options
context:
space:
mode:
authorlaranjeiro2009-03-26 10:00:39 +0000
committerlaranjeiro2009-03-26 10:00:39 +0000
commitb20f0b7866a4dd9deb2c21f6ddadf6d50bd86485 (patch)
treebdd66a03ef4c243abcec6e6c4e1278c6a5ecaa0a /cesar/test_general/maximus
parentc2309ac26a3dfe2be1735fde9fc433115f83d2c5 (diff)
test_general/maximus/integration/cl-sar-pbproc:
* Resolved the memory leak (was only present in the test). * Update the test to send and receive data. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@4306 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/test_general/maximus')
-rw-r--r--cesar/test_general/maximus/integration/cl-sar-pbproc/src/station.c87
-rw-r--r--cesar/test_general/maximus/integration/cl-sar-pbproc/test1.py49
2 files changed, 90 insertions, 46 deletions
diff --git a/cesar/test_general/maximus/integration/cl-sar-pbproc/src/station.c b/cesar/test_general/maximus/integration/cl-sar-pbproc/src/station.c
index f11beba0e0..cc638313ea 100644
--- a/cesar/test_general/maximus/integration/cl-sar-pbproc/src/station.c
+++ b/cesar/test_general/maximus/integration/cl-sar-pbproc/src/station.c
@@ -42,14 +42,6 @@
#include "cl/inc/trace.h"
#include "mac/sar/inc/trace.h"
-struct tei_node_t
-{
- list_node_t node;
- uint tei;
-};
-typedef struct tei_node_t tei_node_t;
-
-
/** station context. */
struct station_test_t
{
@@ -76,13 +68,6 @@ struct station_test_t
cyg_handle_t sched_handle;
cyg_thread sched_thread;
-
- /** Used to memorize the list of TEI inserted in the mac_Store to remove it
- * in the future.
- */
- list_t tei_list;
-
-
};
typedef struct station_test_t station_test_t;
@@ -143,8 +128,6 @@ void maximus_cp_mme_get (void *user, u8 *buffer)
printf ("/***************************************************/\n");
printf (" STA : %d CP MME GOT \n", station_test.mac_config.tei);
printf ("/***************************************************/\n");
-
- free (buffer);
}
// ---------------------------- Station functions --------------------------
@@ -193,7 +176,6 @@ void station_test_link_remove (station_test_t *ctx, uint type, uint bcast,
uint mme, uint lid, uint tei)
{
mfs_t *mfs;
- pb_t *pb;
dbg_assert (ctx);
dbg_assert (ctx->mac_store);
@@ -203,21 +185,20 @@ void station_test_link_remove (station_test_t *ctx, uint type, uint bcast,
if (mfs != NULL)
{
- while (type && mfs->tx.head)
+ if (type && mfs->tx.head)
{
- pb = mfs->tx.head;
- mfs->tx.head = mfs->tx.head->next;
- blk_release_desc ((blk_t *) pb);
+ blk_release_desc_range ((blk_t *) mfs->tx.head, (blk_t *)
+ mfs->tx.tail);
}
- while (!type && mfs->rx.head)
+ if (!type && mfs->rx.head)
{
- pb = mfs->rx.head;
- mfs->rx.head = mfs->rx.head->next;
- blk_release_desc ((blk_t *) pb);
+ blk_release_desc_range ((blk_t *) mfs->rx.head, (blk_t *)
+ mfs->rx.tail);
}
// remove the MFS from the sar
+ mfs->common.release = true;
sar_mfs_remove (ctx->sar, mfs);
blk_release (mfs);
@@ -325,6 +306,7 @@ void station_test_config (station_test_t *ctx, uint tei, uint snid,
ctx->snid = snid;
ctx->mac_config.tei = tei;
+ ctx->mac_config.authenticated = true;
if (mac_addr == 0)
{
@@ -343,6 +325,8 @@ void station_test_config (station_test_t *ctx, uint tei, uint snid,
printf ("[STATION] PBproc Activated\n");
}
+
+ sar_activate (ctx->sar, true);
}
/**
@@ -356,19 +340,17 @@ void station_test_config (station_test_t *ctx, uint tei, uint snid,
void station_test_discover (station_test_t *ctx, uint *tei, mac_t *macs,
uint qte)
{
- tei_node_t *node;
uint i;
for (i = 0; i < qte; i++)
{
if (tei[i] != 0)
{
- node = blk_alloc ();
- list_init_node (&node->node);
- node->tei = tei[i];
- list_push (&ctx->tei_list, &node->node);
-
+ sta_t *sta;
mac_store_sta_add (ctx->mac_store, tei[i]);
+ sta = mac_store_sta_get (ctx->mac_store, tei[i]);
+ sta->authenticated = true;
+ blk_release (sta);
}
}
@@ -390,6 +372,41 @@ void station_test_discover (station_test_t *ctx, uint *tei, mac_t *macs,
// ---------------------------- Function calls -----------------------------
+/** Uninitialise the function
+ */
+int fc_station_uninit (fcall_ctx_t *fcall, fcall_param_t **param,
+ sci_msg_t **msg, void *data)
+{
+ list_node_t *node;
+ ce_rx_params_node_t *ce;
+
+ station_test.mac_config.authenticated = true;
+ sar_activate (station_test.sar, false);
+ pbproc_activate (station_test.pbproc, false);
+
+ sar_cleanup (station_test.sar);
+
+ cl_uninit (station_test.cl);
+ sar_uninit (station_test.sar);
+ pbproc_uninit (station_test.pbproc);
+ mac_store_uninit (station_test.mac_store);
+
+ while (!list_empty (&ce_rx_params_list))
+ {
+ node = list_begin (&ce_rx_params_list);
+ ce = PARENT_OF (ce_rx_params_node_t, node, node);
+ if (ce->rx_params)
+ blk_release (ce->rx_params);
+ list_remove (&ce_rx_params_list, &ce->node);
+ blk_release (ce);
+ }
+
+ blk_print_memory ();
+
+ return true;
+}
+
+
/** Creates a link in the STA.
*
* - dtei the tei of the station.
@@ -945,7 +962,7 @@ bool ce_measurements (void *user, pbproc_rx_params_t *rx_params, uint pb_nb,
if (chandata)
{
- blk_release (chandata);
+ blk_release_desc_range_nb ((blk_t*) chandata, nb_chandata);
}
return false;
@@ -1000,7 +1017,6 @@ cyg_user_start (void)
my_station.pipe_log_fd = 1;
list_init (&ce_rx_params_list);
- list_init (&station_test.tei_list);
fcall_register (my_station.fcall, "fc_station_link_add",
&fc_station_link_add, NULL);
@@ -1044,6 +1060,9 @@ cyg_user_start (void)
fcall_register (my_station.fcall, "fc_sar_print_trace",
&fc_sar_print_trace, NULL);
+ fcall_register (my_station.fcall, "fc_station_uninit",
+ &fc_station_uninit, NULL);
+
sar_init_measure_context (station_test.sar, &station_test.sar);
sar_init_measurement_cb (station_test.sar, ce_measurements);
diff --git a/cesar/test_general/maximus/integration/cl-sar-pbproc/test1.py b/cesar/test_general/maximus/integration/cl-sar-pbproc/test1.py
index c89809d4dc..ed14509435 100644
--- a/cesar/test_general/maximus/integration/cl-sar-pbproc/test1.py
+++ b/cesar/test_general/maximus/integration/cl-sar-pbproc/test1.py
@@ -21,7 +21,7 @@ sta2_mac_str = pack('>Q', sta2_mac)[2:8]
# TEI of station 1 will be 1
station1 = maximus.create_sta()
-#station1.debug()
+station1.debug()
# TEI of station 2 will be 2
station2 = maximus.create_sta()
@@ -65,15 +65,6 @@ fc1.add_param_ushort ("lid", 1)
fc1.add_param_ushort ("tei", 2)
fc1.send()
-fc2 = maximus.create_fcall ("fc_station_link_add")
-fc2.set_sta (station2)
-fc2.add_param_ushort ("type", 0)
-fc2.add_param_ushort ("bcast", 0)
-fc2.add_param_ushort ("mme", 0)
-fc2.add_param_ushort ("lid", 1)
-fc2.add_param_ushort ("tei", 1)
-fc2.send()
-
fc1 = maximus.create_fcall ("fc_station_link_add")
fc1.set_sta (station1)
fc1.add_param_ushort ("type", 1)
@@ -87,6 +78,15 @@ fc2 = maximus.create_fcall ("fc_station_link_add")
fc2.set_sta (station2)
fc2.add_param_ushort ("type", 0)
fc2.add_param_ushort ("bcast", 0)
+fc2.add_param_ushort ("mme", 0)
+fc2.add_param_ushort ("lid", 1)
+fc2.add_param_ushort ("tei", 1)
+fc2.send()
+
+fc2 = maximus.create_fcall ("fc_station_link_add")
+fc2.set_sta (station2)
+fc2.add_param_ushort ("type", 0)
+fc2.add_param_ushort ("bcast", 0)
fc2.add_param_ushort ("mme", 1)
fc2.add_param_ushort ("lid", 248)
fc2.add_param_ushort ("tei", 1)
@@ -117,14 +117,13 @@ frame0.src = '10:11:12:13:14:15'
frame0.dst = '20:21:22:23:24:25'
frame0.vlantag = 0x81004D4E
frame0.type = 0x4F50
-frame0.payload = f.read()[0:1450]
+frame0.payload = f.read()[0:1450]
fc1 = maximus.create_fcall ("fc_cl_data_send")
fc1.add_param_ushort ("length", 1450)
fc1.add_param ("buffer", frame0.get())
fc1.set_sta (station1)
fc1.send()
-
# ADD a MME to send.
fc1 = maximus.create_fcall ("fc_cl_mme_send")
fc1.set_sta (station1)
@@ -153,6 +152,15 @@ fc1.add_param_ushort ("lid", 1)
fc1.add_param_ushort ("tei", 2)
fc1.send()
+fc1 = maximus.create_fcall ("fc_station_link_remove")
+fc1.set_sta (station1)
+fc1.add_param_ushort ("type", 1)
+fc1.add_param_ushort ("bcast", 0)
+fc1.add_param_ushort ("mme", 1)
+fc1.add_param_ushort ("lid", 248)
+fc1.add_param_ushort ("tei", 2)
+fc1.send()
+
fc2 = maximus.create_fcall ("fc_station_link_remove")
fc2.set_sta (station2)
fc2.add_param_ushort ("type", 0)
@@ -162,6 +170,15 @@ fc2.add_param_ushort ("lid", 1)
fc2.add_param_ushort ("tei", 1)
fc2.send()
+fc2 = maximus.create_fcall ("fc_station_link_remove")
+fc2.set_sta (station2)
+fc2.add_param_ushort ("type", 0)
+fc2.add_param_ushort ("bcast", 0)
+fc2.add_param_ushort ("mme", 1)
+fc2.add_param_ushort ("lid", 248)
+fc2.add_param_ushort ("tei", 1)
+fc2.send()
+
#print the traces of the HLE
print "\n\n ************** Station 1 Traces *******************\n"
fc1 = maximus.create_fcall ("fc_cl_print_trace")
@@ -175,6 +192,10 @@ fc1.send()
print "\n\n ************ Station 1 Traces END ******************\n"
+fc1 = maximus.create_fcall ("fc_station_uninit")
+fc1.set_sta(station1)
+fc1.send();
+
station1.remove()
#print the traces of the HLE
@@ -190,4 +211,8 @@ fc1.send()
print "\n\n ************ Station 2 Traces END ******************\n"
+fc1 = maximus.create_fcall ("fc_station_uninit")
+fc1.set_sta(station2)
+fc1.send();
+
station2.remove()