tests/tracing/support/test-platform.c: clear buffer at every packet opening
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 10 Sep 2020 19:01:56 +0000 (15:01 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 10 Sep 2020 19:01:56 +0000 (15:01 -0400)
This ensures that there's no garbage data left in the buffer between
packets.

It's not triggering any failure currently because all the tests in
`tests/tracing` produce a single packet.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
tests/tracing/support/test-platform.c

index d060fab26029668f47f204c6206996ade2481a0d..ac9559791a0d63e13b7c6d2794a138cbf69d53b5 100644 (file)
@@ -51,6 +51,8 @@ static void open_packet(void * const data)
 {
        struct test_platform_ctx * const platform_ctx = (void *) data;
 
+       memset(barectf_packet_buf(&platform_ctx->ctx), 0,
+               barectf_packet_buf_size(&platform_ctx->ctx));
        barectf_default_open_packet(&platform_ctx->ctx);
 }
 
@@ -75,7 +77,6 @@ struct test_platform_ctx *test_platform_init(const size_t buf_size)
        assert(platform_ctx);
        buf = malloc(buf_size);
        assert(buf);
-       memset(buf, 0, buf_size);
        platform_ctx->fh = fopen("stream", "wb");
        assert(platform_ctx->fh);
        barectf_init(&platform_ctx->ctx, buf, buf_size, cbs, platform_ctx);
This page took 0.023481 seconds and 4 git commands to generate.