1 /* Copyright (c) 2010-2023. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #ifndef ACTIVITY_LIFECYCLE_HPP
7 #define ACTIVITY_LIFECYCLE_HPP
11 #include <simgrid/s4u.hpp>
16 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(s4u_test);
18 extern std::vector<simgrid::s4u::Host*> all_hosts;
20 /* Helper function easing the testing of actor's ending condition */
21 extern void assert_exit(bool exp_success, double duration);
23 /* Helper function in charge of doing some sanity checks after each test */
24 extern void assert_cleanup();
26 /* We need an extra actor here, so that it can sleep until the end of each test */
27 #define BEGIN_SECTION(descr) \
29 { simgrid::s4u::Actor::create(descr, all_hosts[0], []()
33 #define RUN_SECTION(descr, ...) SECTION(descr) simgrid::s4u::Actor::create(descr, all_hosts[0], __VA_ARGS__)
35 // Normally, we should be able use Catch2's REQUIRE_THROWS_AS(...), but it generates errors with Address Sanitizer.
36 // They're certainly false positive. Nevermind and use this simpler replacement.
37 #define REQUIRE_NETWORK_FAILURE(...) \
41 FAIL("Expected exception NetworkFailureException not caught"); \
42 } catch (simgrid::NetworkFailureException const&) { \
43 XBT_VERB("got expected NetworkFailureException"); \
47 #endif // ACTIVITY_LIFECYCLE_HPP