X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/892a26c1eb3583570fff6024b49b4915624236ae..1ba8e265192b67c6903d48faeabe9e1d626bcd3d:/teshsuite/simdag/basic6.c diff --git a/teshsuite/simdag/basic6.c b/teshsuite/simdag/basic6.c index d5c3078e63..bd1de6cd5f 100644 --- a/teshsuite/simdag/basic6.c +++ b/teshsuite/simdag/basic6.c @@ -1,6 +1,4 @@ -/* test scheduling 2 tasks at the same time without artificial dependencies */ - -/* Copyright (c) 2007, 2008, 2009, 2010. The SimGrid Team. +/* Copyright (c) 2007-2012, 2014. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -9,15 +7,27 @@ #include #include #include "simdag/simdag.h" +#include "xbt/asserts.h" #include "xbt/log.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(basic6, sd, "SimDag test basic6"); +/* test scheduling 2 tasks at the same time without artificial dependencies */ + +/* Basic SimDag Test 6 + * Scenario: + * - Schedule two parallel tasks concurrently on a P2P platform + * - Hosts computes 1B per second + * Computing power is shared between tasks. + * Simulated time should be: + * 1/(1/2) = 2 seconds + */ int main(int argc, char **argv) { double comm_cost[] = { 0.0, 0.0, 0.0, 0.0 }; double comp_cost[] = { 1.0 }; SD_task_t taskA, taskB; + xbt_dynar_t ret; SD_init(&argc, argv); SD_create_environment(argv[1]); @@ -25,14 +35,20 @@ int main(int argc, char **argv) taskA = SD_task_create("Task A", NULL, 1.0); taskB = SD_task_create("Task B", NULL, 1.0); - SD_task_schedule(taskA, 1, SD_workstation_get_list(), comp_cost, comm_cost, - -1.0); - SD_task_schedule(taskB, 1, SD_workstation_get_list(), comp_cost, comm_cost, - -1.0); + SD_task_schedule(taskA, 1, SD_workstation_get_list(), comp_cost, + comm_cost, -1.0); + SD_task_schedule(taskB, 1, SD_workstation_get_list(), comp_cost, + comm_cost, -1.0); - SD_simulate(-1.0); + ret = SD_simulate(-1.0); + xbt_assert(xbt_dynar_length(ret) == 2, + "I was expecting the terminaison of 2 tasks, but I got %lu instead", + xbt_dynar_length(ret)); + xbt_dynar_free(&ret); + SD_task_destroy(taskA); + SD_task_destroy(taskB); - INFO1("Simulation time: %f", SD_get_clock()); + XBT_INFO("Simulation time: %f", SD_get_clock()); SD_exit(); return 0;