Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
e81f3f8a6524ea4d4a8d4dbf10f8e50d4f6d22ec
[simgrid.git] / examples / msg / mc / test / snapshot_comparison_liveness2.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_liveness2, "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("Malloc after first snapshot");
21
22   void *snap1 = MC_snapshot();
23
24   MSG_process_sleep(1);
25
26   char *toto = xbt_malloc(5);
27   XBT_INFO("Toto allocated");
28
29   void *snap2 = MC_snapshot();
30
31   MSG_process_sleep(1);
32
33   int res = MC_compare_snapshots(snap1, snap2);
34
35   XBT_INFO("Test result : %d (0 = state equality, 1 = different states)", res);
36   
37   XBT_INFO("**** End test ****");
38
39   xbt_free(toto);
40
41   return 0;
42 }
43
44 int main(int argc, char **argv){
45   MSG_init(&argc, argv);
46
47   MSG_config("model-check/property","promela");
48
49   MSG_create_environment("snapshot_comparison_platform.xml");
50
51   MSG_function_register("test", test);
52
53   MSG_launch_application("deploy_snapshot_comparison.xml");
54
55   MSG_main();
56
57   return 0;
58 }