Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add the test of allReduce replay
[simgrid.git] / examples / msg / mc / test / snapshot_comparison3.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_liveness3, "Debug information for snasphot comparison liveness3 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 and free after first snapshot");
21
22   char *toto = NULL;
23
24   void *snap1 = MC_snapshot();
25
26   MSG_process_sleep(1);
27
28   XBT_INFO("First snapshot");
29
30   toto = xbt_malloc(5);
31   XBT_INFO("Toto allocated");
32   xbt_free(toto);
33   toto = NULL;
34   XBT_INFO("Toto free");
35
36   MSG_process_sleep(1);
37
38   void *snap2 = MC_snapshot();
39
40   XBT_INFO("Second snapshot");
41
42   MC_ignore_stack("snap2", "test");   
43   MC_ignore_stack("snap1", "test");
44
45   XBT_INFO("Test result : %d (0 = state equality, 1 = different states)", MC_compare_snapshots(snap1, snap2));
46   
47   XBT_INFO("**** End test ****");
48
49   return 0;
50 }
51
52 int main(int argc, char **argv){
53   MSG_init(&argc, argv);
54   
55   MSG_config("model-check/property","promela");
56
57   MSG_create_environment("snapshot_comparison_platform.xml");
58
59   MSG_function_register("test", test);
60
61   MSG_launch_application("deploy_snapshot_comparison.xml");
62
63   MSG_main();
64
65   return 0;
66 }