]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
iostream-multiplex: Check return values in tests
authorAki Tuomi <aki.tuomi@dovecot.fi>
Fri, 6 Oct 2017 05:52:18 +0000 (08:52 +0300)
committerAki Tuomi <aki.tuomi@dovecot.fi>
Tue, 10 Oct 2017 08:41:04 +0000 (11:41 +0300)
src/lib/test-istream-multiplex.c
src/lib/test-multiplex.c
src/lib/test-ostream-multiplex.c

index 7d927dfbf1be60fa22e47559b6876a2d423708ed..f510f3b2bd0e459fed4046601cbc991acb96151e 100644 (file)
@@ -264,7 +264,7 @@ static void test_send_msg(struct ostream *os, uint8_t cid, const char *msg)
                { msg, strlen(msg) },
                { "\n", 1 } /* newline added for i_stream_next_line */
        };
-       o_stream_sendv(os, iov, N_ELEMENTS(iov));
+       o_stream_nsendv(os, iov, N_ELEMENTS(iov));
 }
 
 static void test_istream_multiplex_stream_write(struct ostream *channel)
@@ -309,6 +309,7 @@ static void test_istream_multiplex_stream(void)
        i_stream_unref(&chan0);
        i_stream_unref(&is);
 
+       test_assert(o_stream_nfinish(os) == 0);
        o_stream_unref(&os);
 
        io_loop_destroy(&ioloop);
index d7e1f279d1127895fb630832a762f65dad11f7bd..a4d3a4cfe099ea7aaf2947d3143236ed7715794f 100644 (file)
@@ -37,8 +37,8 @@ static void test_multiplex_channel_write(struct test_channel *channel)
        unsigned char buf[128];
        size_t len = i_rand() % sizeof(buf);
        random_fill(buf, len);
-       o_stream_send(channel->out, buf, len);
-       o_stream_send(channel->out_alt, buf, len);
+       o_stream_nsend(channel->out, buf, len);
+       o_stream_nsend(channel->out_alt, buf, len);
 }
 
 static void test_multiplex_stream_write(struct ostream *channel ATTR_UNUSED)
@@ -106,8 +106,10 @@ static void teardown_channel(struct test_channel *channel)
        io_remove(&channel->io);
        io_remove(&channel->io_alt);
        i_stream_unref(&channel->in);
+       test_assert(o_stream_nfinish(channel->out) == 0);
        o_stream_unref(&channel->out);
        i_stream_unref(&channel->in_alt);
+       test_assert(o_stream_nfinish(channel->out_alt) == 0);
        o_stream_unref(&channel->out_alt);
        i_close_fd(&channel->fds[0]);
        i_close_fd(&channel->fds[1]);
index 0228badd479190f2068388f65e96aa8caeff4f90..29cc8bb1697fdd4aa7c240a8cb75453c12b3e828 100644 (file)
@@ -92,9 +92,9 @@ static void test_ostream_multiplex_stream_write(struct ostream *channel ATTR_UNU
        size_t rounds = 1 + i_rand() % 10;
        for(size_t i = 0; i < rounds; i++) {
                if ((i_rand() % 2) != 0)
-                       o_stream_send_str(chan1, msgs[i_rand() % N_ELEMENTS(msgs)]);
+                       o_stream_nsend_str(chan1, msgs[i_rand() % N_ELEMENTS(msgs)]);
                else
-                       o_stream_send_str(chan0, msgs[i_rand() % N_ELEMENTS(msgs)]);
+                       o_stream_nsend_str(chan0, msgs[i_rand() % N_ELEMENTS(msgs)]);
        }
 }
 
@@ -125,7 +125,9 @@ static void test_ostream_multiplex_stream(void)
        io_remove(&io0);
        io_remove(&io1);
 
+       test_assert(o_stream_nfinish(chan1) == 0);
        o_stream_unref(&chan1);
+       test_assert(o_stream_nfinish(chan0) == 0);
        o_stream_unref(&chan0);
 
        i_stream_unref(&is);