X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5dc6f3c7fb898d0b145d63384f013410fd042a59..e4d3739e981eb46fbfca0ff837c681e26e8a44c6:/src/mc/mc_safety.cpp diff --git a/src/mc/mc_safety.cpp b/src/mc/mc_safety.cpp index d5fd9bacfe..7336489ef4 100644 --- a/src/mc/mc_safety.cpp +++ b/src/mc/mc_safety.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2008-2014. The SimGrid Team. +/* Copyright (c) 2008-2015. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -13,6 +13,7 @@ #include "mc_record.h" #include "mc_smx.h" #include "mc_client.h" +#include "mc_exit.h" #include "xbt/mmalloc/mmprivate.h" @@ -21,6 +22,8 @@ extern "C" { XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_safety, mc, "Logging specific to MC safety verification "); +} + static int is_exploration_stack_state(mc_state_t current_state){ xbt_fifo_item_t item; @@ -35,6 +38,8 @@ static int is_exploration_stack_state(mc_state_t current_state){ return 0; } +static void MC_modelcheck_safety_init(void); + /** * \brief Initialize the DPOR exploration algorithm */ @@ -68,8 +73,10 @@ static void MC_pre_modelcheck_safety() /** \brief Model-check the application using a DFS exploration * with DPOR (Dynamic Partial Order Reductions) */ -static void MC_modelcheck_safety_main(void) +void MC_modelcheck_safety(void) { + MC_modelcheck_safety_init(); + char *req_str = NULL; int value; smx_simcall_t req = NULL; @@ -119,7 +126,7 @@ static void MC_modelcheck_safety_main(void) if(_sg_mc_termination && is_exploration_stack_state(next_state)){ MC_show_non_termination(); - return; + exit(SIMGRID_EXIT_NON_TERMINATION); } if ((visited_state = is_visited_state(next_state)) == NULL) { @@ -179,7 +186,7 @@ static void MC_modelcheck_safety_main(void) /* Check for deadlocks */ if (MC_deadlock_check()) { MC_show_deadlock(NULL); - return; + exit(SIMGRID_EXIT_DEADLOCK); } /* Traverse the stack backwards until a state with a non empty interleave @@ -192,6 +199,9 @@ static void MC_modelcheck_safety_main(void) while ((state = (mc_state_t) xbt_fifo_shift(mc_stack))) { if (mc_reduce_kind == e_mc_reduce_dpor) { req = MC_state_get_internal_request(state); + if (req->call == SIMCALL_MUTEX_LOCK || req->call == SIMCALL_MUTEX_TRYLOCK) + xbt_die("Mutex is currently not supported with DPOR, " + "use --cfg=model-check/reduction:dpor"); const smx_process_t issuer = MC_smx_simcall_get_issuer(req); xbt_fifo_foreach(mc_stack, item, prev_state, mc_state_t) { if (MC_request_depend(req, MC_state_get_internal_request(prev_state))) { @@ -246,12 +256,13 @@ static void MC_modelcheck_safety_main(void) } } } + XBT_INFO("No property violation found."); MC_print_statistics(mc_stats); - return; + exit(SIMGRID_EXIT_SUCCESS); } -void MC_modelcheck_safety(void) +static void MC_modelcheck_safety_init(void) { if(_sg_mc_termination) mc_reduce_kind = e_mc_reduce_none; @@ -276,11 +287,4 @@ void MC_modelcheck_safety(void) /* Save the initial state */ initial_global_state = xbt_new0(s_mc_global_t, 1); initial_global_state->snapshot = MC_take_snapshot(0); - - MC_modelcheck_safety_main(); - - xbt_abort(); - //MC_exit(); -} - }