Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix a god damn race condition: make sure nobody changes the dynar->used value before...
[simgrid.git] / src / xbt / cunit.c
index 010eec3..ab53a53 100644 (file)
@@ -308,12 +308,14 @@ static int xbt_test_suite_run(xbt_test_suite_t suite) {
                                          (test->failed?" FAIL":" PASS"))),
                  test->title, file, line);
          
-         xbt_dynar_foreach(test->logs,it_log,log) {
-           file = (log->file != NULL ? log->file : file);
-           line = (log->line != 0    ? log->line : line);
-           fprintf(stderr, "             %s:%d: %s\n", 
-                   file, line,log->text);
-           
+         if  ( (test->expected_failure && !test->failed) || (!test->expected_failure && test->failed) ) {
+            xbt_dynar_foreach(test->logs,it_log,log) {
+               file = (log->file != NULL ? log->file : file);
+               line = (log->line != 0    ? log->line : line);
+               fprintf(stderr, "             %s:%d: %s\n", 
+                       file, line,log->text);
+               
+            }
          }
        }
        fprintf(stderr, "    Summary: %d of %d tests failed",unit->test_failed, unit->nb_tests);
@@ -492,8 +494,8 @@ static void apply_selection(char *selection) {
        suite->enabled = enabling;
       }
     } else {
-      int it;
-      for (it=0; it< (int)xbt_dynar_length(_xbt_test_suites); it++) {
+      unsigned int it;
+      for (it=0; it< 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 */
@@ -505,9 +507,9 @@ static void apply_selection(char *selection) {
              unit->enabled = enabling;
            }
          } else { /* act on one child only */
-           int it2_unit;
+           unsigned int it2_unit;
            /* search it, first (we won't reuse it for external loop which gets broken) */
-           for (it2_unit=0; it2_unit< (int)xbt_dynar_length(thissuite->units); it2_unit++) {
+           for (it2_unit=0; it2_unit< 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;