Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Get the simple log format omit any file location when --log=no_loc is passed
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 18 Aug 2009 14:25:56 +0000 (14:25 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 18 Aug 2009 14:25:56 +0000 (14:25 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6597 48e7efb5-ca39-0410-a469-dd3cf9ba447f

examples/msg/masterslave/masterslave_bypass.tesh
examples/msg/masterslave/masterslave_failure.tesh
src/xbt/log.c
src/xbt/xbt_log_layout_simple.c

index f86a783..6228bd1 100644 (file)
@@ -2,8 +2,8 @@
 p Testing the bypassing of the flexml parser
 
 
-$ $SG_TEST_EXENV masterslave/masterslave_bypass
-> [0.000000] surf/surfxml_parse.c:447: [surf_parse/WARNING] Bypassing the XML parser since surf_parse_open received a NULL pointer. If it is not what you want, go fix your code.
+$ $SG_TEST_EXENV masterslave/masterslave_bypass --log=no_loc 
+> [0.000000] [surf_parse/WARNING] Bypassing the XML parser since surf_parse_open received a NULL pointer. If it is not what you want, go fix your code.
 > [host A:master:(1) 0.000000] [msg_test/INFO] Got 1 slave(s) :
 > [host A:master:(1) 0.000000] [msg_test/INFO]          host B
 > [host A:master:(1) 0.000000] [msg_test/INFO] Got 20 task to process :
index 65e6c78..685fb65 100644 (file)
@@ -2,8 +2,8 @@
 
 p Testing a simple master/slave example application handling failures
 
-$ masterslave/masterslave_failure$EXEEXT ${srcdir:=.}/small_platform_with_failures.xml ${srcdir:=.}/masterslave/deployment_masterslave.xml --cfg:path=${srcdir}
-> [0.000000] simix/smx_process.c:100: [simix_process/WARNING] Cannot launch process 'slave' on failed host 'Fafard'
+$ masterslave/masterslave_failure$EXEEXT --log=no_loc ${srcdir:=.}/small_platform_with_failures.xml ${srcdir:=.}/masterslave/deployment_masterslave.xml --cfg:path=${srcdir}
+> [0.000000] [simix_process/WARNING] Cannot launch process 'slave' on failed host 'Fafard'
 > [Tremblay:master:(1) 0.000000] [msg_test/INFO] Got 5 slave(s) :
 > [Tremblay:master:(1) 0.000000] [msg_test/INFO] Jupiter
 > [Tremblay:master:(1) 0.000000] [msg_test/INFO] Fafard
index f985905..b1f767c 100644 (file)
@@ -25,6 +25,7 @@
 #include "xbt/dynar.h"
 
 XBT_PUBLIC_DATA(int) (*xbt_pid) ();
+int xbt_log_no_loc = 0; /* if set to true (with --log=no_loc), file localization will be omitted (for tesh tests) */
 
 /** \addtogroup XBT_log
  *
@@ -1050,6 +1051,11 @@ void xbt_log_control_set(const char *control_string)
     return;
   DEBUG1("Parse log settings '%s'", control_string);
 
+  /* Special handling of no_loc request, which asks for any file localization to be omitted (for tesh runs) */
+  if (!strcmp(control_string,"no_loc")) {
+    xbt_log_no_loc=1;
+    return;
+  }
   /* some initialization if this is the first time that this get called */
   if (xbt_log_settings == NULL)
     xbt_log_settings = xbt_dynar_new(sizeof(xbt_log_setting_t),
index c42e398..06d796f 100644 (file)
@@ -17,6 +17,7 @@
 #include "portable.h"
 
 extern const char *xbt_log_priority_names[7];
+extern int xbt_log_no_loc;
 
 static double begin_of_time = -1;
 
@@ -39,7 +40,7 @@ static void xbt_log_layout_simple_dynamic(xbt_log_layout_t l,
   p +=
     snprintf(p, 256 - (p - loc_buff), "%f] ",
              gras_os_time() - begin_of_time);
-  if (ev->priority != xbt_log_priority_info)
+  if (ev->priority != xbt_log_priority_info && xbt_log_no_loc==0)
     p +=
       snprintf(p, 256 - (p - loc_buff), "%s:%d: ", ev->fileName,
                ev->lineNum);
@@ -100,7 +101,7 @@ static void xbt_log_layout_simple_doit(xbt_log_layout_t l,
   check_overflow;
 
   /* Display file position if not INFO */
-  if (ev->priority != xbt_log_priority_info)
+  if (ev->priority != xbt_log_priority_info && !xbt_log_no_loc)
     p +=
       snprintf(p, XBT_LOG_BUFF_SIZE - (p - ev->buffer), "%s:%d: ",
                ev->fileName, ev->lineNum);