Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
authorPierre Veyre <pierre.veyre@cc.in2p3.fr>
Thu, 13 Mar 2014 13:51:22 +0000 (14:51 +0100)
committerPierre Veyre <pierre.veyre@cc.in2p3.fr>
Thu, 13 Mar 2014 13:51:22 +0000 (14:51 +0100)
buildtools/Cmake/AddTests.cmake
src/surf/surf_routing.cpp
teshsuite/simdag/platforms/CMakeLists.txt
teshsuite/simdag/platforms/bogus_disk_attachment.tesh [new file with mode: 0644]
teshsuite/simdag/platforms/bogus_disk_attachment.xml [new file with mode: 0644]

index 617731d..e53e83c 100644 (file)
@@ -140,6 +140,7 @@ if(NOT enable_memcheck)
   IF(enable_debug AND NOT enable_memcheck)
     ADD_TEST(tesh-parser-bogus-symmetric     ${TESH_COMMAND} ${TESH_OPTION} --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/simdag/platforms --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/platforms bogus_two_hosts_asymetric.tesh)
     ADD_TEST(tesh-parser-bogus-missing-gw ${TESH_COMMAND} ${TESH_OPTION} --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/simdag/platforms --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/platforms bogus_missing_gateway.tesh)
+    ADD_TEST(tesh-disk-attachment ${TESH_COMMAND} ${TESH_OPTION} --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/simdag/platforms --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/platforms bogus_disk_attachment.tesh)
   ENDIF()
 
   ADD_TEST(tesh-simdag-bypass                   ${TESH_COMMAND} ${TESH_OPTION} --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/simdag/platforms --setenv srcdir=${CMAKE_HOME_DIRECTORY} --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/platforms basic_parsing_test_bypass.tesh)
index 455f3e8..93a3ca0 100644 (file)
 
 #include "simgrid/platf_interface.h"    // platform creation API internal interface
 #include "simgrid/sg_config.h"
+#include "storage_interface.hpp"
 
 #include "surf/surfxml_parse_values.h"
 
+
 /**
  * @ingroup SURF_build_api
  * @brief A library containing all known workstations
@@ -1239,6 +1241,22 @@ static void routing_parse_peer(sg_platf_peer_cbarg_t peer)
 //   }
 // }
 
+static void check_disk_attachment()
+{
+  xbt_lib_cursor_t cursor;
+  char *key;
+  void **data;
+  RoutingEdgePtr host_elm;
+  xbt_lib_foreach(storage_lib, cursor, key, data) {
+    if(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL) != NULL) {
+         StoragePtr storage = static_cast<StoragePtr>(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL));
+         host_elm = sg_routing_edge_by_name_or_null(storage->p_attach);
+         if(!host_elm)
+                 surf_parse_error("Enable to attach storage %s: host %s doesn't exist.", storage->getName(), storage->p_attach);
+    }
+  }
+}
+
 void routing_register_callbacks()
 {
   sg_platf_host_add_cb(parse_S_host);
@@ -1254,6 +1272,7 @@ void routing_register_callbacks()
 
   sg_platf_peer_add_cb(routing_parse_peer);
   sg_platf_postparse_add_cb(routing_parse_postparse);
+  sg_platf_postparse_add_cb(check_disk_attachment);
 
   /* we care about the ASes while parsing the platf. Incredible, isnt it? */
   sg_platf_AS_end_add_cb(routing_AS_end);
index 320a0c1..5fe5c14 100644 (file)
@@ -38,6 +38,7 @@ set(tesh_files
   ${CMAKE_CURRENT_SOURCE_DIR}/get_full_link.tesh
   ${CMAKE_CURRENT_SOURCE_DIR}/bogus_two_hosts_asymetric.tesh
   ${CMAKE_CURRENT_SOURCE_DIR}/bogus_missing_gateway.tesh
+  ${CMAKE_CURRENT_SOURCE_DIR}/bogus_disk_attachment.tesh
   PARENT_SCOPE
   )
 set(xml_files
@@ -88,6 +89,7 @@ set(xml_files
   ${CMAKE_CURRENT_SOURCE_DIR}/clusterA.xml
   ${CMAKE_CURRENT_SOURCE_DIR}/clusterB.xml
   ${CMAKE_CURRENT_SOURCE_DIR}/Dijkstra.xml
+  ${CMAKE_CURRENT_SOURCE_DIR}/bogus_disk_attachment.xml
   PARENT_SCOPE
   )
 set(teshsuite_src
diff --git a/teshsuite/simdag/platforms/bogus_disk_attachment.tesh b/teshsuite/simdag/platforms/bogus_disk_attachment.tesh
new file mode 100644 (file)
index 0000000..534cd7f
--- /dev/null
@@ -0,0 +1,4 @@
+! expect signal SIGABRT
+$ ${bindir:=.}/flatifier bogus_disk_attachment.xml "--log=root.fmt:[%10.6r]%e[%i:%P@%h]%e%m%n"
+> [  0.000000] [0:@] surf_workstation_model_init_ptask_L07
+> [  0.000000] [0:@] Parse error at bogus_disk_attachment.xml:26: Enable to attach storage cdisk: host plouf doesn't exist.
diff --git a/teshsuite/simdag/platforms/bogus_disk_attachment.xml b/teshsuite/simdag/platforms/bogus_disk_attachment.xml
new file mode 100644 (file)
index 0000000..c5ca5dc
--- /dev/null
@@ -0,0 +1,26 @@
+
+<!-- THIS FILE IS INVALID.
+
+It declares a storage attached to a nonexistant host (plouf)
+See bogus_disk_attachment.tesh -->
+
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
+
+<platform version="3">
+       <AS id="AS0" routing="Full">
+               <!-- STORAGE TYPES -->
+               <storage_type id="single_HDD" model="SSD" size="4000">
+                       <model_prop id="Bwrite" value="30000000" /> <!-- 30Mo/s -->
+                       <model_prop id="Bread" value="100000000" /> <!-- 100Mo/s -->
+                       <model_prop id="Bconnection" value="150000000" /> <!-- 150Mo/s -->
+               </storage_type>
+               
+               <storage id="cdisk" typeId="single_HDD"  attach="plouf" />
+
+               <!-- HOSTS -->
+               <host id="client" power="1000000000">
+                       <mount storageId="cdisk" name="/sd1" />
+               </host>
+       </AS>
+</platform>
\ No newline at end of file