Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add an option on tesh to ignore output of code coverage.
[simgrid.git] / tools / tesh / tesh.c
index b8241a4..b4659fc 100644 (file)
 #pragma hdrstop
 #endif
 
+#include "simgrid_config.h" //For getline, keep that include first
+
 #include "tesh.h"
 #include "xbt.h"
-#include "simgrid_config.h" //For getline
 
 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 */
+char *option;
+int coverage = 0;                              /* whether the code coverage is enable */
 
+rctx_t rctx;
 const char *testsuite_name;
+
+xbt_dict_t env;
+
 static void handle_line(const char *filepos, char *line)
 {
   /* Search end */
@@ -226,7 +233,7 @@ int main(int argc, char *argv[])
         exit(1);
       }
       char *eq = strchr(argv[i+1], '=');
-      xbt_assert1(eq,"The argument of --setenv must contain a '=' (got %s instead)",argv[i+1]);
+      xbt_assert(eq,"The argument of --setenv must contain a '=' (got %s instead)",argv[i+1]);
       char *key = bprintf("%.*s", (int) (eq - argv[i+1]), argv[i+1]);
       xbt_dict_set(env, key, xbt_strdup(eq + 1), xbt_free_f);
       XBT_INFO("setting environment variable '%s' to '%s'", key, eq+1);
@@ -249,6 +256,13 @@ int main(int argc, char *argv[])
       argc -= 2;
       i -= 2;
     }
+    else if (!strcmp(argv[i], "--enable-coverage" )){
+       coverage = 1;
+       XBT_INFO("Enable coverage");
+       memmove(argv + i, argv + i + 1, (argc - i - 1) * sizeof(char *));
+       argc -= 1;
+       i -= 1;
+    }
   }
 
   /* Find the description file */