From 370ea46481063ab8f3a90e3b198d635601b9fea2 Mon Sep 17 00:00:00 2001 From: donassbr Date: Fri, 11 Sep 2009 08:52:43 +0000 Subject: [PATCH] Fix tests. We cannot call surf_solve if there are no actions running and trace files with periodicity > 0. Surf always answer with the next event to finish that will be a trace event. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6664 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- testsuite/surf/surf_usage.c | 4 +++- testsuite/surf/surf_usage2.c | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/testsuite/surf/surf_usage.c b/testsuite/surf/surf_usage.c index 26ca69c0da..9b01300307 100644 --- a/testsuite/surf/surf_usage.c +++ b/testsuite/surf/surf_usage.c @@ -123,7 +123,9 @@ void test(char *platform) action->model_type->action_unref(action); } - } while (surf_solve() >= 0.0); + } while ((xbt_swag_size(surf_network_model->states.running_action_set) || + xbt_swag_size(surf_cpu_model->states.running_action_set)) && + surf_solve() >= 0.0); DEBUG0("Simulation Terminated"); } diff --git a/testsuite/surf/surf_usage2.c b/testsuite/surf/surf_usage2.c index 6f773661d7..876d6dd752 100644 --- a/testsuite/surf/surf_usage2.c +++ b/testsuite/surf/surf_usage2.c @@ -46,6 +46,7 @@ void test(char *platform) surf_action_t actionC = NULL; surf_action_t commAB = NULL; double now = -1.0; + int running; int workstation_id = find_model_description(surf_workstation_model_description, "CLM03"); @@ -81,6 +82,7 @@ void test(char *platform) surf_action_t action = NULL; unsigned int iter; surf_model_t model = NULL; + running = 0; now = surf_get_clock(); DEBUG1("Next Event : %g", now); @@ -97,8 +99,12 @@ void test(char *platform) DEBUG1("\t * Done : %p", action); model->action_unref(action); } + if (xbt_swag_size(model->states.running_action_set)) { + DEBUG1("running %s", model->name); + running = 1; + } } - } while (surf_solve() >= 0.0); + } while (running && surf_solve() >= 0.0); DEBUG0("Simulation Terminated"); -- 2.20.1