summaryrefslogtreecommitdiff
path: root/cesar/cp/cco/action/test/src/garbage.c
diff options
context:
space:
mode:
authorlaranjeiro2008-09-12 08:53:46 +0000
committerlaranjeiro2008-09-12 08:53:46 +0000
commit19b71c5eefca230702f298f49183ebe8c3f23ea5 (patch)
treee89beb05399e5a37a64f277a1fd7827a61aeabdd /cesar/cp/cco/action/test/src/garbage.c
parent32acd564b30d4f45519bd3256f959a96385210cc (diff)
cp/cco/action:
* Implemented the function to become CCo from the UCCo state and when the station (tested) becomes CCo. * Removed the comment in the garbage function to call the cp_sta_core_get_date_ms (tested) git-svn-id: svn+ssh://pessac/svn/cesar/trunk@2946 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/cp/cco/action/test/src/garbage.c')
-rw-r--r--cesar/cp/cco/action/test/src/garbage.c76
1 files changed, 47 insertions, 29 deletions
diff --git a/cesar/cp/cco/action/test/src/garbage.c b/cesar/cp/cco/action/test/src/garbage.c
index 98407ff30f..48083e8fc3 100644
--- a/cesar/cp/cco/action/test/src/garbage.c
+++ b/cesar/cp/cco/action/test/src/garbage.c
@@ -7,10 +7,13 @@
* }}} */
/**
* \file src/garbage.c
- * \brief Test the garbage.
+ * \brief Test the garbage.
* \ingroup cp_cco
*
*/
+#include <cyg/kernel/kapi.h>
+#include <cyg/hal/hal_arch.h>
+
#include "common/std.h"
#include "lib/test.h"
@@ -24,9 +27,12 @@
#include "cp/inc/context.h"
+#include "cl/cl.h"
+#include "cl/inc/context.h"
+
#include "stdio.h"
-#define TEST_CCO_ACTION_NB_STA 10
+#define TEST_CCO_ACTION_NB_STA 10
cyg_handle_t my_thread_handle;
cyg_thread my_thread;
@@ -56,37 +62,49 @@ my_thread_entry (cyg_addrword_t data)
cp_net_t *net;
mac_config_t mac_config;
uint phy;
-
- mac_ntb_init ((phy_t*) &phy, &mac_config);
-
- test_init (test, 0, NULL);
-
- cp_cco_action_init (&cp);
- cp_sta_mgr_init (&cp);
-
- net = cp_sta_mgr_get_our_avln (&cp);
-
- for (i = 0; i < TEST_CCO_ACTION_NB_STA; i++)
- {
- sta = cp_net_sta_add (&cp, net, 0, i + 1);
- sta->tei_lease_ms = i;
- slab_release (sta);
- sta = cp_net_sta_add (&cp, net, i + 1, i + 1);
- cp_sta_set_state (sta, CP_STA_STATE_AUTHENTICATED);
- sta->tei_lease_ms = i;
- slab_release (sta);
- }
-
- while (cyg_current_time () < 100)
- {
- cyg_thread_delay (5);
- cp_cco_action_garbage (&cp);
- }
+ uint date;
+ cl_t cl;
test_case_begin (test, "Verify garbage result");
- test_begin (test, "verify")
+ test_begin (test, "Verify")
{
+ mac_ntb_init ((phy_t*) &phy, &mac_config);
+
+ test_init (test, 0, NULL);
+
+ cp_cco_action_init (&cp);
+ cp_sta_mgr_init (&cp);
+ cp.cl = &cl;
+
+ memset (&cl, 0, sizeof(cl_t));
+ net = cp_sta_mgr_get_our_avln (&cp);
+
+ for (i = 0; i < TEST_CCO_ACTION_NB_STA; i++)
+ {
+ sta = cp_net_sta_add (&cp, net, 0, i + 1);
+ sta->tei_lease_ms = i;
+ slab_release (sta);
+ sta = cp_net_sta_add (&cp, net, i + 1, i + 1);
+ cp_sta_set_state (sta, CP_STA_STATE_AUTHENTICATED);
+ sta->tei_lease_ms = i;
+ slab_release (sta);
+ }
+ cp_net_commit_to_dataplane (&cp, net);
+ date = cyg_current_time () + 600;
+
+ while (cyg_current_time () < date)
+ {
+ cyg_thread_delay (5);
+ cp_cco_action_garbage (&cp);
+ }
+
+ test_fail_if (set_empty (&net->associated_stas) == false);
+ test_fail_if (set_empty (&net->unassociated_stas) == false);
+
+ /* Release the mac to tei table. */
+ if (cl.mactotei)
+ cl_mactotei_release_table (&cl);
}
test_end;