Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Path relative to xml directory works
authorPaul Bédaride <paul.bedaride@gmail.com>
Tue, 1 Jul 2014 09:28:50 +0000 (11:28 +0200)
committerPaul Bédaride <paul.bedaride@gmail.com>
Tue, 1 Jul 2014 09:28:50 +0000 (11:28 +0200)
examples/msg/sendrecv/platform_sendrecv.xml [deleted file]
examples/platforms/trace/trace_A.txt [moved from teshsuite/surf/trace_A.txt with 100% similarity]
examples/platforms/trace/trace_A_failure.txt [moved from teshsuite/surf/trace_A_failure.txt with 100% similarity]
examples/platforms/trace/trace_B.txt [moved from teshsuite/surf/trace_B.txt with 100% similarity]
examples/platforms/two_hosts_platform_with_availability.xml [moved from teshsuite/surf/platform.xml with 61% similarity]
src/surf/surfxml_parse.c
teshsuite/smpi/pingpong/broken_hostfiles.tesh
teshsuite/surf/surf_usage/surf_usage.tesh
teshsuite/surf/trace_usage/trace_usage.tesh

diff --git a/examples/msg/sendrecv/platform_sendrecv.xml b/examples/msg/sendrecv/platform_sendrecv.xml
deleted file mode 100644 (file)
index 25d1cf3..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version='1.0'?>
- <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
- <platform version="3">
- <AS  id="AS0"  routing="Full">
-   <!-- For using with ping_pong example, very simple platform -->
-   <host id="Inmos" power="98.095Mf"/>
-   <host id="Bellevue" power="76.296Mf"/>
-   <link id="link" bandwidth="1MBps" latency="100ms"/>
-   <route src="Inmos" dst="Bellevue">
-     <link_ctn id="link"/>
-   </route>
- </AS>
- </platform>
similarity index 61%
rename from teshsuite/surf/platform.xml
rename to examples/platforms/two_hosts_platform_with_availability.xml
index b6c18bb..5378b5f 100644 (file)
@@ -2,8 +2,8 @@
  <!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
  <platform version="3">
  <AS  id="AS0"  routing="Full">
-   <host id="Cpu A" power="100Mf" availability_file="trace_A.txt" state_file="trace_A_failure.txt"/>
-   <host id="Cpu B" power="100Mf" availability_file="trace_B.txt"/>
+   <host id="Cpu A" power="100Mf" availability_file="trace/trace_A.txt" state_file="trace/trace_A_failure.txt"/>
+   <host id="Cpu B" power="100Mf" availability_file="trace/trace_B.txt"/>
    <link id="LinkA" bandwidth="10MBps" latency="200ms"/>
    <route src="Cpu A" dst="Cpu B"><link_ctn id="LinkA"/></route>
  </AS>
index d19fdef..98f90f9 100644 (file)
@@ -7,6 +7,7 @@
 #include <errno.h>
 #include <math.h>
 #include <stdarg.h> /* va_arg */
+#include <libgen.h>
 
 #include "xbt/misc.h"
 #include "xbt/log.h"
@@ -1025,6 +1026,8 @@ void surf_parse_open(const char *file)
   if (!surf_parsed_filename_stack)
     surf_parsed_filename_stack = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
   surf_parsed_filename = xbt_strdup(file);
+  char *dir = dirname(surf_parsed_filename);
+  xbt_dynar_push(surf_path, &dir);
 
   surf_file_to_parse = surf_fopen(file, "r");
   xbt_assert((surf_file_to_parse), "Unable to open \"%s\"\n", file);
@@ -1038,6 +1041,11 @@ void surf_parse_close(void)
   xbt_dynar_free(&surf_input_buffer_stack);
   xbt_dynar_free(&surf_file_to_parse_stack);
   xbt_dynar_free(&surf_parsed_filename_stack);
+  if (surf_parsed_filename) {
+    char *dir = NULL;
+    xbt_dynar_pop(surf_path, dir);
+    free(dir);
+  }
 
   free(surf_parsed_filename);
   surf_parsed_filename = NULL;
index 8783040..6e78e34 100644 (file)
@@ -1,8 +1,8 @@
 ! setenv LD_LIBRARY_PATH=../../lib
 ! expect return 1
-$ ${bindir:=.}/../../../bin/smpirun -hostfile empty-hostfile.txt          -platform ../../../examples/msg/small_platform.xml -np 4 ${bindir:=.}/pingpong -q --log=smpi_kernel.thres:warning
+$ ${bindir:=.}/../../../bin/smpirun -hostfile empty-hostfile.txt          -platform ../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/pingpong -q --log=smpi_kernel.thres:warning
 > [smpirun] ** error: the hostfile 'empty-hostfile.txt' is empty. Aborting.
 
 ! expect return 1
-$ ${bindir:=.}/../../../bin/smpirun -hostfile hostfile-does-not-exist.txt -platform ../../../examples/msg/small_platform.xml -np 4 ${bindir:=.}/pingpong -q --log=smpi_kernel.thres:warning
+$ ${bindir:=.}/../../../bin/smpirun -hostfile hostfile-does-not-exist.txt -platform ../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/pingpong -q --log=smpi_kernel.thres:warning
 > [smpirun] ** error: the file 'hostfile-does-not-exist.txt' does not exist. Aborting.
index 5010663..0ee8c57 100644 (file)
@@ -1,11 +1,11 @@
 #! ./tesh
 
-$ $SG_TEST_EXENV ${bindir:=.}/surf_usage platform.xml
+$ $SG_TEST_EXENV ${bindir:=.}/surf_usage ../../examples/platforms/two_hosts_platform_with_availability.xml
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'cpu/model' to 'Cas01'
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'CM02'
 > [0.000000] [surf_config/INFO] Switching workstation model to compound since you changed the network and/or cpu model(s)
 
-$ $SG_TEST_EXENV ${bindir:=.}/surf_usage2  platform.xml
+$ $SG_TEST_EXENV ${bindir:=.}/surf_usage2  ../../examples/platforms/two_hosts_platform_with_availability.xml
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'network/model' to 'CM02'
 > [0.000000] [xbt_cfg/INFO] Configuration change: Set 'cpu/model' to 'Cas01'
 > [0.000000] [surf_config/INFO] Switching workstation model to compound since you changed the network and/or cpu model(s)
index f75d506..4a5fed3 100644 (file)
@@ -1,3 +1,3 @@
 #! ./tesh
 
-$ $SG_TEST_EXENV ${bindir:=.}/trace_usage
+$ $SG_TEST_EXENV ${bindir:=.}/trace_usage --cfg=path:../../examples/platforms/trace/