about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-12-01 10:53:56 +0000
committerEric Wong <normalperson@yhbt.net>2013-12-02 04:36:32 +0000
commitce5cce161d504df849a50ee1080db42a66ca8c42 (patch)
treebf9ad52f14b9200dfc5beaf5235497cd3cc24d2d
parent2410738dcf00cda49c9f1d5847289f6a48944c2a (diff)
downloadcmogstored-ce5cce161d504df849a50ee1080db42a66ca8c42.tar.gz
Unfortunately, none of the C-only tests are run with valgrind
(however all of the Ruby ones are).
-rw-r--r--test/queue-idle-1.c1
-rw-r--r--test/trywrite-1.c7
2 files changed, 5 insertions, 3 deletions
diff --git a/test/queue-idle-1.c b/test/queue-idle-1.c
index 3b71923..6dfba51 100644
--- a/test/queue-idle-1.c
+++ b/test/queue-idle-1.c
@@ -58,6 +58,7 @@ static void test_blocking(void)
         printf("  end wait: %d\n", (int)time(NULL));
         assert(1 == read(fds[0], buf, 1) && "read failed");
         assert(buf[0] == 'B' && "didn't read expected 'B'");
+        assert(0 == pthread_join(thr, NULL) && "pthread_join failed");
 
         teardown();
 }
diff --git a/test/trywrite-1.c b/test/trywrite-1.c
index a6bbde5..b833979 100644
--- a/test/trywrite-1.c
+++ b/test/trywrite-1.c
@@ -40,7 +40,7 @@ static void write_wrong(void)
                 close(null);
         }
 
-        {
+        if (0) { /* FIXME: this makes valgrind unhappy */
                 void *x = mog_trysend(fds[0], (void *)1, 3, 0);
 
                 assert(x == MOG_WR_ERROR && "bad addr did not return error");
@@ -55,7 +55,7 @@ static void write_wrong(void)
         }
 
         {
-                char buf[3];
+                char buf[3] = { 0 };
                 void *x = mog_trysend(fds[1], buf, 3, 0);
 
                 assert(x == MOG_WR_ERROR && "bad FD did not return error");
@@ -134,7 +134,7 @@ static void trysend_buffer(void)
         void *x;
         struct mog_wbuf *wbuf = NULL;
         int nread;
-        char buf[5];
+        char buf[5] = { 0 };
         size_t len = sizeof(buf);
 
         socketpair_or_die(fds);
@@ -155,6 +155,7 @@ static void trysend_buffer(void)
         }
 
         assert(wbuf && "wbuf not initialized, how did we break from loop?");
+        free(wbuf); /* for valgrind, we should never actually do this */
 
         /* socket is/was blocked, it should be readable */
         {