From: Arnaud Giersch Date: Tue, 18 Feb 2020 16:00:15 +0000 (+0100) Subject: Merge activity-test-wait into activity-lifecycle. X-Git-Tag: v3.26~949 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/57d7a8d9b050fd49495cf26342136edf7fdc09c1 Merge activity-test-wait into activity-lifecycle. --- diff --git a/.gitignore b/.gitignore index a1774bfc3c..70c6b5fbd0 100644 --- a/.gitignore +++ b/.gitignore @@ -280,7 +280,6 @@ teshsuite/s4u/actor/actor teshsuite/s4u/actor-autorestart/actor-autorestart teshsuite/s4u/actor-migration/actor-migration teshsuite/s4u/activity-lifecycle/activity-lifecycle -teshsuite/s4u/activity-test-wait/activity-test-wait teshsuite/s4u/cloud-interrupt-migration/cloud-interrupt-migration teshsuite/s4u/cloud-sharing/cloud-sharing teshsuite/s4u/comm-pt2pt/comm-pt2pt diff --git a/MANIFEST.in b/MANIFEST.in index 81c0dd83a1..5f49064743 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -713,8 +713,7 @@ include teshsuite/s4u/activity-lifecycle/testing_comm.cpp include teshsuite/s4u/activity-lifecycle/testing_exec.cpp include teshsuite/s4u/activity-lifecycle/testing_platform.xml include teshsuite/s4u/activity-lifecycle/testing_sleep.cpp -include teshsuite/s4u/activity-test-wait/activity-test-wait.cpp -include teshsuite/s4u/activity-test-wait/activity-test-wait.tesh +include teshsuite/s4u/activity-lifecycle/testing_test-wait.cpp include teshsuite/s4u/actor-autorestart/actor-autorestart.cpp include teshsuite/s4u/actor-autorestart/actor-autorestart.tesh include teshsuite/s4u/actor/actor.cpp diff --git a/teshsuite/s4u/CMakeLists.txt b/teshsuite/s4u/CMakeLists.txt index 4cba12cfda..886e7ee478 100644 --- a/teshsuite/s4u/CMakeLists.txt +++ b/teshsuite/s4u/CMakeLists.txt @@ -1,5 +1,5 @@ foreach(x actor actor-autorestart - activity-lifecycle activity-test-wait + activity-lifecycle comm-pt2pt wait-any-for cloud-interrupt-migration cloud-sharing concurrent_rw storage_client_server listen_async pid ) @@ -11,7 +11,7 @@ foreach(x actor actor-autorestart set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.cpp) endforeach() -foreach(x sleep exec comm) +foreach(x sleep exec comm test-wait) target_sources(activity-lifecycle PRIVATE activity-lifecycle/testing_${x}.cpp) set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/activity-lifecycle/testing_${x}.cpp) endforeach() @@ -19,7 +19,7 @@ endforeach() ## Add the tests. ## Some need to be run with all factories, some don't need tesh to run foreach(x actor actor-autorestart - activity-lifecycle activity-test-wait wait-any-for + activity-lifecycle wait-any-for cloud-interrupt-migration concurrent_rw) set(tesh_files ${tesh_files} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.tesh) ADD_TESH_FACTORIES(tesh-s4u-${x} "thread;ucontext;raw;boost" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/s4u/${x} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/s4u/${x} --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms --cd ${CMAKE_BINARY_DIR}/teshsuite/s4u/${x} ${CMAKE_HOME_DIRECTORY}/teshsuite/s4u/${x}/${x}.tesh) diff --git a/teshsuite/s4u/activity-lifecycle/activity-lifecycle.hpp b/teshsuite/s4u/activity-lifecycle/activity-lifecycle.hpp index ff09e2aed4..22f3f407f4 100644 --- a/teshsuite/s4u/activity-lifecycle/activity-lifecycle.hpp +++ b/teshsuite/s4u/activity-lifecycle/activity-lifecycle.hpp @@ -27,4 +27,6 @@ extern void assert_cleanup(); #define BEGIN_SECTION(descr) SECTION(descr) { simgrid::s4u::Actor::create(descr, all_hosts[0], []() #define END_SECTION }) +#define RUN_SECTION(descr, ...) SECTION(descr) { simgrid::s4u::Actor::create(descr, all_hosts[0], __VA_ARGS__); } + #endif // ACTIVITY_LIFECYCLE_HPP diff --git a/teshsuite/s4u/activity-test-wait/activity-test-wait.cpp b/teshsuite/s4u/activity-lifecycle/testing_test-wait.cpp similarity index 76% rename from teshsuite/s4u/activity-test-wait/activity-test-wait.cpp rename to teshsuite/s4u/activity-lifecycle/testing_test-wait.cpp index c6409090e1..40a2cdac84 100644 --- a/teshsuite/s4u/activity-test-wait/activity-test-wait.cpp +++ b/teshsuite/s4u/activity-lifecycle/testing_test-wait.cpp @@ -3,51 +3,7 @@ /* 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. */ -#define CATCH_CONFIG_RUNNER // we supply our own main() - -#include "../../src/include/catch.hpp" - -#include "simgrid/s4u.hpp" -#include - -XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_test, "Messages specific for this s4u example"); - -std::vector all_hosts; - -/* Helper function easing the testing of actor's ending condition */ -static void assert_exit(bool exp_success, double duration) -{ - double expected_time = simgrid::s4u::Engine::get_clock() + duration; - simgrid::s4u::this_actor::on_exit([exp_success, expected_time](bool got_failed) { - INFO("Check exit status. Expected: " << exp_success); - REQUIRE(exp_success == not got_failed); - INFO("Check date at exit. Expected: " << expected_time); - REQUIRE(simgrid::s4u::Engine::get_clock() == Approx(expected_time)); - XBT_VERB("Checks on exit successful"); - }); -} - -/* Helper function in charge of doing some sanity checks after each test */ -static void assert_cleanup() -{ - /* Check that no actor remain (but on host[0], where main_dispatcher lives */ - for (unsigned int i = 0; i < all_hosts.size(); i++) { - std::vector all_actors = all_hosts[i]->get_all_actors(); - unsigned int expected_count = (i == 0) ? 1 : 0; // host[0] contains main_dispatcher, all other are empty - if (all_actors.size() != expected_count) { - INFO("Host " << all_hosts[i]->get_cname() << " contains " << all_actors.size() << " actors but " << expected_count - << " are expected (i=" << i << "). Existing actors: "); - for (auto act : all_actors) - UNSCOPED_INFO(" - " << act->get_cname()); - FAIL("This is wrong"); - } - } - // TODO: Check that all LMM are empty -} - -/** - ** Each tests - **/ +#include "activity-lifecycle.hpp" //========== Creators: create an async activity @@ -198,9 +154,6 @@ template void test_fai //========== -/* We need an extra actor here, so that it can sleep until the end of each test */ -#define RUN_SECTION(descr, ...) SECTION(descr) { simgrid::s4u::Actor::create(descr, all_hosts[0], __VA_ARGS__); } - TEST_CASE("Activity test/wait: using ") { XBT_INFO("#####[ launch next test ]#####"); @@ -276,30 +229,3 @@ TEST_CASE("Activity test/wait: tests currently failing", "[.][failing]") simgrid::s4u::this_actor::sleep_for(10); assert_cleanup(); } - -int main(int argc, char* argv[]) -{ - simgrid::config::set_value("help-nostop", true); - simgrid::s4u::Engine e(&argc, argv); - - std::string platf; - if (argc > 1) { - platf = argv[1]; - argv[1] = argv[0]; - argv++; - argc--; - } else { - XBT_WARN("No platform file provided. Using './testing_platform.xml'"); - platf = "./testing_platform.xml"; - } - e.load_platform(platf); - - int status = 42; - all_hosts = e.get_all_hosts(); - simgrid::s4u::Actor::create("main_dispatcher", all_hosts[0], - [&argc, &argv, &status]() { status = Catch::Session().run(argc, argv); }); - - e.run(); - XBT_INFO("Simulation done"); - return status; -} diff --git a/teshsuite/s4u/activity-test-wait/activity-test-wait.tesh b/teshsuite/s4u/activity-test-wait/activity-test-wait.tesh deleted file mode 100644 index 0952e520c8..0000000000 --- a/teshsuite/s4u/activity-test-wait/activity-test-wait.tesh +++ /dev/null @@ -1,2 +0,0 @@ -! output display -$ ${bindir:=.}/activity-test-wait ${srcdir:=.}/../activity-lifecycle/testing_platform.xml