Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
surf_workstation_model -> workstation_model
[simgrid.git] / examples / msg / msg_test.c
index 826a9ef..2446e3d 100644 (file)
@@ -5,10 +5,13 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
+#include <stdio.h>
 #include "msg/msg.h" /* Yeah! If you want to use msg, you need to include msg/msg.h */
+#include "xbt/sysdep.h" /* calloc, printf */
 
 /* Create a log channel to have nice outputs. */
 #include "xbt/log.h"
+#include "xbt/asserts.h"
 XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,"Messages specific for this msg example");
 
 int master(int argc, char *argv[]);
@@ -83,6 +86,7 @@ int master(int argc, char *argv[])
     if(MSG_host_self()==slaves[i % slaves_count]) {
       INFO0("Hey ! It's me ! :)");
     }
+
     MSG_task_put(todo[i], slaves[i % slaves_count],
                  PORT_22);
     INFO0("Send completed");
@@ -125,7 +129,7 @@ int slave(int argc, char *argv[])
   return 0;
 } /* end_of_slave */
 
-/** Receiver function */
+/** Forwarder function */
 int forwarder(int argc, char *argv[])
 {
   int i;
@@ -165,6 +169,7 @@ int forwarder(int argc, char *argv[])
                    slaves[i% slaves_count]->name);
       MSG_task_put(task, slaves[i % slaves_count],
                   PORT_22);
+      i++;
     } else {
       INFO0("Hey ?! What's up ? ");
       xbt_assert0(0,"Unexpected behavior");
@@ -175,14 +180,13 @@ int forwarder(int argc, char *argv[])
   return 0;
 } /* end_of_forwarder */
 
-
 /** Test function */
 MSG_error_t test_all(const char *platform_file,
                            const char *application_file)
 {
   MSG_error_t res = MSG_OK;
 
-  /* MSG_config("surf_workstation_model","KCCFLN05"); */
+  MSG_config("workstation_model","CLM03");
   {                            /*  Simulation setting */
     MSG_set_channel_number(MAX_CHANNEL);
     MSG_paje_output("msg_test.trace");
@@ -215,6 +219,8 @@ int main(int argc, char *argv[])
   res = test_all(argv[1],argv[2]);
   MSG_clean();
 
-  if(res==MSG_OK) return 0; 
-  else return 1;
+  if(res==MSG_OK)
+    return 0;
+  else
+    return 1;
 } /* end_of_main */