Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add new example to test MC_random function
authorcristianrosa <cristianrosa@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 11 May 2010 15:42:38 +0000 (15:42 +0000)
committercristianrosa <cristianrosa@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 11 May 2010 15:42:38 +0000 (15:42 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7737 48e7efb5-ca39-0410-a469-dd3cf9ba447f

examples/msg/mc/CMakeLists.txt
examples/msg/mc/deploy_random_test.xml [new file with mode: 0644]
examples/msg/mc/random_test.c [new file with mode: 0644]

index db4e8d0..022fcf2 100644 (file)
@@ -5,7 +5,9 @@ set(EXECUTABLE_OUTPUT_PATH "${PROJECT_DIRECTORY}/examples/msg/mc/")
 add_executable(centralized centralized_mutex.c)
 add_executable(bugged1     bugged1.c)
 add_executable(bugged2     bugged2.c)
+add_executable(random_test random_test.c)
 
 target_link_libraries(centralized simgrid m -fprofile-arcs)
 target_link_libraries(bugged1     simgrid m -fprofile-arcs)
 target_link_libraries(bugged2     simgrid m -fprofile-arcs)
+target_link_libraries(random_test     simgrid m -fprofile-arcs)
\ No newline at end of file
diff --git a/examples/msg/mc/deploy_random_test.xml b/examples/msg/mc/deploy_random_test.xml
new file mode 100644 (file)
index 0000000..71352e6
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "simgrid.dtd">
+<platform version="2">
+  <process host="HostA" function="server">
+    <argument value="0"/>
+  </process>
+  <process host="HostB" function="server">
+    <argument value="0"/>
+  </process>
+
+<!--  <process host="HostB" function="client">
+    <argument value="1"/>
+  </process>  
+  <process host="HostC" function="client">
+    <argument value="2"/>
+  </process> -->
+</platform>
diff --git a/examples/msg/mc/random_test.c b/examples/msg/mc/random_test.c
new file mode 100644 (file)
index 0000000..3dee89c
--- /dev/null
@@ -0,0 +1,32 @@
+#include <msg/msg.h>
+#include <mc/modelchecker.h>
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(random_test,"Random Test");
+
+int server(int argc,char *argv[]);
+
+int server(int argc,char *argv[])
+{
+  int val;
+  val = MC_random(3,6);
+  INFO1("val=%d", val);
+  INFO0("OK");
+  return 0;
+}
+
+int main(int argc,char*argv[]) 
+{
+  MSG_global_init(&argc,argv);
+
+  MSG_create_environment("platform.xml");
+
+  MSG_function_register("server", server);
+
+//  MSG_function_register("client", client);
+
+  MSG_launch_application("deploy_random_test.xml");
+
+  MSG_main();
+
+  return 0;
+}