Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : rename cfg flag for state comparison reduction with storage of visite...
[simgrid.git] / examples / msg / mc / test / snapshot_comparison_liveness5.c
1 /* Copyright (c) 2012. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #include <msg/msg.h>
8 #include <simgrid/modelchecker.h>
9 #include "mc/mc.h"
10
11 XBT_LOG_NEW_DEFAULT_CATEGORY(snapshot_comparison_liveness5, "Debug information for snasphot comparison liveness1 test example");
12
13 int test(int argc, char **argv);
14
15 int test(int argc, char **argv){
16
17   MSG_process_sleep(1);
18
19   XBT_INFO("**** Start test ****");
20   XBT_INFO("Increment local variable");
21
22   int j = 0;
23   XBT_INFO("j = %d", j);
24
25   void *snap1 = MC_snapshot();
26
27   MSG_process_sleep(1);
28
29   j = 1;
30   XBT_INFO("j = %d", j);
31  
32   void *snap2 = MC_snapshot();
33
34   MSG_process_sleep(1);
35
36   MC_ignore_stack("snap2", "test");   
37   MC_ignore_stack("snap1", "test");
38
39   XBT_INFO("Test result : %d (0 = state equality, 1 = different states)", MC_compare_snapshots(snap1, snap2));
40   
41   XBT_INFO("**** End test ****");
42
43   return 0;
44 }
45
46 int main(int argc, char **argv){
47   MSG_init(&argc, argv);
48
49   MSG_config("model-check/property","promela");
50
51   MSG_create_environment("snapshot_comparison_platform.xml");
52
53   MSG_function_register("test", test);
54
55   MSG_launch_application("deploy_snapshot_comparison.xml");
56
57   MSG_main();
58
59   return 0;
60 }