X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e39bbd6388a46a93cf74fe1562e2015060071c24..184f7cbedd7496fb81e192e78f7beae87f942ee5:/src/mc/mc_liveness.c diff --git a/src/mc/mc_liveness.c b/src/mc/mc_liveness.c index 1ad236eabb..e2659351c2 100644 --- a/src/mc/mc_liveness.c +++ b/src/mc/mc_liveness.c @@ -65,7 +65,7 @@ int data_libsimgrid_region_compare(void *d1, void *d2, size_t size){ return distance; } -int snapshot_compare(mc_snapshot_t s1, mc_snapshot_t s2, void* s_heap, void* r_heap){ +int snapshot_compare(mc_snapshot_t s1, mc_snapshot_t s2, void* s_heap){ if(s1->num_reg != s2->num_reg){ @@ -93,7 +93,7 @@ int snapshot_compare(mc_snapshot_t s1, mc_snapshot_t s2, void* s_heap, void* r_h XBT_INFO("Different start addr of heap (s1 = %p, s2 = %p)", s1->regions[i]->start_addr, s2->regions[i]->start_addr); errors++; } - if(mmalloc_compare_heap(s1->regions[i]->data, s2->regions[i]->data, s_heap, r_heap)){ + if(mmalloc_compare_heap(s1->regions[i]->data, s2->regions[i]->data, s_heap)){ XBT_INFO("Different heap (mmalloc_compare)"); errors++; } @@ -174,7 +174,7 @@ int reached(xbt_state_t st){ //XBT_INFO("Rdv points size %d - %d", xbt_dict_length(pair_test->rdv_points), xbt_dict_length(current_rdv_points)); //if(xbt_dict_length(pair_test->rdv_points) == xbt_dict_length(current_rdv_points)){ //if(rdv_points_compare(pair_test->rdv_points, current_rdv_points) == 0){ - if(snapshot_compare(pair_test->system_state, sn, std_heap, raw_heap) == 0){ + if(snapshot_compare(pair_test->system_state, sn, std_heap) == 0){ MC_free_snapshot(sn); xbt_dynar_reset(prop_ato); @@ -573,7 +573,7 @@ int visited(xbt_state_t st, int sc){ if(pair_test->search_cycle == sc) { if(automaton_state_compare(pair_test->automaton_state, st) == 0){ if(propositional_symbols_compare_value(pair_test->prop_ato, prop_ato) == 0){ - if(snapshot_compare(pair_test->system_state, sn, std_heap, raw_heap) == 0){ + if(snapshot_compare(pair_test->system_state, sn, std_heap) == 0){ MC_free_snapshot(sn); xbt_dynar_reset(prop_ato); @@ -1280,3 +1280,31 @@ void MC_ddfs(int search_cycle){ } + + +#ifdef SIMGRID_TEST + +XBT_TEST_SUITE("mc_liveness", "Model checking liveness properties"); +XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(mc_liveness); + +XBT_TEST_UNIT("snapshots_comparison", test_compare_snapshot, "Comparison of snapshots") +{ + + MC_SET_RAW_MEM; + + /* Save first snapshot */ + mc_snapshot_t snapshot1 = xbt_new0(s_mc_snapshot_t, 1); + MC_take_snapshot_liveness(snapshot1); + + /* Save second snapshot */ + mc_snapshot_t snapshot2 = xbt_new0(s_mc_snapshot_t, 1); + MC_take_snapshot_liveness(snapshot2); + + MC_UNSET_RAW_MEM; + + xbt_test_assert(snapshot_compare(snapshot1, snapshot2, std_heap, raw_heap) == 0, "Different consecutive snapshot"); + + +} + +#endif