Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix parallel tests for chord.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Thu, 13 Feb 2014 13:33:48 +0000 (14:33 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Thu, 13 Feb 2014 15:30:52 +0000 (16:30 +0100)
Verify that we got the expected answer, by checking ans_data->type.

The expected task may have been destroyed at line 413, and then
recycled at line 594, giving the same pointer.

The problem sometimes happened with parallel tests.

examples/msg/chord/chord.c

index 8dafba4..cb89f75 100644 (file)
@@ -707,7 +707,8 @@ static int remote_find_successor(node_t node, int ask_to, int id)
        //   MC to fail any further under that condition, but this comment is here to as a memorial for this first 
        //   brillant victory of the model-checking in the SimGrid community :)
 
-        if (task_received != task_sent) {
+        if (task_received != task_sent ||
+            ans_data->type != TASK_FIND_SUCCESSOR_ANSWER) {
           // this is not the expected answer
           MSG_comm_destroy(node->comm_receive);
           node->comm_receive = NULL;
@@ -787,7 +788,8 @@ static int remote_get_predecessor(node_t node, int ask_to)
           MC_assert(task_received == task_sent);
           }*/
 
-        if (task_received != task_sent) {
+        if (task_received != task_sent ||
+            ans_data->type != TASK_GET_PREDECESSOR_ANSWER) {
           MSG_comm_destroy(node->comm_receive);
           node->comm_receive = NULL;
           handle_task(node, task_received);