Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make the Catch2-SimGrid integration available to more tests
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Fri, 28 Jan 2022 23:42:38 +0000 (00:42 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Sat, 29 Jan 2022 00:00:24 +0000 (01:00 +0100)
MANIFEST.in
src/include/catch_simgrid.hpp [moved from teshsuite/s4u/activity-lifecycle/activity-lifecycle.hpp with 83% similarity]
teshsuite/catch_simgrid.cpp [moved from teshsuite/s4u/activity-lifecycle/activity-lifecycle.cpp with 97% similarity]
teshsuite/s4u/CMakeLists.txt
teshsuite/s4u/activity-lifecycle/testing_comm.cpp
teshsuite/s4u/activity-lifecycle/testing_comm_direct.cpp
teshsuite/s4u/activity-lifecycle/testing_exec.cpp
teshsuite/s4u/activity-lifecycle/testing_sleep.cpp
teshsuite/s4u/activity-lifecycle/testing_test-wait.cpp

index 7ba1b9a..15d6b34 100644 (file)
@@ -672,6 +672,7 @@ include examples/smpi/trace_call_location/trace_call_location.c
 include examples/smpi/trace_call_location/trace_call_location.tesh
 include examples/smpi/trace_simple/trace_simple.c
 include examples/smpi/trace_simple/trace_simple.tesh
+include src/include/catch_simgrid.hpp
 include teshsuite/java/semaphoregc/SemaphoreGC.java
 include teshsuite/java/semaphoregc/semaphoregc.tesh
 include teshsuite/java/sleephostoff/SleepHostOff.java
@@ -750,8 +751,7 @@ include teshsuite/python/corrupt-stack/corrupt-stack.tesh
 include teshsuite/python/corrupt-stack/corrupt-stack_d.xml
 include teshsuite/python/platform-mix/platform-mix.py
 include teshsuite/python/platform-mix/platform-mix.tesh
-include teshsuite/s4u/activity-lifecycle/activity-lifecycle.cpp
-include teshsuite/s4u/activity-lifecycle/activity-lifecycle.hpp
+include teshsuite/s4u/../catch_simgrid.cpp
 include teshsuite/s4u/activity-lifecycle/activity-lifecycle.tesh
 include teshsuite/s4u/activity-lifecycle/testing_comm.cpp
 include teshsuite/s4u/activity-lifecycle/testing_comm_direct.cpp
similarity index 83%
rename from teshsuite/s4u/activity-lifecycle/activity-lifecycle.hpp
rename to src/include/catch_simgrid.hpp
index 33dc500..ada84da 100644 (file)
@@ -24,8 +24,11 @@ extern void assert_exit(bool exp_success, double duration);
 extern void assert_cleanup();
 
 /* We need an extra actor here, so that it can sleep until the end of each test */
-#define BEGIN_SECTION(descr) SECTION(descr) { simgrid::s4u::Actor::create(descr, all_hosts[0], []()
-#define END_SECTION })
+#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__)
 
similarity index 97%
rename from teshsuite/s4u/activity-lifecycle/activity-lifecycle.cpp
rename to teshsuite/catch_simgrid.cpp
index 5427b09..e0723ee 100644 (file)
@@ -5,7 +5,7 @@
 
 #define CATCH_CONFIG_RUNNER // we supply our own main()
 
-#include "activity-lifecycle.hpp"
+#include "catch_simgrid.hpp"
 
 #include <xbt/config.hpp>
 
@@ -63,7 +63,7 @@ int main(int argc, char* argv[])
   e.load_platform(platf);
 
   int status = 42;
-  all_hosts = e.get_all_hosts();
+  all_hosts  = e.get_all_hosts();
   simgrid::s4u::Actor::create("main_dispatcher", all_hosts[0],
                               [&argc, &argv, &status]() { status = Catch::Session().run(argc, argv); });
 
index 6c75054..bf142a3 100644 (file)
@@ -1,3 +1,9 @@
+# Specify the source files of multi-files tests
+set(activity-lifecycle_sources ../catch_simgrid.cpp)
+foreach(x sleep exec comm comm_direct test-wait)
+  set(activity-lifecycle_sources ${activity-lifecycle_sources} activity-lifecycle/testing_${x}.cpp)
+endforeach()
+
 foreach(x actor actor-autorestart actor-suspend
         activity-lifecycle
         comm-get-sender comm-pt2pt wait-all-for wait-any-for
@@ -10,20 +16,24 @@ foreach(x actor actor-autorestart actor-suspend
         trace-integration
         seal-platform
        vm-live-migration vm-suicide issue71)
-  add_executable       (${x}  EXCLUDE_FROM_ALL ${x}/${x}.cpp)
+
+  if(NOT DEFINED ${x}_sources)
+      set(${x}_sources ${x}/${x}.cpp)
+  endif()
+         
+  add_executable       (${x}  EXCLUDE_FROM_ALL ${${x}_sources})
   target_link_libraries(${x}  simgrid)
   set_target_properties(${x}  PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
   add_dependencies(tests ${x})
 
-  set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.cpp)
-endforeach()
+  foreach(file ${${x}_sources})
+    set(teshsuite_src  ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/${file})
+  endforeach()
 
-# Fix build rules for activity-lifecycle (multi-file)
-foreach(x sleep exec comm comm_direct 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)
+  unset(${x}_sources)
 endforeach()
-set_property(TARGET activity-lifecycle APPEND PROPERTY INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}") # for <catch.hpp>
+set_property(TARGET activity-lifecycle APPEND PROPERTY INCLUDE_DIRECTORIES "${INTERNAL_INCLUDES}") # for <catch.hpp> and catch_simgrid
+
 
 ## Add the tests.
 ## Some need to be run with all factories, some don't need tesh to run
@@ -78,7 +88,7 @@ ADD_TEST(tesh-parser-full-links01    ${CMAKE_BINARY_DIR}/teshsuite/s4u/basic-par
 ADD_TEST(tesh-parser-full-links02    ${CMAKE_BINARY_DIR}/teshsuite/s4u/basic-parsing-test/basic-parsing-test ${CMAKE_HOME_DIRECTORY}/teshsuite/platforms/two_clusters_one_name.xml FULL_LINK)
 ADD_TEST(tesh-parser-one-link-g5k    ${CMAKE_BINARY_DIR}/teshsuite/s4u/basic-parsing-test/basic-parsing-test ${CMAKE_HOME_DIRECTORY}/examples/platforms/g5k.xml ONE_LINK)
 
-set(teshsuite_src ${teshsuite_src}  ${CMAKE_CURRENT_SOURCE_DIR}/activity-lifecycle/activity-lifecycle.hpp PARENT_SCOPE)
+set(teshsuite_src ${teshsuite_src}  ${CMAKE_SOURCE_DIR}/src/include/catch_simgrid.hpp PARENT_SCOPE)
 set(tesh_files    ${tesh_files}     ${CMAKE_CURRENT_SOURCE_DIR}/basic-parsing-test/basic-parsing-test-sym-full.tesh
                                     ${CMAKE_CURRENT_SOURCE_DIR}/basic-parsing-test/basic-parsing-test-bypass.tesh PARENT_SCOPE)
 set(xml_files     ${xml_files}      ${CMAKE_CURRENT_SOURCE_DIR}/activity-lifecycle/testing_platform.xml
index 0973987..44b4900 100644 (file)
@@ -3,7 +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. */
 
-#include "activity-lifecycle.hpp"
+#include "catch_simgrid.hpp"
 #include <array>
 
 static void test_link_off_helper(double delay)
index b6a19e3..c75054f 100644 (file)
@@ -3,7 +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. */
 
-#include "activity-lifecycle.hpp"
+#include "catch_simgrid.hpp"
 
 TEST_CASE("Activity lifecycle: direct communication activities")
 {
index d7712c4..07d5a72 100644 (file)
@@ -3,7 +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. */
 
-#include "activity-lifecycle.hpp"
+#include "catch_simgrid.hpp"
 
 TEST_CASE("Activity lifecycle: exec activities")
 {
index 8920685..8dc8d3a 100644 (file)
@@ -3,7 +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. */
 
-#include "activity-lifecycle.hpp"
+#include "catch_simgrid.hpp"
 
 TEST_CASE("Activity lifecycle: sleep activities")
 {
index 39a9e76..e2a3ab4 100644 (file)
@@ -3,7 +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. */
 
-#include "activity-lifecycle.hpp"
+#include "catch_simgrid.hpp"
 
 //========== Creators: create an async activity