Fix: test: session list count cannot use "count" unique id
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 17 Jul 2012 23:27:34 +0000 (19:27 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 17 Jul 2012 23:28:24 +0000 (19:28 -0400)
Fixes #305

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
tests/test_sessions.c

index e55593561891d2827ba8cb8761e188e31c1d3e92..c7dd32036655f4203619ebd735ef620d16dad40a 100644 (file)
@@ -97,6 +97,17 @@ static int find_session_name(char *name)
        return -1;
 }
 
+static int session_list_count(void)
+{
+       int count = 0;
+       struct ltt_session *iter;
+
+       cds_list_for_each_entry(iter, &session_list->head, list) {
+               count++;
+       }
+       return count;
+}
+
 /*
  * Empty session list manually.
  */
@@ -106,12 +117,11 @@ static void empty_session_list(void)
 
        cds_list_for_each_entry_safe(iter, tmp, &session_list->head, list) {
                cds_list_del(&iter->list);
-               session_list->count--;
                free(iter);
        }
 
        /* Session list must be 0 */
-       assert(!session_list->count);
+       assert(!session_list_count());
 }
 
 /*
@@ -193,7 +203,7 @@ static int fuzzing_create_args(void)
        }
 
        /* Session list must be 0 */
-       assert(!session_list->count);
+       assert(!session_list_count());
 
        return 0;
 }
@@ -209,7 +219,7 @@ static int fuzzing_destroy_args(void)
        }
 
        /* Session list must be 0 */
-       assert(!session_list->count);
+       assert(!session_list_count());
 
        return 0;
 }
@@ -341,7 +351,7 @@ int main(int argc, char **argv)
        PRINT_OK();
 
        /* Session list must be 0 */
-       assert(!session_list->count);
+       assert(!session_list_count());
 
        /* Success */
        return 0;
This page took 0.026687 seconds and 4 git commands to generate.