From 6f9ef24cdd40461d86fdad0bf632d7d5bbd5aeed Mon Sep 17 00:00:00 2001 From: cristianrosa Date: Tue, 11 May 2010 15:42:38 +0000 Subject: [PATCH] Add new example to test MC_random function git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@7737 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- examples/msg/mc/CMakeLists.txt | 2 ++ examples/msg/mc/deploy_random_test.xml | 17 ++++++++++++++ examples/msg/mc/random_test.c | 32 ++++++++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 examples/msg/mc/deploy_random_test.xml create mode 100644 examples/msg/mc/random_test.c diff --git a/examples/msg/mc/CMakeLists.txt b/examples/msg/mc/CMakeLists.txt index db4e8d00e1..022fcf28ef 100644 --- a/examples/msg/mc/CMakeLists.txt +++ b/examples/msg/mc/CMakeLists.txt @@ -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 index 0000000000..71352e6729 --- /dev/null +++ b/examples/msg/mc/deploy_random_test.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + diff --git a/examples/msg/mc/random_test.c b/examples/msg/mc/random_test.c new file mode 100644 index 0000000000..3dee89cc74 --- /dev/null +++ b/examples/msg/mc/random_test.c @@ -0,0 +1,32 @@ +#include +#include + +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; +} -- 2.20.1