summaryrefslogtreecommitdiff
path: root/mac/sar/test/maximus_test/src/Maximus_sar.cpp
diff options
context:
space:
mode:
authorlaranjeiro2007-09-21 15:01:36 +0000
committerlaranjeiro2007-09-21 15:01:36 +0000
commit9926e455632e46ceb92b91ff9ad0be44ab80ab1d (patch)
treeb012fd7174ed391844cfc1316c629a2df4ad8c43 /mac/sar/test/maximus_test/src/Maximus_sar.cpp
parent4edce63f9d0e798a0dd7e94d45f8afc529e2ba4d (diff)
Generic Functional test of the SAR on maximus.
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@729 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'mac/sar/test/maximus_test/src/Maximus_sar.cpp')
-rw-r--r--mac/sar/test/maximus_test/src/Maximus_sar.cpp302
1 files changed, 70 insertions, 232 deletions
diff --git a/mac/sar/test/maximus_test/src/Maximus_sar.cpp b/mac/sar/test/maximus_test/src/Maximus_sar.cpp
index 07e086c444..315df24d7b 100644
--- a/mac/sar/test/maximus_test/src/Maximus_sar.cpp
+++ b/mac/sar/test/maximus_test/src/Maximus_sar.cpp
@@ -89,28 +89,6 @@ bool reassembly (Maximus *maximus, Sta *station, station_cb_t sta_cb,
sar_max_job_t *sar_max_job) throw();
/**
- * Launch the test on one shoot mode.
- *
- * \param argc the quantity of arguments provided
- * \param argv the char array containing the arguments
- * \param sar_max_job the job to process.
- *
- * \return the end value
- */
-int one_shoot (int argc, char *argv[], sar_max_job_t *sar_max_job);
-
-/**
- * Launch the test on multiple shoot mode.
- *
- * \param argc the quantity of arguments provided
- * \param argv the char array containing the arguments
- * \param iter the quantity of iteration the multiple shoot should do.
- *
- * \return the end value
- */
-int multiple_shoot (int argc, char *argv[], int iter);
-
-/**
* Launch the procedure with n segmentation and one reassembly
*
* \param argc the quantity of arguments provided
@@ -128,197 +106,61 @@ bool test_fail;
int fifo_blk[2];
-int main (int argc, char *argv[])
-{
- /* create the fifo */
- if (pipe (fifo_blk) < 0)
- {
- printf ("Can not create the pipe for the PBs communication\n");
- exit (-1);
- }
-
- sar_max_job_t *sar_max_job;
-
- sar_max_job = (sar_max_job_t *) malloc (sizeof(sar_max_job_t));
- // sar_max_job->next = (sar_max_job_t *) malloc (sizeof (sar_max_job_t));
- // sar_max_job->next->next = NULL;
-
- sar_max_job->next = NULL;
-
- sar_max_job->lid = 1;
- sar_max_job->tei = 2;
- sar_max_job->bcast = false;
- sar_max_job->mf_type = 2;
- sar_max_job->packet_id = 0;
-
- // sar_max_job->next->lid = 1;
- // sar_max_job->next->tei = 2;
- // sar_max_job->next->bcast = false;
- // sar_max_job->next->mf_type = 2;
- // sar_max_job->next->packet_id = 1;
-
- return one_shoot (argc, argv, sar_max_job);
- //return multiple_shoot (argc, argv, 2);
-
- //return launch_x_segs (argc, argv, sar_max_job);
-}
+int max_jobs_qte;
-/**
- * Launch the test on one shoot mode.
- *
- * \param argc the quantity of arguments provided
- * \param argv the char array containing the arguments
- * \param sar_max_job the job to process.
- *
- * \return the end value
- */
-int one_shoot (int argc, char *argv[], sar_max_job_t *sar_max_job)
+int main (int argc, char *argv[])
{
- bool logs;
+ sar_max_job_t *sar_max_job = NULL;
try
{
- test_fail = false;
- station1_rsp = false;
- station2_rsp = false;
-
- Maximus maximus;
- maximus.init (argc, argv);
+ station1_rsp = 0;
+ station2_rsp = 0;
- Sta station1 = maximus.create_sta ();
- //station1.debug ();
- Sta station2 = maximus.create_sta ();
- //station2.debug ();
-
- // activate the sta 1 logs
- Msg fc = maximus.create_fc ("activate_logs");
- logs = true;
- fc.add_param ("debug", sizeof(unsigned char), (unsigned char *) &logs);
- fc.send (station2);
- fc.send (station1);
-
- segmentation (&maximus, &station1, station1_cb, sar_max_job);
-
- while (!station1_rsp)
- {
- maximus.process ();
- }
-
- if (test_fail)
- return 0;
-
- sar_max_job->tei = 1;
- if (!reassembly (&maximus, &station2, station2_cb, sar_max_job))
- {
- printf ("Error on reassembly process\n");
- exit (-1);
- }
-
- while (!station2_rsp)
- {
- maximus.process ();
- }
+ /* create the fifo */
+ if (pipe (fifo_blk) < 0)
+ {
+ printf ("Can not create the pipe for the PBs communication\n");
+ exit (-1);
+ }
- maximus.wait (10000);
+ sar_max_job = (sar_max_job_t *) malloc (sizeof (sar_max_job_t));
+ sar_max_job->next = (sar_max_job_t *) malloc (sizeof (sar_max_job_t));
+ sar_max_job->next->next = NULL;
+
+ /* Init job 1 */
+ sar_max_job->lid = 1;
+ sar_max_job->tei_src = 1;
+ sar_max_job->tei_dest = 2;
+ sar_max_job->bcast = false;
+ sar_max_job->mf_type = 2;
+ sar_max_job->packet_id = 0;
+
+ /* Init job 2 */
+ sar_max_job->next->lid = 1;
+ sar_max_job->next->tei_src = 1;
+ sar_max_job->next->tei_dest = 2;
+ sar_max_job->next->bcast = false;
+ sar_max_job->next->mf_type = 2;
+ sar_max_job->packet_id = 0;
+
+ max_jobs_qte = 2;
+
+ return launch_x_segs (argc, argv, sar_max_job);
}
- catch (Error &e)
+ catch (Error &e)
{
- exit (-1);
+ sar_max_job_t *sar_max_job_curr;
+ while (sar_max_job)
+ {
+ sar_max_job_curr = sar_max_job;
+ sar_max_job = sar_max_job->next;
+ free (sar_max_job_curr);
+ }
}
-
- return 0;
}
/**
- * Launch the test on multiple shoot mode.
- *
- * \param argc the quantity of arguments provided
- * \param argv the char array containing the arguments
- * \param iter the quantity of iteration the multiple shoot should do.
- *
- * \return the end value
- */
-//int multiple_shoot (int argc, char *argv[], int iter)
-//{
-// unsigned char lid;
-// unsigned char tei;
-// bool bcast;
-// unsigned char mf_type;
-// unsigned char packet[1];
-// bool logs;
-// int i;
-//
-// test_fail = false;
-// station1_rsp = false;
-// station2_rsp = false;
-//
-// maximus.init (argc, argv);
-//
-// Sta station1 = maximus.create_sta ();
-// //station1.debug ();
-// Sta station2 = maximus.create_sta ();
-// //station2.debug ();
-//
-// // activate the sta 1 logs
-// Msg fc = maximus.create_fc ("activate_logs");
-// logs = true;
-// fc.add_param ("debug", sizeof(unsigned char), (unsigned char *) &logs);
-// fc.send (station2);
-// fc.send (station1);
-//
-// while (iter)
-// {
-// iter --;
-// station1_rsp = false;
-// station2_rsp = false;
-//
-// printf ("ITER : %d\n", iter);
-//
-// lid = 1;
-// tei = 2;
-// bcast = false;
-// mf_type = 2;
-// packet[0] = 0;
-// segmentation (&station1, station1_cb, lid, tei, bcast, mf_type,
-// packet);
-//
-// i = 0;
-// while (!station1_rsp || test_fail)
-// {
-// maximus.process ();
-// i++;
-//
-// if (i == 100)
-// {
-// test_fail = true;
-// }
-// }
-//
-// if (test_fail)
-// return 0;
-//
-// tei = 1;
-// reassembly (&station2, station2_cb, lid, tei, bcast, mf_type, packet);
-//
-// i = 0;
-// while (!station2_rsp)
-// {
-// maximus.process ();
-// i++;
-//
-// if (i == 100)
-// {
-// test_fail = true;
-// }
-// }
-//
-// maximus.wait (1000);
-// }
-//
-// return 0;
-//}
-
-/**
* Launch the procedure with n segmentation and one reassembly
*
* \param argc the quantity of arguments provided
@@ -332,64 +174,60 @@ int launch_x_segs (int argc, char *argv[], sar_max_job_t *sar_max_job)
{
bool logs;
int i;
-
test_fail = false;
- station1_rsp = false;
- station2_rsp = false;
Maximus maximus;
maximus.init (argc, argv);
Sta station1 = maximus.create_sta ();
- station1.debug ();
- //Sta station2 = maximus.create_sta ();
+ //station1.debug ();
+ Sta station2 = maximus.create_sta ();
//station2.debug ();
// activate the sta 1 logs
Msg fc = maximus.create_fc ("activate_logs");
logs = true;
- fc.add_param ("init", sizeof(unsigned char), (unsigned char *) &logs);
- //fc.send (station2);
+ fc.add_param ("debug", sizeof(unsigned char), (unsigned char *) &logs);
fc.send (station1);
-
- station1_rsp = false;
- station2_rsp = false;
+ fc.send (station2);
segmentation (&maximus, &station1, station1_cb, sar_max_job);
i = 0;
- while (!station1_rsp || test_fail)
+ while (!station1_rsp && !test_fail)
{
- maximus.process ();
+ if (i > 50)
+ {
+ test_fail = true;
+ }
i++;
- if (i == 100)
+ maximus.process ();
+ }
+
+ if (test_fail)
+ return -1;
+
+ reassembly (&maximus, &station2, &station2_cb, sar_max_job);
+
+ i = 0;
+ while (!station2_rsp && !test_fail)
+ {
+ if (i > 50)
{
test_fail = true;
}
+ i++;
+
+ maximus.process ();
}
+
+ maximus.wait (100);
if (test_fail)
+ return -1;
+ else
return 0;
-
- // tei = 1;
- // reassembly (&station2, station2_cb, lid, tei, bcast, mf_type, row_list);
- //
- // i = 0;
- // while (!station2_rsp)
- // {
- // maximus.process ();
- // i++;
- //
- // if (i == 100)
- // {
- // test_fail = true;
- // }
- // }
-
- maximus.wait (1000);
-
- return 0;
}
/**