summaryrefslogtreecommitdiff
path: root/cesar/mac/sar/test/functional/src/sar_tx.c
diff options
context:
space:
mode:
authorlaranjeiro2009-11-27 08:50:47 +0000
committerlaranjeiro2009-11-27 08:50:47 +0000
commit878f3eabb01c4c3322555891dd7565fd35e73f7c (patch)
treee415b5419a4c0244004ffe0d56f59d950567ea2c /cesar/mac/sar/test/functional/src/sar_tx.c
parent767a7ceb9e05af7eff424a112cf955bd3f17e703 (diff)
cesar/mac/sar: fix sar functional test
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@6494 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/mac/sar/test/functional/src/sar_tx.c')
-rw-r--r--cesar/mac/sar/test/functional/src/sar_tx.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/cesar/mac/sar/test/functional/src/sar_tx.c b/cesar/mac/sar/test/functional/src/sar_tx.c
index e93adf7f9f..f008c83ee3 100644
--- a/cesar/mac/sar/test/functional/src/sar_tx.c
+++ b/cesar/mac/sar/test/functional/src/sar_tx.c
@@ -18,6 +18,7 @@
#include "lib/test.h"
#include "lib/bitstream.h"
#include "lib/crc.h"
+#include "lib/trace.h"
#include <cyg/kernel/kapi.h>
#include <cyg/hal/hal_arch.h>
@@ -32,6 +33,8 @@
#include "mac/sar/sar.h"
#include "hal/phy/inc/bridgedma_soft.h"
+#include "mac/sar/inc/sar_context.h"
+
/* Variables needed by the test. */
#ifdef __sparc__
static u8 skbuffer[2048] __attribute__ ((section(".private")));
@@ -42,7 +45,6 @@ static sar_t *sar_ctx = NULL;
static mac_store_t *mac_store = NULL;
static uint count = 0;
-cyg_sem_t semaphore;
static u32 crcb1;
static u32 crcb2;
@@ -65,9 +67,6 @@ void
segmentation_done (void *ctx, u8 *buffer, void *user_data)
{
count ++;
-
- if (count == 2)
- cyg_semaphore_post (&semaphore);
}
void
@@ -111,6 +110,9 @@ prepare_test (test_t test)
if (added)
sar_mfs_add (sar_ctx, (mfs_t *)mfs);
+ /* Avoid expiration. */
+ sar_ctx->expiration_last_ntb = mac_ntb() + 1;
+
/* Add the first frame. */
sar_msdu_add (sar_ctx, buffer, 1434, mfs, NULL, mac_ntb());
/* Add the second frame. */
@@ -126,26 +128,26 @@ verify_test (test_t test)
mfs_tx_t *mfs = NULL;
pb_t *pb_first = NULL;
pb_t *pb_last = NULL;
- bool added = false;
sar_mf_t sar_mf;
pb_t *pb_list[6 + 1];
pb_t *pb_current = NULL;
uint i = 0;
u32 crc;
- mfs = mac_store_mfs_add_tx (mac_store, false, false, 1, 1, &added);
+ mfs = mac_store_mfs_get_tx (mac_store, false, false, 1, 1);
dbg_assert (mfs);
test_case_begin (test, "SAR TX");
test_begin (test, "Verify PBs")
{
+ test_fail_unless (count == 2);
+ test_fail_unless (mfs->seg_nb == 6);
test_fail_unless (mfs->fsm_state != MFS_FSM_CMD_RELEASE);
test_fail_unless (mfs->head != NULL);
test_fail_unless (mfs->tail!= NULL);
test_fail_unless (mfs->head != mfs->tail);
test_fail_unless (mfs->tail->header.ssn + 1 == mfs->seg_nb);
- test_fail_unless (mfs->seg_nb == 6);
pb_first = mfs->head;
pb_last = mfs->tail;
@@ -202,6 +204,7 @@ test_thread_process (cyg_addrword_t data)
uint pbproc;
test_init (test, 0, NULL);
+ trace_init ();
/* Initialise the test. */
mac_ntb_init ((phy_t *) &phy, &mac_config);
@@ -218,11 +221,12 @@ test_thread_process (cyg_addrword_t data)
prepare_test (test);
/* Wait the bridgedma ends its job. */
- cyg_semaphore_wait (&semaphore);
+ cyg_thread_delay (1);
verify_test (test);
test_result (test);
+ trace_buffer_dbg_dump (&sar_ctx->trace);
sar_uninit (sar_ctx);
pbproc_uninit ((pbproc_t *) &pbproc);
@@ -230,8 +234,6 @@ test_thread_process (cyg_addrword_t data)
mac_store_uninit (mac_store);
mac_ntb_uninit();
- cyg_semaphore_destroy (&semaphore);
-
#ifndef __sparc__
HAL_PLATFORM_EXIT (test_nb_failed (test) == 0 ? 0 : 1);
#endif
@@ -240,8 +242,6 @@ test_thread_process (cyg_addrword_t data)
int
cyg_user_start (void)
{
- cyg_semaphore_init(&semaphore, 0);
-
// Create the thread.
cyg_thread_create( 10,
&test_thread_process,