Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : stateless model checking for liveness properties
[simgrid.git] / examples / msg / mc / example_automaton.c
index 67f5f87..a45c3f8 100644 (file)
@@ -2,6 +2,7 @@
 #include "xbt/automatonparse_promela.h"
 #include "example_automaton.h"
 #include "msg/msg.h"
+#include "mc/mc.h"
 
 #include "y.tab.c"
 
@@ -12,22 +13,37 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(example, "Example with automaton");
 extern xbt_automaton_t automaton;
 
 
-int d=1;
+int p=1;
 int r=0;
+int q=1;
 int e=1;
+int d=1;
 
-int predD(){
-  return d;
+
+int predP(){
+  return p;
 }
 
 int predR(){
   return r;
 }
 
+int predQ(){
+  return q;
+}
+
+
+int predD(){
+  return d;
+}
+
+
 int predE(){
   return e;
 }
 
+
+
 int server(int argc, char *argv[])
 {
   m_task_t task = NULL;
@@ -39,10 +55,11 @@ int server(int argc, char *argv[])
     }
     MSG_task_receive(&task, "mymailbox");
     count++;
-    //e++;
-    //e=e%2;
+    //r=(r+1)%2;
+    //XBT_INFO("r (server) = %d", r);
+     
   }
-  //MC_assert(atoi(MSG_task_get_name(task)) == 3);
+  MC_assert_pair_stateless(atoi(MSG_task_get_name(task)) == 3);
 
   XBT_INFO("OK");
   return 0;
@@ -58,6 +75,10 @@ int client(int argc, char *argv[])
   MSG_task_send(task, "mymailbox");
   
   XBT_INFO("Sent!");
+  
+  //r=(r+1)%3;
+  //XBT_INFO("r (client) = %d", r);
+  
   return 0;
 }
 
@@ -67,10 +88,12 @@ int main(int argc, char **argv){
   init();
   yyparse();
   automaton = get_automaton();
-  xbt_propositional_symbol_t ps = xbt_new_propositional_symbol(automaton,"d", &predD); 
-  ps = xbt_new_propositional_symbol(automaton,"e", &predE); 
+  xbt_propositional_symbol_t ps = xbt_new_propositional_symbol(automaton,"p", &predP); 
+  ps = xbt_new_propositional_symbol(automaton,"q", &predQ); 
   ps = xbt_new_propositional_symbol(automaton,"r", &predR); 
-  
+  ps = xbt_new_propositional_symbol(automaton,"e", &predE);
+  ps = xbt_new_propositional_symbol(automaton,"d", &predD);
+      
   //display_automaton();
 
   MSG_global_init(&argc, argv);
@@ -81,9 +104,11 @@ int main(int argc, char **argv){
 
   MSG_function_register("client", client);
 
-  MSG_launch_application("deploy_bugged1.xml");
-
-  MSG_main_with_automaton(automaton);
+  MSG_launch_application("deploy_bugged1.xml"); 
+  
+  //XBT_INFO("r=%d", r);
+  
+  MSG_main_liveness_stateless(automaton);
 
   MSG_clean();