Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Enforce the ns3 timings for the latest version of ns3, and just execute older versions
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Wed, 5 Apr 2023 19:27:39 +0000 (21:27 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Wed, 5 Apr 2023 19:27:39 +0000 (21:27 +0200)
examples/cpp/CMakeLists.txt
examples/cpp/network-ns3/s4u-network-ns3-notime.tesh [new file with mode: 0644]
examples/cpp/network-ns3/s4u-network-ns3-timed.tesh [moved from examples/cpp/network-ns3/s4u-network-ns3.tesh with 95% similarity]

index 777817c..add0eb1 100644 (file)
@@ -116,7 +116,16 @@ if (NOT SIMGRID_HAVE_JSON)
   set(_dag-from-json-simple_disable 1)
 endif()
 
-if(NOT SIMGRID_HAVE_NS3)
+if(SIMGRID_HAVE_NS3)
+  if(NS3_VERSION VERSION_GREATER_EQUAL 3.37)
+    set(_network-ns3_teshfile         ${CMAKE_HOME_DIRECTORY}/examples/cpp/network-ns3/s4u-network-ns3-timed.tesh)
+    set(tesh_files    ${tesh_files}   ${CMAKE_HOME_DIRECTORY}/examples/cpp/network-ns3/s4u-network-ns3-notime.tesh)
+  else()
+    set(_network-ns3_teshfile         ${CMAKE_HOME_DIRECTORY}/examples/cpp/network-ns3/s4u-network-ns3-notime.tesh)
+    set(tesh_files    ${tesh_files}   ${CMAKE_HOME_DIRECTORY}/examples/cpp/network-ns3/s4u-network-ns3-timed.tesh)
+  endif()
+
+else()
   foreach (example network-ns3 network-ns3-wifi)
     set(_${example}_disable 1)
   endforeach()
@@ -154,6 +163,11 @@ foreach (example activity-testany activity-waitany
     set(_${example}_sources ${example}/s4u-${example}.cpp)
   endif()
 
+  # Use default tesh file unless specified otherwise
+  if(NOT DEFINED _${example}_teshfile)
+    set(_${example}_teshfile ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-${example}.tesh)
+  endif()
+
   if(NOT DEFINED _${example}_disable)
     add_executable       (s4u-${example} EXCLUDE_FROM_ALL ${_${example}_sources})
     add_dependencies     (tests s4u-${example})
@@ -173,19 +187,20 @@ foreach (example activity-testany activity-waitany
                                       --setenv platfdir=${CMAKE_HOME_DIRECTORY}/examples/platforms
                                       --setenv srcdir=${CMAKE_CURRENT_SOURCE_DIR}/${example}
                                       --cd ${CMAKE_CURRENT_SOURCE_DIR}/${example}
-                                      ${CMAKE_HOME_DIRECTORY}/examples/cpp/${example}/s4u-${example}.tesh)
+                                      ${_${example}_teshfile})
   else()
     message(STATUS "Example ${example} disabled, thus not compiled.")
     unset(_${example}_disable)
   endif()
 
-  set(tesh_files    ${tesh_files}    ${CMAKE_CURRENT_SOURCE_DIR}/${example}/s4u-${example}.tesh)
+  set(tesh_files    ${tesh_files}    ${_${example}_teshfile})
   foreach(file ${_${example}_sources})
     set(examples_src  ${examples_src} ${CMAKE_CURRENT_SOURCE_DIR}/${file})
   endforeach()
 
   unset(_${example}_factories)
   unset(_${example}_sources)
+  unset(_${example}_teshfile)
 endforeach()
 
 
diff --git a/examples/cpp/network-ns3/s4u-network-ns3-notime.tesh b/examples/cpp/network-ns3/s4u-network-ns3-notime.tesh
new file mode 100644 (file)
index 0000000..3e9b4e4
--- /dev/null
@@ -0,0 +1,66 @@
+#!/usr/bin/env tesh
+
+p In the ns-3 tests, the timings are not shown because the exact values may vary with your ns-3 version.
+p We just want to check that the ns-3 bindings of SimGrid are working correctly, we don't want to thoroughly test ns-3.
+
+p 3hosts 2links
+
+$ ${bindir:=.}/s4u-network-ns3 ${platfdir}/small_platform_one_link_routes.xml ${srcdir}/3hosts_2links_d.xml --cfg=network/model:ns-3 "--log=root.fmt:[%h:%a(%i)]%e[%c/%p]%e%m%n"
+> [:maestro(0)] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'ns-3'
+> [Jupiter:worker(2)] [s4u_test/INFO] FLOW[1] : Receive 100 bytes from Tremblay to Jupiter
+
+p 6hosts 3links
+
+$ ${bindir:=.}/s4u-network-ns3 ${platfdir}/small_platform_one_link_routes.xml ${srcdir}/3links_d.xml --cfg=network/model:ns-3 "--log=root.fmt:[%h:%a(%i)]%e[%c/%p]%e%m%n"
+> [:maestro(0)] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'ns-3'
+> [Jupiter:worker(2)] [s4u_test/INFO] FLOW[1] : Receive 10000 bytes from Tremblay to Jupiter
+> [Ginette:worker(4)] [s4u_test/INFO] FLOW[2] : Receive 10000 bytes from Fafard to Ginette
+> [Lovelace:worker(6)] [s4u_test/INFO] FLOW[3] : Receive 10000 bytes from Bourassa to Lovelace
+
+$ ${bindir:=.}/s4u-network-ns3 ${platfdir}/small_platform_one_link_routes.xml ${srcdir}/3links-timer_d.xml --cfg=network/model:ns-3 "--log=root.fmt:[%h:%a(%i)]%e[%c/%p]%e%m%n"
+> [:maestro(0)] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'ns-3'
+> [Jupiter:worker(2)] [s4u_test/INFO] FLOW[1] : Receive 10000 bytes from Tremblay to Jupiter
+> [Ginette:worker(4)] [s4u_test/INFO] FLOW[2] : Receive 10000 bytes from Fafard to Ginette
+> [Lovelace:worker(6)] [s4u_test/INFO] FLOW[3] : Receive 10000 bytes from Bourassa to Lovelace
+> [Lovelace:worker(7)] [s4u_test/INFO] FLOW[4] : Receive 10000 bytes from Bourassa to Lovelace
+
+p One cluster
+
+$ ${bindir:=.}/s4u-network-ns3 ${platfdir}/cluster_backbone.xml ${srcdir}/one_cluster_d.xml --cfg=network/model:ns-3 "--log=root.fmt:[%h:%a(%i)]%e[%c/%p]%e%m%n"
+> [:maestro(0)] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'ns-3'
+> [node-6.simgrid.org:worker(2)] [s4u_test/INFO] FLOW[1] : Receive 100 bytes from node-2.simgrid.org to node-6.simgrid.org
+
+p Dogbone
+
+! timeout 10
+$ ${bindir:=.}/s4u-network-ns3 ${platfdir}/dogbone.xml ${srcdir}/dogbone_d.xml --cfg=network/model:ns-3 "--log=root.fmt:[%h:%a(%i)]%e[%c/%p]%e%m%n"
+> [:maestro(0)] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'ns-3'
+> [:maestro(0)] [res_ns3/WARNING] Ignoring a route between S1 and C1 of length 3: Only routes of length 1 are considered with ns-3.
+> WARNING: You can ignore this warning if your hosts can still communicate when only considering routes of length 1.
+> WARNING: Remove long routes to avoid this harmless message; subsequent long routes will be silently ignored.
+> [C1:worker(3)] [s4u_test/INFO] FLOW[0] : Receive 10000 bytes from S1 to C1
+> [C2:worker(4)] [s4u_test/INFO] FLOW[1] : Receive 10000 bytes from S2 to C2
+
+p 2hosts 1link
+
+$ ${bindir:=.}/s4u-network-ns3 ${platfdir}/onelink.xml ${srcdir}/onelink_d.xml --cfg=network/model:ns-3 "--log=root.fmt:[%h:%a(%i)]%e[%c/%p]%e%m%n"
+> [:maestro(0)] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'ns-3'
+> [C1:worker(2)] [s4u_test/INFO] FLOW[1] : Receive 10000 bytes from S1 to C1
+
+p Crosstraffic TCP option DISABLED
+$ ${bindir:=.}/s4u-network-ns3 ${platfdir}/crosstraffic.xml ${srcdir}/crosstraffic_d.xml --cfg=network/model:ns-3 --cfg=network/crosstraffic:0 "--log=root.fmt:[%h:%a(%i)]%e[%c/%p]%e%m%n"
+> [:maestro(0)] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'ns-3'
+> [:maestro(0)] [xbt_cfg/INFO] Configuration change: Set 'network/crosstraffic' to '0'
+> [C1:worker(2)] [s4u_test/INFO] FLOW[1] : Receive 10000 bytes from S1 to C1
+> [C1:worker(4)] [s4u_test/INFO] FLOW[2] : Receive 10000 bytes from S1 to C1
+> [C1:worker(6)] [s4u_test/INFO] FLOW[3] : Receive 10000 bytes from S1 to C1
+> [S1:worker(8)] [s4u_test/INFO] FLOW[4] : Receive 10000 bytes from C1 to S1
+
+p Crosstraffic TCP option ENABLED
+$ ${bindir:=.}/s4u-network-ns3 ${platfdir}/crosstraffic.xml ${srcdir}/crosstraffic_d.xml --cfg=network/model:ns-3 --cfg=network/crosstraffic:1 "--log=root.fmt:[%h:%a(%i)]%e[%c/%p]%e%m%n"
+> [:maestro(0)] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'ns-3'
+> [:maestro(0)] [xbt_cfg/INFO] Configuration change: Set 'network/crosstraffic' to '1'
+> [C1:worker(2)] [s4u_test/INFO] FLOW[1] : Receive 10000 bytes from S1 to C1
+> [C1:worker(4)] [s4u_test/INFO] FLOW[2] : Receive 10000 bytes from S1 to C1
+> [C1:worker(6)] [s4u_test/INFO] FLOW[3] : Receive 10000 bytes from S1 to C1
+> [S1:worker(8)] [s4u_test/INFO] FLOW[4] : Receive 10000 bytes from C1 to S1
@@ -1,7 +1,6 @@
 #!/usr/bin/env tesh
 
-p In the ns-3 tests, the timings are not shown because the exact values may vary with your ns-3 version.
-p We just want to check that the ns-3 bindings of SimGrid are working correctly, we don't want to thoroughly test ns-3.
+p In the ns-3 tests, the timings are valid only with the very latest version of ns3 (the exact values may vary with your ns-3 version).
 
 p 3hosts 2links