[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r10728: Some temporary output to try to figure out where bsd thread (in tor/trunk: . src/or)



Author: nickm
Date: 2007-07-02 17:08:03 -0400 (Mon, 02 Jul 2007)
New Revision: 10728

Modified:
   tor/trunk/
   tor/trunk/src/or/test.c
Log:
 r13604@catbus:  nickm | 2007-07-02 16:58:40 -0400
 Some temporary output to try to figure out where bsd thread unit tests are going wrong



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r13604] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/src/or/test.c
===================================================================
--- tor/trunk/src/or/test.c	2007-07-02 20:17:12 UTC (rev 10727)
+++ tor/trunk/src/or/test.c	2007-07-02 21:08:03 UTC (rev 10728)
@@ -1368,18 +1368,24 @@
 
 static void _thread_test_func(void* _s) ATTR_NORETURN;
 
+static int t1_count = 0;
+static int t2_count = 0;
+
 static void
 _thread_test_func(void* _s)
 {
   char *s = _s;
-  int i;
+  int i, *count;
   tor_mutex_t *m;
   char buf[64];
   char *cp;
-  if (!strcmp(s, "thread 1"))
+  if (!strcmp(s, "thread 1")) {
     m = _thread_test_start1;
-  else
+    count = &t1_count;
+  } else {
     m = _thread_test_start2;
+    count = &t2_count;
+  }
   tor_mutex_acquire(m);
 
   tor_snprintf(buf, sizeof(buf), "%lu", tor_get_thread_id());
@@ -1388,6 +1394,7 @@
   for (i=0; i<100000; ++i) {
     tor_mutex_acquire(_thread_test_mutex);
     strmap_set(_thread_test_strmap, "last to run", cp);
+    ++*count;
     tor_mutex_release(_thread_test_mutex);
   }
   tor_mutex_acquire(_thread_test_mutex);
@@ -1438,6 +1445,7 @@
   tor_mutex_free(_thread_test_mutex);
 
   if (timedout) {
+    printf("\nTimed out: %d %d", t1_count, t2_count);
     test_assert(strmap_get(_thread_test_strmap, "thread 1"));
     test_assert(strmap_get(_thread_test_strmap, "thread 2"));
     test_assert(!timedout);