Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Added two C-Lua-Platform tests
authorChristian Heinrich <christian.heinrich@livando.com>
Fri, 6 Feb 2015 09:52:54 +0000 (10:52 +0100)
committerChristian Heinrich <franz-christian.heinrich@inria.fr>
Thu, 15 Oct 2015 17:17:16 +0000 (19:17 +0200)
These tests are very simple, as they will execute
examples/msg/masterslave/masterslave_arg with
examples/platforms/small_platform.xml and examples/platforms/small_platform.lua
as platform files, respectively.

These tests will only compare the output, which should
be the same.

examples/platforms/small_platform.lua
teshsuite/lua/lua_platforms.tesh [new file with mode: 0644]
tools/cmake/Tests.cmake

index 4144425..e0eb928 100644 (file)
@@ -4,6 +4,10 @@
 -- 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.
 
+
+  -- This platform.lua file is equivalent to small_platform.xml
+  -- So don't change anything in here unless you change the xml file too!
+  --
   require("simgrid")
   simgrid.platf.open();
   simgrid.platf.AS_open{id="AS0",mode="Full"};
   simgrid.platf.link_new{AS="AS0",id=9,bandwidth=7209750,latency=0.001461517};
   simgrid.platf.link_new{AS="AS0",id="loopback",bandwidth=498000000,latency=0.000015,policy="FATPIPE"};
 
+  -- Register loopback links
   for i=1,5,1 do
-    simgrid.platf.route_new{AS="AS0",src=simgrid.host.name(simgrid.host.at(i)),dest=simgrid.host.name(simgrid.host.at(i)),links="loopback"};
+       local hostname = simgrid.host.name(simgrid.host.at(i))
+       simgrid.platf.route_new{AS="AS0",src=hostname,dest=hostname,links="loopback"}
   end
 
   simgrid.platf.route_new{AS="AS0",src="Tremblay",dest="Jupiter",links="9"};
   simgrid.platf.route_new{AS="AS0",src="Tremblay",dest="Ginette",links="4,3,5"};
   simgrid.platf.route_new{AS="AS0",src="Tremblay",dest="Bourassa",links="4,3,2,0,1,6,7"};
 
-  --simgrid.platf.route_new{AS="AS0",src="Jupiter",dest="Tremblay",links="1"};
   simgrid.platf.route_new{AS="AS0",src="Jupiter",dest="Fafard",links="9,4,3,2,0,1,8"};
   simgrid.platf.route_new{AS="AS0",src="Jupiter",dest="Ginette",links="9,4,3,5"};
   simgrid.platf.route_new{AS="AS0",src="Jupiter",dest="Bourassa",links="9,4,3,2,0,1,6,7"};
 
-  --simgrid.platf.route_new{AS="AS0",src="Fafard",dest="Tremblay",links="0,1,2,3,4,8"};
-  --simgrid.platf.route_new{AS="AS0",src="Fafard",dest="Jupiter",links="0,1,2,3,4,8,9"};
   simgrid.platf.route_new{AS="AS0",src="Fafard",dest="Ginette",links="8,1,0,2,5"};
   simgrid.platf.route_new{AS="AS0",src="Fafard",dest="Bourassa",links="8,6,7"};
 
-  --simgrid.platf.route_new{AS="AS0",src="Ginette",dest="Tremblay",links="3,4,5"};
-  --simgrid.platf.route_new{AS="AS0",src="Ginette",dest="Jupiter",links="3,4,5,9"};
-  --simgrid.platf.route_new{AS="AS0",src="Ginette",dest="Fafard",links="0,1,2,5,8"};
   simgrid.platf.route_new{AS="AS0",src="Ginette",dest="Bourassa",links="5,2,0,1,6,7"};
 
-  --simgrid.platf.route_new{AS="AS0",src="Bourassa",dest="Tremblay",links="0,1,3,2,4,6,7"};
-  --simgrid.platf.route_new{AS="AS0",src="Bourassa",dest="Jupiter",links="0,1,2,3,4,6,7,9"};
-  --simgrid.platf.route_new{AS="AS0",src="Bourassa",dest="Fafard",links="6,7,8"};
-  --simgrid.platf.route_new{AS="AS0",src="Bourassa",dest="Ginette",links="0,1,2,5,6,7"};
-
   simgrid.platf.AS_close();
 
   simgrid.platf.close();
-
-  --Save Platform
-  --simgrid.info("start registering platform");
-  --simgrid.msg_register_platform();
-  --simgrid.info("platform registered");
diff --git a/teshsuite/lua/lua_platforms.tesh b/teshsuite/lua/lua_platforms.tesh
new file mode 100644 (file)
index 0000000..0a66578
--- /dev/null
@@ -0,0 +1,7 @@
+$ ${srcdir:=.}/../../examples/msg/masterslave/masterslave_arg ${srcdir:=.}/../../examples/platforms/small_platform.lua 4 5
+> [0.000000] [msg_test/INFO] Got 5 slaves, 4 tasks to process, and 5 hosts
+> [3.095754] [msg_test/INFO] Simulation time 3.09575
+
+$ ${srcdir:=.}/../../examples/msg/masterslave/masterslave_arg ${srcdir:=.}/../../examples/platforms/small_platform.xml 4 5
+> [0.000000] [msg_test/INFO] Got 5 slaves, 4 tasks to process, and 5 hosts
+> [3.095754] [msg_test/INFO] Simulation time 3.09575
index c834c95..976e8f2 100644 (file)
@@ -487,6 +487,10 @@ IF(NOT enable_memcheck)
   ### LUA ###
   # BEGIN TESH TESTS
   IF(HAVE_LUA)
+    # Tests testing simulation from lua, i.e., you execute the simulation
+    # by calling something similar to
+    #
+    # ~$ lua masterslave.lua platform.xml deploy.xml
     ADD_TESH(lua-duplicated-globals              --cd ${CMAKE_HOME_DIRECTORY}/examples/lua/state_cloner duplicated_globals.tesh)
     ADD_TESH(lua-masterslave                     --cd ${CMAKE_HOME_DIRECTORY}/examples/lua/masterslave master_slave.tesh)
     ADD_TESH(lua-mult-matrix                     --cd ${CMAKE_HOME_DIRECTORY}/examples/lua/multi_matrix mult_matrix.tesh)
@@ -501,6 +505,13 @@ IF(NOT enable_memcheck)
     SET_TESTS_PROPERTIES(lua-chord               PROPERTIES ENVIRONMENT "LUA_CPATH=${CMAKE_BINARY_DIR}/examples/lua/?.so")
     SET_TESTS_PROPERTIES(lua-bittorrent          PROPERTIES ENVIRONMENT "LUA_CPATH=${CMAKE_BINARY_DIR}/examples/lua/?.so")
     SET_TESTS_PROPERTIES(lua-kademlia            PROPERTIES ENVIRONMENT "LUA_CPATH=${CMAKE_BINARY_DIR}/examples/lua/?.so")
+
+    # Tests testing simulation from C but using lua for platform files. Executed
+    # like this
+    #
+    # ~$ ./masterslave platform.lua deploy.lua
+    ADD_TESH(lua-platform-masterslave                --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/lua lua_platforms.tesh)
+    SET_TESTS_PROPERTIES(lua-platform-masterslave    PROPERTIES ENVIRONMENT "LUA_CPATH=${CMAKE_BINARY_DIR}/examples/lua/?.so")
   ENDIF()
   # END TESH TESTS