From dccd4ef2c80ce2257f823d20d31c6bdfa75bf2ea Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Thu, 13 Feb 2014 14:33:48 +0100 Subject: [PATCH] Fix parallel tests for chord. 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 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/msg/chord/chord.c b/examples/msg/chord/chord.c index 8dafba417c..cb89f75856 100644 --- a/examples/msg/chord/chord.c +++ b/examples/msg/chord/chord.c @@ -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); -- 2.20.1