Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[tesh] allow to specify the length of the sorting prefix
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 10 Dec 2010 11:26:06 +0000 (11:26 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 10 Dec 2010 11:26:06 +0000 (11:26 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9125 48e7efb5-ca39-0410-a469-dd3cf9ba447f

tools/tesh/README.tesh
tools/tesh/run_context.c
tools/tesh/tesh.c
tools/tesh/tesh.h

index f463dae..08e207d 100644 (file)
@@ -124,7 +124,7 @@ to sort the output back before comparing it.
 
 We expect the simulators to run with that log formating argument:
    -log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n
-Then, tesh sorts string on the 20 first lines only, and is stable when
+Then, tesh sorts string on the 19 first chars only, and is stable when
 line beginings are equal. This should ensure that:
  (1) tesh is effective (no false positive, no false negative)
  (2) scheduling points are separated from each other 
@@ -134,6 +134,11 @@ line beginings are equal. This should ensure that:
      
 This is of course very SimGrid oriented, breaking the generality of
 tesh, but who cares, actually?     
+
+If you want to change the length of the prefix used for the sort,
+simply specify it after the output sort directive, like this:
+
+! output sort 22
  
 ENVIRONMENT
 -----------
index 41af0d5..5b9a9bb 100644 (file)
@@ -342,6 +342,9 @@ void rctx_pushline(const char *filepos, char kind, char *line)
             filepos, rctx->expected_return);
 
     } else if (!strncmp(line, "output sort", strlen("output sort"))) {
+      sort_len = atoi(line + strlen("output sort"));
+      if (sort_len==0)
+        sort_len=SORT_LEN_DEFAULT;
       rctx->output_sort = 1;
       VERB1("[%s] (sort output of next command)", filepos);
 
@@ -650,7 +653,7 @@ static int cmpstringp(const void *p1, const void *p2) {
 
   DEBUG2("Compare strings '%s' and '%s'", s1, s2);
 
-  int res = strncmp(s1, s2, 19);
+  int res = strncmp(s1, s2, sort_len);
   if (res == 0)
     return p1>p2;
   return res;
index f45d0b1..490e8c2 100644 (file)
@@ -20,6 +20,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(tesh, "TEst SHell utility");
 
 /*** Options ***/
 int timeout_value = 5;          /* child timeout value */
+int sort_len = 19;              /* length of the prefix to sort */
 
 const char *testsuite_name;
 static void handle_line(const char *filepos, char *line)
index 8f73c1c..f189375 100644 (file)
@@ -23,6 +23,8 @@ const char *signal_name(unsigned int got, char *expected);
 
 /*** Options ***/
 int timeout_value;              /* child timeout value */
+int sort_len;                   /* length of the prefix to sort */
+#define SORT_LEN_DEFAULT 19
 
 rctx_t rctx;
 const char *testsuite_name;