From: Philippe Proulx Date: Thu, 19 Mar 2015 19:09:28 +0000 (-0400) Subject: ir: add tests for duplicate event classes X-Git-Tag: v2.0.0-pre1~1290 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=f60fde631cec36ea5c6ed7c6838d95f8808f4c15 ir: add tests for duplicate event classes Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- diff --git a/tests/lib/test_ctf_writer.c b/tests/lib/test_ctf_writer.c index e6120d22..4d2c468a 100644 --- a/tests/lib/test_ctf_writer.c +++ b/tests/lib/test_ctf_writer.c @@ -1752,6 +1752,22 @@ end: bt_ctf_clock_put(clock); } +void append_existing_event_class(struct bt_ctf_stream_class *stream_class) +{ + struct bt_ctf_event_class *event_class; + + assert(event_class = bt_ctf_event_class_create("Simple Event")); + ok(bt_ctf_stream_class_add_event_class(stream_class, event_class), + "two event classes with the same name cannot cohabit within the same stream class"); + bt_ctf_event_class_put(event_class); + + assert(event_class = bt_ctf_event_class_create("different name, ok")); + assert(!bt_ctf_event_class_set_id(event_class, 11)); + ok(bt_ctf_stream_class_add_event_class(stream_class, event_class), + "two event classes with the same ID cannot cohabit within the same stream class"); + bt_ctf_event_class_put(event_class); +} + int main(int argc, char **argv) { char trace_path[] = "/tmp/ctfwriter_XXXXXX"; @@ -2355,6 +2371,8 @@ int main(int argc, char **argv) append_complex_event(stream_class, stream1, clock); + append_existing_event_class(stream_class); + test_empty_stream(writer); metadata_string = bt_ctf_writer_get_metadata_string(writer);