Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
autogenerated
[simgrid.git] / src / xbt / cunit.c
index 7d584eb..a1718c9 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); 
@@ -488,7 +493,7 @@ static void apply_selection(char *selection) {
       }
     } else {
       int it;
-      for (it=0; it<xbt_dynar_length(_xbt_test_suites); it++) {
+      for (it=0; it< (int)xbt_dynar_length(_xbt_test_suites); it++) {
        xbt_test_suite_t thissuite=xbt_dynar_get_as(_xbt_test_suites,it,xbt_test_suite_t);
        if (!strcmp(suitename,thissuite->name)) {
          /* Do not disable the whole suite when we just want to disable a child */
@@ -502,7 +507,7 @@ static void apply_selection(char *selection) {
          } else { /* act on one child only */
            int it2_unit;
            /* search it, first (we won't reuse it for external loop which gets broken) */
-           for (it2_unit=0; it2_unit<xbt_dynar_length(thissuite->units); it2_unit++) {
+           for (it2_unit=0; it2_unit< (int)xbt_dynar_length(thissuite->units); it2_unit++) {
              xbt_test_unit_t thisunit=xbt_dynar_get_as(thissuite->units,it2_unit,xbt_test_unit_t);
              if (!strcmp(thisunit->name,unitname)) {
                thisunit->enabled = enabling;