Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
If the length of the description is more than 76 characters replace it by the name...
[simgrid.git] / tools / tesh2 / src / unit.c
index a3c5f18..afadd9b 100644 (file)
@@ -164,7 +164,7 @@ unit_start(void* p)
                        if(!include->exit_code && !include->interrupted)\r
                                INFO1("Include from %s OK",include->fstream->name);\r
                        else if(include->exit_code)\r
-                               ERROR3("Include `%s' NOK : (<%s> %s)", include->fstream->name, command->context->line, error_to_string(include->exit_code, include->err_kind));\r
+                               ERROR3("Include `%s' NOK : (<%s> %s)", include->fstream->name, include->err_line, error_to_string(include->exit_code, include->err_kind));\r
                        else if(include->interrupted && !include->exit_code)\r
                                INFO1("Include `(%s)' INTR",include->fstream->name);\r
                }\r
@@ -536,13 +536,23 @@ unit_summuarize(unit_t unit)
         return -1;\r
     }\r
        \r
-       if((unit->description) && strlen(unit->description) < 78)\r
+       if((unit->description) && strlen(unit->description) < 76)\r
                strcpy(title, unit->description);\r
        else\r
                sprintf(title, "file : %s",unit->fstream->name);\r
                \r
        if(unit->interrupted)\r
-               strcat(title, " (interrupted)");\r
+       {\r
+               if(strlen(title) + strlen(" (interrupted)") < 76)\r
+                       strcat(title, " (interrupted)");\r
+               else\r
+               {\r
+                       memset(title, 0, PATH_MAX + 1);\r
+                       sprintf(title, "file : %s",unit->fstream->name);\r
+                       strcat(title, " (interrupted)");\r
+\r
+               }\r
+       }\r
                \r
        print_title(title);\r
        \r
@@ -634,7 +644,7 @@ unit_summuarize(unit_t unit)
                                number_of_successeded_tests++;  \r
                }\r
                \r
-               asprintf(&p," Unit: %s ............................................................................", include->description ? include->description : include->fstream->name);\r
+               asprintf(&p," Unit: %s ............................................................................", include->description && strlen(include->description) < 60 ? include->description : include->fstream->name);\r
                        \r
                p[70] = '\0';\r
                printf("%s", p);\r
@@ -732,7 +742,7 @@ unit_summuarize(unit_t unit)
                                        number_of_successeded_tests++;\r
                        }\r
                        \r
-                       asprintf(&p," Unit: %s ............................................................................", include->description ? include->description : include->fstream->name);\r
+                       asprintf(&p," Unit: %s ............................................................................", include->description && strlen(include->description) < 60 ? include->description : include->fstream->name);\r
                        \r
                        p[70] = '\0';\r
                        printf("%s", p);\r