From f704e0bb48c5990fee9ece0700a4069e9f479d73 Mon Sep 17 00:00:00 2001 From: Frederic Suter Date: Mon, 14 Mar 2016 13:51:18 +0100 Subject: [PATCH] factor Cmake and clean files --- .gitignore | 2 +- examples/msg/mc/CMakeLists.txt | 78 ++++------- examples/msg/mc/bugged1.c | 17 +-- examples/msg/mc/bugged1_liveness.c | 18 +-- examples/msg/mc/bugged1_liveness.h | 3 - examples/msg/mc/bugged2.c | 8 +- examples/msg/mc/bugged2_liveness.c | 32 ++--- examples/msg/mc/bugged2_liveness.h | 3 - examples/msg/mc/bugged3.c | 7 +- examples/msg/mc/centralized_mutex.c | 18 +-- ...entralized.tesh => centralized_mutex.tesh} | 2 +- examples/msg/mc/deploy_bugged1.xml | 16 +-- examples/msg/mc/deploy_bugged1_liveness.xml | 10 +- .../mc/deploy_bugged1_liveness_visited.xml | 10 +- examples/msg/mc/deploy_bugged2.xml | 12 +- examples/msg/mc/deploy_bugged2_liveness.xml | 10 +- examples/msg/mc/deploy_bugged3.xml | 12 +- ...mutex.xml => deploy_centralized_mutex.xml} | 0 examples/msg/mc/deploy_electric_fence.xml | 12 +- examples/msg/mc/electric_fence.c | 14 +- teshsuite/mc/CMakeLists.txt | 17 +-- teshsuite/mc/dwarf/CMakeLists.txt | 10 +- teshsuite/mc/dwarf_expression/CMakeLists.txt | 10 +- teshsuite/mc/mutex_handling.c | 13 +- teshsuite/mc/mutex_handling.xml | 12 +- teshsuite/mc/replay/CMakeLists.txt | 17 +-- teshsuite/mc/replay/random_bug.c | 6 +- teshsuite/simdag/platforms/CMakeLists.txt | 123 ++++++++---------- ...route_time.c => evaluate_get_route_time.c} | 0 ...ate_parse_time.c => evaluate_parse_time.c} | 0 30 files changed, 148 insertions(+), 344 deletions(-) rename examples/msg/mc/{centralized.tesh => centralized_mutex.tesh} (98%) rename examples/msg/mc/{deploy_mutex.xml => deploy_centralized_mutex.xml} (100%) rename teshsuite/simdag/platforms/{Evaluate_get_route_time.c => evaluate_get_route_time.c} (100%) rename teshsuite/simdag/platforms/{Evaluate_parse_time.c => evaluate_parse_time.c} (100%) diff --git a/.gitignore b/.gitignore index ce66e3d2c5..450c46019b 100644 --- a/.gitignore +++ b/.gitignore @@ -166,7 +166,7 @@ examples/msg/mc/bugged2 examples/msg/mc/bugged2_liveness examples/msg/mc/bugged2_stateful examples/msg/mc/bugged3 -examples/msg/mc/centralized +examples/msg/mc/centralized_mutex examples/msg/mc/centralized_liveness examples/msg/mc/electric_fence examples/msg/mc/test/snapshot_comparison1 diff --git a/examples/msg/mc/CMakeLists.txt b/examples/msg/mc/CMakeLists.txt index c3b72684d6..d6e288b686 100644 --- a/examples/msg/mc/CMakeLists.txt +++ b/examples/msg/mc/CMakeLists.txt @@ -1,19 +1,13 @@ -if(HAVE_MC) - add_executable (centralized centralized_mutex.c) - target_link_libraries(centralized simgrid) - add_executable (bugged1 bugged1.c) - target_link_libraries(bugged1 simgrid) - add_executable (bugged2 bugged2.c) - target_link_libraries(bugged2 simgrid) - add_executable (bugged3 bugged3.c) - target_link_libraries(bugged3 simgrid) - add_executable (electric_fence electric_fence.c) - target_link_libraries(electric_fence simgrid) - add_executable (bugged1_liveness bugged1_liveness.c) - target_link_libraries(bugged1_liveness simgrid) - add_executable (bugged2_liveness bugged2_liveness.c) - target_link_libraries(bugged2_liveness simgrid) +foreach (x bugged1 bugged2 bugged3 centralized_mutex electric_fence bugged1_liveness bugged2_liveness) + if(HAVE_MC) + add_executable (${x} ${x}.c) + target_link_libraries(${x} simgrid) + endif() + set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}.c) + set(xml_files ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/deploy_${x}.xml) +endforeach() +if(HAVE_MC) if(HAVE_C_STACK_CLEANER) add_executable (bugged1_liveness_cleaner_on bugged1_liveness.c) target_link_libraries(bugged1_liveness_cleaner_on simgrid) @@ -25,43 +19,17 @@ if(HAVE_MC) endif() endif() -set(tesh_files - ${tesh_files} - ${CMAKE_CURRENT_SOURCE_DIR}/bugged1.tesh - ${CMAKE_CURRENT_SOURCE_DIR}/bugged2.tesh - ${CMAKE_CURRENT_SOURCE_DIR}/bugged1_liveness.tesh - ${CMAKE_CURRENT_SOURCE_DIR}/bugged1_liveness_visited.tesh - ${CMAKE_CURRENT_SOURCE_DIR}/bugged1_liveness_sparse.tesh - ${CMAKE_CURRENT_SOURCE_DIR}/bugged1_liveness_visited_sparse.tesh - ${CMAKE_CURRENT_SOURCE_DIR}/centralized.tesh - PARENT_SCOPE) -set(xml_files - ${xml_files} - ${CMAKE_CURRENT_SOURCE_DIR}/deploy_bugged1_liveness.xml - ${CMAKE_CURRENT_SOURCE_DIR}/deploy_bugged1_liveness_visited.xml - ${CMAKE_CURRENT_SOURCE_DIR}/deploy_bugged1.xml - ${CMAKE_CURRENT_SOURCE_DIR}/deploy_bugged2_liveness.xml - ${CMAKE_CURRENT_SOURCE_DIR}/deploy_bugged2.xml - ${CMAKE_CURRENT_SOURCE_DIR}/deploy_bugged3.xml - ${CMAKE_CURRENT_SOURCE_DIR}/deploy_electric_fence.xml - ${CMAKE_CURRENT_SOURCE_DIR}/deploy_mutex.xml - ${CMAKE_CURRENT_SOURCE_DIR}/platform.xml - PARENT_SCOPE) -set(examples_src - ${examples_src} - ${CMAKE_CURRENT_SOURCE_DIR}/bugged1.c - ${CMAKE_CURRENT_SOURCE_DIR}/bugged1_liveness.c - ${CMAKE_CURRENT_SOURCE_DIR}/bugged2.c - ${CMAKE_CURRENT_SOURCE_DIR}/bugged2_liveness.c - ${CMAKE_CURRENT_SOURCE_DIR}/bugged3.c - ${CMAKE_CURRENT_SOURCE_DIR}/electric_fence.c - ${CMAKE_CURRENT_SOURCE_DIR}/centralized_mutex.c - ${CMAKE_CURRENT_SOURCE_DIR}/bugged1_liveness.h - ${CMAKE_CURRENT_SOURCE_DIR}/bugged2_liveness.h - PARENT_SCOPE) -set(bin_files - ${bin_files} - ${CMAKE_CURRENT_SOURCE_DIR}/promela_bugged1_liveness - ${CMAKE_CURRENT_SOURCE_DIR}/promela_bugged2_liveness - ${CMAKE_CURRENT_SOURCE_DIR}/bugged1_liveness_stack_cleaner - PARENT_SCOPE) +set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/bugged1.tesh + ${CMAKE_CURRENT_SOURCE_DIR}/bugged2.tesh + ${CMAKE_CURRENT_SOURCE_DIR}/bugged1_liveness.tesh + ${CMAKE_CURRENT_SOURCE_DIR}/bugged1_liveness_visited.tesh + ${CMAKE_CURRENT_SOURCE_DIR}/bugged1_liveness_sparse.tesh + ${CMAKE_CURRENT_SOURCE_DIR}/bugged1_liveness_visited_sparse.tesh + ${CMAKE_CURRENT_SOURCE_DIR}/centralized_mutex.tesh PARENT_SCOPE) +set(xml_files ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/deploy_bugged1_liveness_visited.xml + ${CMAKE_CURRENT_SOURCE_DIR}/platform.xml PARENT_SCOPE) +set(examples_src ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/bugged1_liveness.h + ${CMAKE_CURRENT_SOURCE_DIR}/bugged2_liveness.h PARENT_SCOPE) +set(bin_files ${bin_files} ${CMAKE_CURRENT_SOURCE_DIR}/promela_bugged1_liveness + ${CMAKE_CURRENT_SOURCE_DIR}/promela_bugged2_liveness + ${CMAKE_CURRENT_SOURCE_DIR}/bugged1_liveness_stack_cleaner PARENT_SCOPE) diff --git a/examples/msg/mc/bugged1.c b/examples/msg/mc/bugged1.c index aa397f8d53..e709335eea 100644 --- a/examples/msg/mc/bugged1.c +++ b/examples/msg/mc/bugged1.c @@ -16,10 +16,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(example, "this example"); -int server(int argc, char *argv[]); -int client(int argc, char *argv[]); - -int server(int argc, char *argv[]) +static int server(int argc, char *argv[]) { msg_task_t task = NULL; int count = 0; @@ -37,12 +34,9 @@ int server(int argc, char *argv[]) return 0; } -int client(int argc, char *argv[]) +static int client(int argc, char *argv[]) { - - msg_task_t task = - MSG_task_create(argv[1], 0 /*comp cost */ , 10000 /*comm size */ , - NULL /*arbitrary data */ ); + msg_task_t task = MSG_task_create(argv[1], 0 /*comp cost */ , 10000 /*comm size */ , NULL /*arbitrary data */ ); MSG_task_send(task, "mymailbox"); @@ -52,19 +46,14 @@ int client(int argc, char *argv[]) int main(int argc, char *argv[]) { - MSG_init(&argc, argv); MSG_create_environment("platform.xml"); MSG_function_register("server", server); - MSG_function_register("client", client); - MSG_launch_application("deploy_bugged1.xml"); MSG_main(); - return 0; - } diff --git a/examples/msg/mc/bugged1_liveness.c b/examples/msg/mc/bugged1_liveness.c index ac0fb35809..04945213c5 100644 --- a/examples/msg/mc/bugged1_liveness.c +++ b/examples/msg/mc/bugged1_liveness.c @@ -37,7 +37,7 @@ static void garbage_stack(void) { } #endif -int coordinator(int argc, char *argv[]) +static int coordinator(int argc, char *argv[]) { int CS_used = 0; msg_task_t task = NULL, answer = NULL; @@ -61,7 +61,7 @@ int coordinator(int argc, char *argv[]) answer = NULL; } } - } else { + } else { if (!xbt_dynar_is_empty(requests)) { XBT_INFO("CS release. Grant to queued requests (queue size: %lu)", xbt_dynar_length(requests)); xbt_dynar_shift(requests, &req); @@ -81,11 +81,10 @@ int coordinator(int argc, char *argv[]) kind = NULL; req = NULL; } - return 0; } -int client(int argc, char *argv[]) +static int client(int argc, char *argv[]) { int my_pid = MSG_process_get_PID(MSG_process_self()); @@ -125,7 +124,7 @@ int client(int argc, char *argv[]) release = NULL; MSG_process_sleep(my_pid); - + if(strcmp(my_mailbox, "1") == 0){ cs=0; r=0; @@ -133,7 +132,6 @@ int client(int argc, char *argv[]) } } - return 0; } @@ -151,19 +149,15 @@ static int raw_client(int argc, char *argv[]) int main(int argc, char *argv[]) { MSG_init(&argc, argv); - char **options = &argv[1]; MC_automaton_new_propositional_symbol_pointer("r", &r); MC_automaton_new_propositional_symbol_pointer("cs", &cs); - const char* platform_file = options[0]; - const char* application_file = options[1]; - - MSG_create_environment(platform_file); + MSG_create_environment(argv[1]); MSG_function_register("coordinator", coordinator); MSG_function_register("client", raw_client); - MSG_launch_application(application_file); + MSG_launch_application(argv[2]); MSG_main(); diff --git a/examples/msg/mc/bugged1_liveness.h b/examples/msg/mc/bugged1_liveness.h index 7246422f64..c24c967c49 100644 --- a/examples/msg/mc/bugged1_liveness.h +++ b/examples/msg/mc/bugged1_liveness.h @@ -10,7 +10,4 @@ int predR(void); int predCS(void); -int coordinator(int argc, char *argv[]); -int client(int argc, char *argv[]); - #endif diff --git a/examples/msg/mc/bugged2.c b/examples/msg/mc/bugged2.c index 4cda68c9cc..9087da3cc2 100644 --- a/examples/msg/mc/bugged2.c +++ b/examples/msg/mc/bugged2.c @@ -15,10 +15,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(example, "this example"); -int server(int argc, char *argv[]); -int client(int argc, char *argv[]); - -int server(int argc, char *argv[]) +static int server(int argc, char *argv[]) { msg_task_t task1 = NULL; msg_task_t task2 = NULL; @@ -52,7 +49,7 @@ int server(int argc, char *argv[]) return 0; } -int client(int argc, char *argv[]) +static int client(int argc, char *argv[]) { msg_task_t task1 = MSG_task_create(argv[1], 0, 10000, NULL); msg_task_t task2 = MSG_task_create(argv[1], 0, 10000, NULL); @@ -77,6 +74,5 @@ int main(int argc, char *argv[]) MSG_launch_application("deploy_bugged2.xml"); MSG_main(); - return 0; } diff --git a/examples/msg/mc/bugged2_liveness.c b/examples/msg/mc/bugged2_liveness.c index e13dd5ab70..da785bb23f 100644 --- a/examples/msg/mc/bugged2_liveness.c +++ b/examples/msg/mc/bugged2_liveness.c @@ -16,16 +16,13 @@ #include "bugged2_liveness.h" XBT_LOG_NEW_DEFAULT_CATEGORY(bugged3, "my log messages"); - -int cs = 0; -int coordinator(int argc, char **argv); -int client(int argc, char **argv); +int cs = 0; -int coordinator(int argc, char *argv[]) +static int coordinator(int argc, char *argv[]) { int CS_used = 0; // initially the CS is idle - + while (1) { msg_task_t task = NULL; MSG_task_receive(&task, "coordinator"); @@ -49,56 +46,47 @@ int coordinator(int argc, char *argv[]) MSG_task_destroy(task); kind = NULL; } - + return 0; } -int client(int argc, char *argv[]) +static int client(int argc, char *argv[]) { int my_pid = MSG_process_get_PID(MSG_process_self()); char *my_mailbox = xbt_strdup(argv[1]); const char* kind; - - while(1){ + while(1){ XBT_INFO("Client (%s) asks the request", my_mailbox); - MSG_task_send(MSG_task_create("request", 0, 1000, my_mailbox), - "coordinator"); + MSG_task_send(MSG_task_create("request", 0, 1000, my_mailbox), "coordinator"); msg_task_t answer = NULL; MSG_task_receive(&answer, my_mailbox); kind = MSG_task_get_name(answer); - - if (!strcmp(kind, "grant")) { + if (!strcmp(kind, "grant")) { XBT_INFO("Client (%s) got the answer (grant). Sleep a bit and release it", my_mailbox); - if(!strcmp(my_mailbox, "1")) cs = 1; - }else{ - XBT_INFO("Client (%s) got the answer (not grant). Try again", my_mailbox); - } MSG_task_destroy(answer); kind = NULL; - + MSG_process_sleep(my_pid); } - return 0; } int main(int argc, char *argv[]) { - MSG_init(&argc, argv); MC_automaton_new_propositional_symbol_pointer("cs", &cs); - + MSG_create_environment("../msg_platform.xml"); MSG_function_register("coordinator", coordinator); MSG_function_register("client", client); diff --git a/examples/msg/mc/bugged2_liveness.h b/examples/msg/mc/bugged2_liveness.h index ec62e315aa..d9ad041d7e 100644 --- a/examples/msg/mc/bugged2_liveness.h +++ b/examples/msg/mc/bugged2_liveness.h @@ -9,7 +9,4 @@ int predCS(void); -int coordinator(int argc, char *argv[]); -int client(int argc, char *argv[]); - #endif diff --git a/examples/msg/mc/bugged3.c b/examples/msg/mc/bugged3.c index c89b32de39..3d8d7364a9 100644 --- a/examples/msg/mc/bugged3.c +++ b/examples/msg/mc/bugged3.c @@ -18,10 +18,8 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(bugged3, "this example"); -int server(int argc, char *argv[]); -int client(int argc, char *argv[]); -int server(int argc, char *argv[]) +static int server(int argc, char *argv[]) { msg_task_t task1,task2; @@ -39,7 +37,7 @@ int server(int argc, char *argv[]) return 0; } -int client(int argc, char *argv[]) +static int client(int argc, char *argv[]) { msg_task_t task1 = MSG_task_create(argv[1], 0, 10000, NULL); @@ -65,6 +63,5 @@ int main(int argc, char *argv[]) MSG_launch_application("deploy_bugged3.xml"); MSG_main(); - return 0; } diff --git a/examples/msg/mc/centralized_mutex.c b/examples/msg/mc/centralized_mutex.c index bc6e7ee052..64a4461211 100644 --- a/examples/msg/mc/centralized_mutex.c +++ b/examples/msg/mc/centralized_mutex.c @@ -16,10 +16,7 @@ #define CS_PER_PROCESS 2 XBT_LOG_NEW_DEFAULT_CATEGORY(centralized, "my log messages"); -int coordinator(int argc, char **argv); -int client(int argc, char **argv); - -int coordinator(int argc, char *argv[]) +static int coordinator(int argc, char *argv[]) { xbt_dynar_t requests = xbt_dynar_new(sizeof(char *), NULL); // dynamic vector storing requests (which are char*) int CS_used = 0; // initially the CS is idle @@ -41,8 +38,7 @@ int coordinator(int argc, char *argv[]) } } else { // that's a release. Check if someone was waiting for the lock if (!xbt_dynar_is_empty(requests)) { - XBT_INFO("CS release. Grant to queued requests (queue size: %lu)", - xbt_dynar_length(requests)); + XBT_INFO("CS release. Grant to queued requests (queue size: %lu)", xbt_dynar_length(requests)); char *req; xbt_dynar_shift(requests, &req); MSG_task_send(MSG_task_create("grant", 0, 1000, NULL), req); @@ -59,7 +55,7 @@ int coordinator(int argc, char *argv[]) return 0; } -int client(int argc, char *argv[]) +static int client(int argc, char *argv[]) { int my_pid = MSG_process_get_PID(MSG_process_self()); // use my pid as name of mailbox to contact me @@ -68,16 +64,14 @@ int client(int argc, char *argv[]) int i; for (i = 0; i < CS_PER_PROCESS; i++) { XBT_INFO("Ask the request"); - MSG_task_send(MSG_task_create("request", 0, 1000, my_mailbox), - "coordinator"); + MSG_task_send(MSG_task_create("request", 0, 1000, my_mailbox), "coordinator"); // wait the answer msg_task_t grant = NULL; MSG_task_receive(&grant, my_mailbox); MSG_task_destroy(grant); XBT_INFO("got the answer. Sleep a bit and release it"); MSG_process_sleep(1); - MSG_task_send(MSG_task_create("release", 0, 1000, NULL), - "coordinator"); + MSG_task_send(MSG_task_create("release", 0, 1000, NULL), "coordinator"); MSG_process_sleep(my_pid); } XBT_INFO("Got all the CS I wanted, quit now"); @@ -90,7 +84,7 @@ int main(int argc, char *argv[]) MSG_create_environment("../msg_platform.xml"); MSG_function_register("coordinator", coordinator); MSG_function_register("client", client); - MSG_launch_application("deploy_mutex.xml"); + MSG_launch_application("deploy_centralized_mutex.xml"); MSG_main(); return 0; } diff --git a/examples/msg/mc/centralized.tesh b/examples/msg/mc/centralized_mutex.tesh similarity index 98% rename from examples/msg/mc/centralized.tesh rename to examples/msg/mc/centralized_mutex.tesh index 1e14eb3dbf..791d064305 100644 --- a/examples/msg/mc/centralized.tesh +++ b/examples/msg/mc/centralized_mutex.tesh @@ -1,6 +1,6 @@ #! ./tesh -$ ${bindir:=.}/centralized +$ ${bindir:=.}/centralized_mutex > [Fafard:client:(2) 0.000000] [centralized/INFO] Ask the request > [Boivin:client:(3) 0.000000] [centralized/INFO] Ask the request > [TeX:client:(4) 0.000000] [centralized/INFO] Ask the request diff --git a/examples/msg/mc/deploy_bugged1.xml b/examples/msg/mc/deploy_bugged1.xml index 1e99f4dc56..9d971c0be6 100644 --- a/examples/msg/mc/deploy_bugged1.xml +++ b/examples/msg/mc/deploy_bugged1.xml @@ -1,16 +1,8 @@ - - - - - - - - - - - - + + + + diff --git a/examples/msg/mc/deploy_bugged1_liveness.xml b/examples/msg/mc/deploy_bugged1_liveness.xml index ad87a48807..3a361561be 100644 --- a/examples/msg/mc/deploy_bugged1_liveness.xml +++ b/examples/msg/mc/deploy_bugged1_liveness.xml @@ -2,12 +2,6 @@ - - - - - - - - + + diff --git a/examples/msg/mc/deploy_bugged1_liveness_visited.xml b/examples/msg/mc/deploy_bugged1_liveness_visited.xml index f8e8d9be25..5f2bffa1a2 100644 --- a/examples/msg/mc/deploy_bugged1_liveness_visited.xml +++ b/examples/msg/mc/deploy_bugged1_liveness_visited.xml @@ -2,12 +2,6 @@ - - - - - - - - + + diff --git a/examples/msg/mc/deploy_bugged2.xml b/examples/msg/mc/deploy_bugged2.xml index 56a0e7ec75..6063b5d24c 100644 --- a/examples/msg/mc/deploy_bugged2.xml +++ b/examples/msg/mc/deploy_bugged2.xml @@ -1,13 +1,7 @@ - - - - - - - - - + + + diff --git a/examples/msg/mc/deploy_bugged2_liveness.xml b/examples/msg/mc/deploy_bugged2_liveness.xml index 547229ceca..0388e1903c 100644 --- a/examples/msg/mc/deploy_bugged2_liveness.xml +++ b/examples/msg/mc/deploy_bugged2_liveness.xml @@ -2,12 +2,6 @@ - - - - - - - - + + diff --git a/examples/msg/mc/deploy_bugged3.xml b/examples/msg/mc/deploy_bugged3.xml index 56a0e7ec75..1f004f1847 100644 --- a/examples/msg/mc/deploy_bugged3.xml +++ b/examples/msg/mc/deploy_bugged3.xml @@ -1,13 +1,7 @@ - - - - - - - - - + + + diff --git a/examples/msg/mc/deploy_mutex.xml b/examples/msg/mc/deploy_centralized_mutex.xml similarity index 100% rename from examples/msg/mc/deploy_mutex.xml rename to examples/msg/mc/deploy_centralized_mutex.xml diff --git a/examples/msg/mc/deploy_electric_fence.xml b/examples/msg/mc/deploy_electric_fence.xml index 56a0e7ec75..6063b5d24c 100644 --- a/examples/msg/mc/deploy_electric_fence.xml +++ b/examples/msg/mc/deploy_electric_fence.xml @@ -1,13 +1,7 @@ - - - - - - - - - + + + diff --git a/examples/msg/mc/electric_fence.c b/examples/msg/mc/electric_fence.c index a018c1a97a..f260cd989b 100644 --- a/examples/msg/mc/electric_fence.c +++ b/examples/msg/mc/electric_fence.c @@ -18,10 +18,8 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(electric_fence, "Example to check the soundness of DPOR"); -int server(int argc, char *argv[]); -int client(int argc, char *argv[]); -int server(int argc, char *argv[]) +static int server(int argc, char *argv[]) { msg_task_t task1 = NULL, task2 = NULL; msg_comm_t comm_received1 = NULL, comm_received2 = NULL; @@ -36,32 +34,26 @@ int server(int argc, char *argv[]) return 0; } -int client(int argc, char *argv[]) +static int client(int argc, char *argv[]) { - msg_task_t task = MSG_task_create(argv[1], 0, 10000, NULL); MSG_task_send(task, "mymailbox"); - + XBT_INFO("Sent!"); return 0; } int main(int argc, char *argv[]) { - MSG_init(&argc, argv); MSG_create_environment("platform.xml"); MSG_function_register("server", server); - MSG_function_register("client", client); - MSG_launch_application("deploy_electric_fence.xml"); MSG_main(); - return 0; - } diff --git a/teshsuite/mc/CMakeLists.txt b/teshsuite/mc/CMakeLists.txt index 6a38e8b872..880d9ce399 100644 --- a/teshsuite/mc/CMakeLists.txt +++ b/teshsuite/mc/CMakeLists.txt @@ -5,16 +5,7 @@ add_executable (without_mutex_handling mutex_handling.c) target_link_libraries(without_mutex_handling simgrid) set_target_properties(without_mutex_handling PROPERTIES COMPILE_FLAGS -DDISABLE_THE_MUTEX=1) -set(tesh_files - ${tesh_files} - ${CMAKE_CURRENT_SOURCE_DIR}/with_mutex_handling.tesh - ${CMAKE_CURRENT_SOURCE_DIR}/without_mutex_handling.tesh - PARENT_SCOPE) -set(testsuite_src - ${testsuite_src} - ${CMAKE_CURRENT_SOURCE_DIR}/mutex_handling.c - PARENT_SCOPE) -set(xml_files - ${xml_files} - ${CMAKE_CURRENT_SOURCE_DIR}/mutex_handling.xml - PARENT_SCOPE) +set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/with_mutex_handling.tesh + ${CMAKE_CURRENT_SOURCE_DIR}/without_mutex_handling.tesh PARENT_SCOPE) +set(testsuite_src ${testsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/mutex_handling.c PARENT_SCOPE) +set(xml_files ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/mutex_handling.xml PARENT_SCOPE) diff --git a/teshsuite/mc/dwarf/CMakeLists.txt b/teshsuite/mc/dwarf/CMakeLists.txt index 904cafbf46..6d15d78c39 100644 --- a/teshsuite/mc/dwarf/CMakeLists.txt +++ b/teshsuite/mc/dwarf/CMakeLists.txt @@ -3,11 +3,5 @@ if(HAVE_MC) target_link_libraries(dwarf simgrid) endif() -set(tesh_files - ${tesh_files} - ${CMAKE_CURRENT_SOURCE_DIR}/dwarf.tesh - PARENT_SCOPE) -set(testsuite_src - ${testsuite_src} - ${CMAKE_CURRENT_SOURCE_DIR}/dwarf.cpp - PARENT_SCOPE) +set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/dwarf.tesh PARENT_SCOPE) +set(testsuite_src ${testsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/dwarf.cpp PARENT_SCOPE) diff --git a/teshsuite/mc/dwarf_expression/CMakeLists.txt b/teshsuite/mc/dwarf_expression/CMakeLists.txt index e17889ea4c..5f03c68860 100644 --- a/teshsuite/mc/dwarf_expression/CMakeLists.txt +++ b/teshsuite/mc/dwarf_expression/CMakeLists.txt @@ -3,11 +3,5 @@ if(HAVE_MC) target_link_libraries(dwarf-expression simgrid) endif() -set(tesh_files - ${tesh_files} - ${CMAKE_CURRENT_SOURCE_DIR}/dwarf_expression.tesh - PARENT_SCOPE) -set(testsuite_src - ${testsuite_src} - ${CMAKE_CURRENT_SOURCE_DIR}/dwarf_expression.cpp - PARENT_SCOPE) +set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/dwarf_expression.tesh PARENT_SCOPE) +set(testsuite_src ${testsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/dwarf_expression.cpp PARENT_SCOPE) diff --git a/teshsuite/mc/mutex_handling.c b/teshsuite/mc/mutex_handling.c index e07970b1f6..e13bd2fdc2 100644 --- a/teshsuite/mc/mutex_handling.c +++ b/teshsuite/mc/mutex_handling.c @@ -19,14 +19,11 @@ * and the MC does not find the counter-example. */ -#include #include "simgrid/msg.h" -#include "xbt/log.h" #include "mc/mc.h" #include -XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, - "Messages specific for this msg example"); +XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example"); #define BOX_NAME "box" @@ -68,13 +65,11 @@ int main(int argc, char *argv[]) xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n" "\tExample: %s msg_platform.xml msg_deployment.xml\n", argv[0], argv[0]); - const char *platform_file = argv[1]; - const char *application_file = argv[2]; - MSG_create_environment(platform_file); + MSG_create_environment(argv[1]); MSG_function_register("receiver", receiver); MSG_function_register("sender", sender); - MSG_launch_application(application_file); + MSG_launch_application(argv[2]); #ifndef DISABLE_THE_MUTEX mutex = xbt_mutex_init(); #endif @@ -85,4 +80,4 @@ int main(int argc, char *argv[]) XBT_INFO("Simulation time %g", MSG_get_clock()); return res != MSG_OK; -} \ No newline at end of file +} diff --git a/teshsuite/mc/mutex_handling.xml b/teshsuite/mc/mutex_handling.xml index 7f60f93675..e65634823b 100644 --- a/teshsuite/mc/mutex_handling.xml +++ b/teshsuite/mc/mutex_handling.xml @@ -1,15 +1,7 @@ - - - - - - - - - - + + diff --git a/teshsuite/mc/replay/CMakeLists.txt b/teshsuite/mc/replay/CMakeLists.txt index 9bfb7ad2a3..edec841330 100644 --- a/teshsuite/mc/replay/CMakeLists.txt +++ b/teshsuite/mc/replay/CMakeLists.txt @@ -1,16 +1,7 @@ add_executable (random_bug random_bug.c) target_link_libraries(random_bug simgrid) -set(tesh_files - ${tesh_files} - ${CMAKE_CURRENT_SOURCE_DIR}/random_bug.tesh - ${CMAKE_CURRENT_SOURCE_DIR}/random_bug_replay.tesh - PARENT_SCOPE) -set(testsuite_src - ${testsuite_src} - ${CMAKE_CURRENT_SOURCE_DIR}/random_bug.c - PARENT_SCOPE) -set(xml_files - ${xml_files} - ${CMAKE_CURRENT_SOURCE_DIR}/random_bug.xml - PARENT_SCOPE) +set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/random_bug.tesh + ${CMAKE_CURRENT_SOURCE_DIR}/random_bug_replay.tesh PARENT_SCOPE) +set(testsuite_src ${testsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/random_bug.c PARENT_SCOPE) +set(xml_files ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/random_bug.xml PARENT_SCOPE) diff --git a/teshsuite/mc/replay/random_bug.c b/teshsuite/mc/replay/random_bug.c index fac0e25857..f0967f9430 100644 --- a/teshsuite/mc/replay/random_bug.c +++ b/teshsuite/mc/replay/random_bug.c @@ -4,16 +4,12 @@ /* 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 - -#include #include #include XBT_LOG_NEW_DEFAULT_CATEGORY(random_bug, "Application"); -/** An (fake) application with a bug occuring for some random values - */ +/** An (fake) application with a bug occuring for some random values */ static int app(int argc, char *argv[]) { int x = MC_random(0, 5); diff --git a/teshsuite/simdag/platforms/CMakeLists.txt b/teshsuite/simdag/platforms/CMakeLists.txt index 3a95a0767f..ba75fa2e25 100644 --- a/teshsuite/simdag/platforms/CMakeLists.txt +++ b/teshsuite/simdag/platforms/CMakeLists.txt @@ -1,75 +1,58 @@ -add_executable (basic_parsing_test basic_parsing_test.c) -target_link_libraries(basic_parsing_test simgrid) +foreach(x basic_parsing_test basic_link_test evaluate_parse_time evaluate_get_route_time) + add_executable (${x} ${x}.c) + target_link_libraries(${x} simgrid) + + set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}.c) +endforeach() + add_executable (is_router_test is_router_test.cpp) target_link_libraries(is_router_test simgrid) add_executable (flatifier flatifier.cpp) target_link_libraries(flatifier simgrid) -add_executable (basic_link_test basic_link_test.c) -target_link_libraries(basic_link_test simgrid) -add_executable (evaluate_parse_time Evaluate_parse_time.c) -target_link_libraries(evaluate_parse_time simgrid) -add_executable (evaluate_get_route_time Evaluate_get_route_time.c) -target_link_libraries(evaluate_get_route_time simgrid) -set(tesh_files - ${tesh_files} - ${CMAKE_CURRENT_SOURCE_DIR}/basic_parsing_test_failing.tesh - ${CMAKE_CURRENT_SOURCE_DIR}/basic_parsing_test_sym_full.tesh - ${CMAKE_CURRENT_SOURCE_DIR}/basic_parsing_test.tesh - ${CMAKE_CURRENT_SOURCE_DIR}/basic_parsing_test_bypass.tesh - ${CMAKE_CURRENT_SOURCE_DIR}/basic_link_test.tesh - ${CMAKE_CURRENT_SOURCE_DIR}/flatifier.tesh - ${CMAKE_CURRENT_SOURCE_DIR}/get_full_link.tesh - ${CMAKE_CURRENT_SOURCE_DIR}/bogus_two_hosts_asymetric.tesh - ${CMAKE_CURRENT_SOURCE_DIR}/bogus_missing_gateway.tesh - ${CMAKE_CURRENT_SOURCE_DIR}/bogus_disk_attachment.tesh - PARENT_SCOPE) -set(xml_files - ${xml_files} - ${CMAKE_CURRENT_SOURCE_DIR}/four_hosts_Dijkstra_ns3.xml - ${CMAKE_CURRENT_SOURCE_DIR}/four_hosts_floyd_ns3.xml - ${CMAKE_CURRENT_SOURCE_DIR}/four_hosts_floyd.xml - ${CMAKE_CURRENT_SOURCE_DIR}/two_hosts_multi_hop.xml - ${CMAKE_CURRENT_SOURCE_DIR}/host_attributes.xml - ${CMAKE_CURRENT_SOURCE_DIR}/link_attributes.xml - ${CMAKE_CURRENT_SOURCE_DIR}/one_cluster_file.xml - ${CMAKE_CURRENT_SOURCE_DIR}/one_cluster_multicore.xml - ${CMAKE_CURRENT_SOURCE_DIR}/one_cluster_fullduplex.xml - ${CMAKE_CURRENT_SOURCE_DIR}/one_cluster_router_id.xml - ${CMAKE_CURRENT_SOURCE_DIR}/one_cluster.xml - ${CMAKE_CURRENT_SOURCE_DIR}/platform_include.xml - ${CMAKE_CURRENT_SOURCE_DIR}/properties.xml - ${CMAKE_CURRENT_SOURCE_DIR}/test_of_is_router.xml - ${CMAKE_CURRENT_SOURCE_DIR}/three_hosts_non_symmetric_route.xml - ${CMAKE_CURRENT_SOURCE_DIR}/two_clusters_one_name.xml - ${CMAKE_CURRENT_SOURCE_DIR}/two_clusters_router_id.xml - ${CMAKE_CURRENT_SOURCE_DIR}/two_clusters.xml - ${CMAKE_CURRENT_SOURCE_DIR}/bogus_missing_src_gateway.xml - ${CMAKE_CURRENT_SOURCE_DIR}/bogus_missing_dst_gateway.xml - ${CMAKE_CURRENT_SOURCE_DIR}/bogus_two_hosts_asymetric.xml - ${CMAKE_CURRENT_SOURCE_DIR}/two_hosts_one_link_fullduplex.xml - ${CMAKE_CURRENT_SOURCE_DIR}/two_hosts_one_link_symmetrical.xml - ${CMAKE_CURRENT_SOURCE_DIR}/two_hosts_one_link.xml - ${CMAKE_CURRENT_SOURCE_DIR}/clusterA.xml - ${CMAKE_CURRENT_SOURCE_DIR}/clusterB.xml - ${CMAKE_CURRENT_SOURCE_DIR}/Dijkstra.xml - ${CMAKE_CURRENT_SOURCE_DIR}/bogus_disk_attachment.xml - PARENT_SCOPE) -set(teshsuite_src - ${teshsuite_src} - ${CMAKE_CURRENT_SOURCE_DIR}/basic_parsing_test.c - ${CMAKE_CURRENT_SOURCE_DIR}/basic_link_test.c - ${CMAKE_CURRENT_SOURCE_DIR}/Evaluate_get_route_time.c - ${CMAKE_CURRENT_SOURCE_DIR}/Evaluate_parse_time.c - ${CMAKE_CURRENT_SOURCE_DIR}/flatifier.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/is_router_test.cpp - PARENT_SCOPE) -set(txt_files - ${txt_files} - ${CMAKE_CURRENT_SOURCE_DIR}/carol.fail - ${CMAKE_CURRENT_SOURCE_DIR}/bob.trace - ${CMAKE_CURRENT_SOURCE_DIR}/erin.avail - ${CMAKE_CURRENT_SOURCE_DIR}/link.bw - ${CMAKE_CURRENT_SOURCE_DIR}/link.fail - ${CMAKE_CURRENT_SOURCE_DIR}/link.lat - PARENT_SCOPE) +set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/basic_parsing_test_failing.tesh + ${CMAKE_CURRENT_SOURCE_DIR}/basic_parsing_test_sym_full.tesh + ${CMAKE_CURRENT_SOURCE_DIR}/basic_parsing_test.tesh + ${CMAKE_CURRENT_SOURCE_DIR}/basic_parsing_test_bypass.tesh + ${CMAKE_CURRENT_SOURCE_DIR}/basic_link_test.tesh + ${CMAKE_CURRENT_SOURCE_DIR}/flatifier.tesh + ${CMAKE_CURRENT_SOURCE_DIR}/get_full_link.tesh + ${CMAKE_CURRENT_SOURCE_DIR}/bogus_two_hosts_asymetric.tesh + ${CMAKE_CURRENT_SOURCE_DIR}/bogus_missing_gateway.tesh + ${CMAKE_CURRENT_SOURCE_DIR}/bogus_disk_attachment.tesh PARENT_SCOPE) +set(xml_files ${xml_files} ${CMAKE_CURRENT_SOURCE_DIR}/four_hosts_Dijkstra_ns3.xml + ${CMAKE_CURRENT_SOURCE_DIR}/four_hosts_floyd_ns3.xml + ${CMAKE_CURRENT_SOURCE_DIR}/four_hosts_floyd.xml + ${CMAKE_CURRENT_SOURCE_DIR}/two_hosts_multi_hop.xml + ${CMAKE_CURRENT_SOURCE_DIR}/host_attributes.xml + ${CMAKE_CURRENT_SOURCE_DIR}/link_attributes.xml + ${CMAKE_CURRENT_SOURCE_DIR}/one_cluster_file.xml + ${CMAKE_CURRENT_SOURCE_DIR}/one_cluster_multicore.xml + ${CMAKE_CURRENT_SOURCE_DIR}/one_cluster_fullduplex.xml + ${CMAKE_CURRENT_SOURCE_DIR}/one_cluster_router_id.xml + ${CMAKE_CURRENT_SOURCE_DIR}/one_cluster.xml + ${CMAKE_CURRENT_SOURCE_DIR}/platform_include.xml + ${CMAKE_CURRENT_SOURCE_DIR}/properties.xml + ${CMAKE_CURRENT_SOURCE_DIR}/test_of_is_router.xml + ${CMAKE_CURRENT_SOURCE_DIR}/three_hosts_non_symmetric_route.xml + ${CMAKE_CURRENT_SOURCE_DIR}/two_clusters_one_name.xml + ${CMAKE_CURRENT_SOURCE_DIR}/two_clusters_router_id.xml + ${CMAKE_CURRENT_SOURCE_DIR}/two_clusters.xml + ${CMAKE_CURRENT_SOURCE_DIR}/bogus_missing_src_gateway.xml + ${CMAKE_CURRENT_SOURCE_DIR}/bogus_missing_dst_gateway.xml + ${CMAKE_CURRENT_SOURCE_DIR}/bogus_two_hosts_asymetric.xml + ${CMAKE_CURRENT_SOURCE_DIR}/two_hosts_one_link_fullduplex.xml + ${CMAKE_CURRENT_SOURCE_DIR}/two_hosts_one_link_symmetrical.xml + ${CMAKE_CURRENT_SOURCE_DIR}/two_hosts_one_link.xml + ${CMAKE_CURRENT_SOURCE_DIR}/clusterA.xml + ${CMAKE_CURRENT_SOURCE_DIR}/clusterB.xml + ${CMAKE_CURRENT_SOURCE_DIR}/Dijkstra.xml + ${CMAKE_CURRENT_SOURCE_DIR}/bogus_disk_attachment.xml PARENT_SCOPE) +set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/flatifier.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/is_router_test.cpp PARENT_SCOPE) +set(txt_files ${txt_files} ${CMAKE_CURRENT_SOURCE_DIR}/carol.fail + ${CMAKE_CURRENT_SOURCE_DIR}/bob.trace + ${CMAKE_CURRENT_SOURCE_DIR}/erin.avail + ${CMAKE_CURRENT_SOURCE_DIR}/link.bw + ${CMAKE_CURRENT_SOURCE_DIR}/link.fail + ${CMAKE_CURRENT_SOURCE_DIR}/link.lat PARENT_SCOPE) diff --git a/teshsuite/simdag/platforms/Evaluate_get_route_time.c b/teshsuite/simdag/platforms/evaluate_get_route_time.c similarity index 100% rename from teshsuite/simdag/platforms/Evaluate_get_route_time.c rename to teshsuite/simdag/platforms/evaluate_get_route_time.c diff --git a/teshsuite/simdag/platforms/Evaluate_parse_time.c b/teshsuite/simdag/platforms/evaluate_parse_time.c similarity index 100% rename from teshsuite/simdag/platforms/Evaluate_parse_time.c rename to teshsuite/simdag/platforms/evaluate_parse_time.c -- 2.20.1