X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/0d9e474c1d57238bd00331a98de45b1706fdea14..a34c7eefe83809e36dbb0420eb513504b11fe898:/teshsuite/s4u/activity-lifecycle/testing_test-wait.cpp diff --git a/teshsuite/s4u/activity-lifecycle/testing_test-wait.cpp b/teshsuite/s4u/activity-lifecycle/testing_test-wait.cpp index 76f8135218..e2a3ab4252 100644 --- a/teshsuite/s4u/activity-lifecycle/testing_test-wait.cpp +++ b/teshsuite/s4u/activity-lifecycle/testing_test-wait.cpp @@ -1,9 +1,9 @@ -/* Copyright (c) 2010-2021. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2010-2022. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include "activity-lifecycle.hpp" +#include "catch_simgrid.hpp" //========== Creators: create an async activity @@ -41,7 +41,7 @@ template bool tester_wait(const Activity& acti ret = true; } catch (const simgrid::TimeoutException& e) { XBT_DEBUG("wait_for() timed out (%s)", e.what()); - INFO("wait_for() timeout should expire at expected date: " << timeout); + INFO("wait_for() timeout should expire at expected date: " + std::to_string(timeout)); REQUIRE(simgrid::s4u::Engine::get_clock() == Approx(timeout)); ret = false; } catch (const simgrid::Exception& e) { @@ -62,14 +62,14 @@ template bool tester_wait_any(const Activity& try { std::vector activities = {activity}; XBT_DEBUG("calling wait_any_for(%f)", duration); - int index = Activity::element_type::wait_any_for(&activities, duration); + ssize_t index = Activity::element_type::wait_any_for(activities, duration); if (index == -1) { XBT_DEBUG("wait_any_for() timed out"); INFO("wait_any_for() timeout should expire at expected date: " << timeout); REQUIRE(simgrid::s4u::Engine::get_clock() == Approx(timeout)); ret = false; } else { - XBT_DEBUG("wait_any_for() returned index %d", index); + XBT_DEBUG("wait_any_for() returned index %zd", index); REQUIRE(index == 0); ret = true; } @@ -224,12 +224,16 @@ TEST_CASE("Activity test/wait: using >") XBT_INFO("#####[ launch next test ]#####"); RUN_SECTION("exec: run and wait<0> once", test_trivial>); - // exec: run and wait<0> many + RUN_SECTION("exec: run and wait<0> many", test_basic>); RUN_SECTION("exec: cancel and wait<0>", test_cancel>); - // exec: actor failure and wait<0> / sleep - // exec: host failure and wait<0> / sleep - // exec: actor failure and wait<0> / wait - // exec: host failure and wait<0> / wait + RUN_SECTION("exec: actor failure and wait<0> / sleep", + test_failure_actor, waiter_sleep6>); + RUN_SECTION("exec: host failure and wait<0> / sleep", + test_failure_host, waiter_sleep6>); + RUN_SECTION("exec: actor failure and wait<0> / wait", + test_failure_actor, waiter_wait>); + RUN_SECTION("exec: host failure and wait<0> / wait", + test_failure_host, waiter_wait>); simgrid::s4u::this_actor::sleep_for(10); assert_cleanup(); @@ -240,12 +244,16 @@ TEST_CASE("Activity test/wait: using >") XBT_INFO("#####[ launch next test ]#####"); RUN_SECTION("exec: run and wait<1> once", test_trivial>); - // exec: run and wait<1> many + RUN_SECTION("exec: run and wait<1> many", test_basic>); RUN_SECTION("exec: cancel and wait<1>", test_cancel>); - // exec: actor failure and wait<1> / sleep - // exec: host failure and wait<1> / sleep - // exec: actor failure and wait<1> / wait - // exec: host failure and wait<1> / wait + RUN_SECTION("exec: actor failure and wait<1> / sleep", + test_failure_actor, waiter_sleep6>); + RUN_SECTION("exec: host failure and wait<1> / sleep", + test_failure_host, waiter_sleep6>); + RUN_SECTION("exec: actor failure and wait<1> / wait", + test_failure_actor, waiter_wait>); + RUN_SECTION("exec: host failure and wait<1> / wait", + test_failure_host, waiter_wait>); simgrid::s4u::this_actor::sleep_for(10); assert_cleanup(); @@ -290,35 +298,3 @@ TEST_CASE("Activity test/wait: using >") simgrid::s4u::this_actor::sleep_for(10); assert_cleanup(); } - -// FIXME: The tests grouped here are currently failing. Once fixed, they should be put in the right section above. -// The tests can be activated with run-time parameter '*' or, more specifically '[failing]' -TEST_CASE("Activity test/wait: tests currently failing", "[.][failing]") -{ - XBT_INFO("#####[ launch next failing test ]#####"); - - // with tester_wait<0> - RUN_SECTION("exec: run and wait<0> many", test_basic>); - RUN_SECTION("exec: actor failure and wait<0> / sleep", - test_failure_actor, waiter_sleep6>); - RUN_SECTION("exec: host failure and wait<0> / sleep", - test_failure_host, waiter_sleep6>); - RUN_SECTION("exec: actor failure and wait<0> / wait", - test_failure_actor, waiter_wait>); - RUN_SECTION("exec: host failure and wait<0> / wait", - test_failure_host, waiter_wait>); - - // with tester_wait<1> - RUN_SECTION("exec: run and wait<1> many", test_basic>); - RUN_SECTION("exec: actor failure and wait<1> / sleep", - test_failure_actor, waiter_sleep6>); - RUN_SECTION("exec: host failure and wait<1> / sleep", - test_failure_host, waiter_sleep6>); - RUN_SECTION("exec: actor failure and wait<1> / wait", - test_failure_actor, waiter_wait>); - RUN_SECTION("exec: host failure and wait<1> / wait", - test_failure_host, waiter_wait>); - - simgrid::s4u::this_actor::sleep_for(10); - assert_cleanup(); -}