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:27:34 +0000 (19:27 -0400)
Fixes #305

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

index ce716e8c1a70c85dddda2f3a749be7b65f4b0d82..fc3fbc1ebd98053094050b9694e3d4942a099cbc 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;
 }
@@ -342,7 +352,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.027847 seconds and 5 git commands to generate.