From 78f6c2a51afd931fe8663bacdd65189bab329633 Mon Sep 17 00:00:00 2001 From: Christian Heinrich Date: Fri, 6 Feb 2015 10:52:54 +0100 Subject: [PATCH 1/1] Added two C-Lua-Platform tests 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 | 24 +++++++----------------- teshsuite/lua/lua_platforms.tesh | 7 +++++++ tools/cmake/Tests.cmake | 11 +++++++++++ 3 files changed, 25 insertions(+), 17 deletions(-) create mode 100644 teshsuite/lua/lua_platforms.tesh diff --git a/examples/platforms/small_platform.lua b/examples/platforms/small_platform.lua index 4144425e76..e0eb9287fe 100644 --- a/examples/platforms/small_platform.lua +++ b/examples/platforms/small_platform.lua @@ -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"}; @@ -27,8 +31,10 @@ 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"}; @@ -36,31 +42,15 @@ 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 index 0000000000..0a66578442 --- /dev/null +++ b/teshsuite/lua/lua_platforms.tesh @@ -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 diff --git a/tools/cmake/Tests.cmake b/tools/cmake/Tests.cmake index c834c9587b..976e8f289f 100644 --- a/tools/cmake/Tests.cmake +++ b/tools/cmake/Tests.cmake @@ -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 -- 2.20.1