X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=tests%2Flib%2Ftest_ctf_writer.c;h=52106f2d6e581044a0dbd230fec9744ffe66044f;hb=fdf80f327cd463eacb1d8a209091733b0cea2073;hp=156e591c7a9e6b46241e356d3d60320be9a961e4;hpb=28362f2bcb7fe869c6bc1b078ceab41483fd69a6;p=babeltrace.git diff --git a/tests/lib/test_ctf_writer.c b/tests/lib/test_ctf_writer.c index 156e591c..52106f2d 100644 --- a/tests/lib/test_ctf_writer.c +++ b/tests/lib/test_ctf_writer.c @@ -1480,6 +1480,43 @@ end: bt_ctf_event_class_put(event_class); } +void test_empty_stream(struct bt_ctf_writer *writer) +{ + int ret = 0; + struct bt_ctf_trace *trace = NULL; + struct bt_ctf_clock *clock = NULL; + struct bt_ctf_stream_class *stream_class = NULL; + struct bt_ctf_stream *stream = NULL; + + trace = bt_ctf_writer_get_trace(writer); + if (!trace) { + diag("Failed to get trace from writer"); + ret = -1; + goto end; + } + + stream_class = bt_ctf_stream_class_create("empty_stream"); + if (!stream_class) { + diag("Failed to create stream class"); + ret = -1; + goto end; + } + + stream = bt_ctf_writer_create_stream(writer, stream_class); + if (!stream) { + diag("Failed to create writer stream"); + ret = -1; + goto end; + } +end: + ok(ret == 0, + "Created a stream class with default attributes and an empty stream"); + bt_ctf_trace_put(trace); + bt_ctf_clock_put(clock); + bt_ctf_stream_put(stream); + bt_ctf_stream_class_put(stream_class); +} + int main(int argc, char **argv) { char trace_path[] = "/tmp/ctfwriter_XXXXXX"; @@ -1915,6 +1952,8 @@ int main(int argc, char **argv) append_complex_event(stream_class, stream1, clock); + test_empty_stream(writer); + metadata_string = bt_ctf_writer_get_metadata_string(writer); ok(metadata_string, "Get metadata string");