Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Off by one access
[simgrid.git] / src / xbt / cunit.c
index 7d584eb..40e8fd7 100644 (file)
@@ -9,7 +9,7 @@
 
 /* This is partially inspirated from the OSSP ts (Test Suite Library)       */
 
-#include "gras_config.h"
+#include "portable.h"
 
 #include "xbt/sysdep.h"    /* vasprintf */
 #include "xbt/cunit.h"
@@ -141,7 +141,7 @@ xbt_test_suite_t xbt_test_suite_new(const char *name, const char *fmt, ...) {
   va_list ap;
 
   if (!_xbt_test_suites) 
-    _xbt_test_suites = xbt_dynar_new(sizeof(xbt_test_suite_t),&xbt_test_suite_free);
+    _xbt_test_suites = xbt_dynar_new(sizeof(xbt_test_suite_t),xbt_test_suite_free);
 
   va_start(ap, fmt);
   vasprintf(&suite->title,fmt, ap);
@@ -245,7 +245,7 @@ static int xbt_test_suite_run(xbt_test_suite_t suite) {
     for (i=1;i<79;i++)
       suite_title[i]='=';
     suite_title[i++]='\n';
-    suite_title[i]='\0';
+    suite_title[79]='\0';
 
     sprintf(suite_title + 40 - (suite_len+4)/2, "[ %s ]", suite->title);
     suite_title[40 + (suite_len+5)/2] = '=';
@@ -435,6 +435,9 @@ static void apply_selection(char *selection) {
   xbt_test_unit_t unit;
   int it_unit;
 
+  char suitename[512];
+  char unitname[512];
+
   if (!selection || selection[0] == '\0')
     return;
 
@@ -458,9 +461,11 @@ static void apply_selection(char *selection) {
       enabling = 0;
       memmove(dir,dir+1,strlen(dir));
     }
+    if (dir[0] == '+') {
+      enabling = 1;
+      memmove(dir,dir+1,strlen(dir));
+    }
 
-
-    char suitename[512],unitname[512];
     p =strchr(dir,':');
     if (p) {
       strcpy(unitname,p+1);