Add pass/fail tests for events with undefined stream IDs
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Sat, 11 Apr 2015 00:01:19 +0000 (20:01 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 7 May 2015 20:02:40 +0000 (16:02 -0400)
It's valid to have events not specify a stream ID, but only if:

* There are only unspecified-stream events in the trace, or
* Only stream_id 0 is used in other events.

In this case, all events are considered as being part of stream 0.

If there are other stream IDs defined, then all events should
specify their own.

Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
tests/1.8/regression/metadata/fail/stream-undefined-id/metadata [new file with mode: 0644]
tests/1.8/regression/metadata/pass/stream-undefined-id/metadata [new file with mode: 0644]

diff --git a/tests/1.8/regression/metadata/fail/stream-undefined-id/metadata b/tests/1.8/regression/metadata/fail/stream-undefined-id/metadata
new file mode 100644 (file)
index 0000000..a48700a
--- /dev/null
@@ -0,0 +1,47 @@
+/* CTF 1.8 */
+trace {
+       major = 1;
+       minor = 8;
+       byte_order = le;
+       packet.header := struct {
+               integer { size = 32; align = 8; signed = false; encoding = none; base = decimal; byte_order = le; } stream_id;
+       };
+};
+
+/*
+ * Some events explicitly define stream_id = 0, some define stream_id = 1, and
+ * others don't specify a stream_id at all.
+ * This is not valid: if there are events not specifying a stream, then only
+ * stream_id = 0 is allowed.
+ */
+
+stream {
+       id = 0;
+};
+
+stream {
+       id = 1;
+};
+
+
+event {
+       id = 0;
+       name = "event0";
+};
+
+event {
+       id = 1;
+       name = "event1";
+       stream_id = 0;
+};
+
+event {
+       id = 2;
+       name = "event2";
+       stream_id = 1;
+};
+
+event {
+       id = 3;
+       name = "event3";
+};
diff --git a/tests/1.8/regression/metadata/pass/stream-undefined-id/metadata b/tests/1.8/regression/metadata/pass/stream-undefined-id/metadata
new file mode 100644 (file)
index 0000000..e112d26
--- /dev/null
@@ -0,0 +1,39 @@
+/* CTF 1.8 */
+trace {
+       major = 1;
+       minor = 8;
+       byte_order = le;
+       packet.header := struct {
+               integer { size = 32; align = 8; signed = false; encoding = none; base = decimal; byte_order = le; } stream_id;
+       };
+};
+
+/*
+ * Some events explicitly define stream_id = 0, others don't specify a stream_id
+ * at all. This should be valid, as long as no other stream is defined.
+ */
+
+stream {
+       id = 0;
+};
+
+event {
+       id = 0;
+       name = "event0";
+};
+
+event {
+       id = 1;
+       name = "event1";
+};
+
+event {
+       id = 2;
+       name = "event2";
+       stream_id = 0;
+};
+
+event {
+       id = 3;
+       name = "event3";
+};
This page took 0.024578 seconds and 4 git commands to generate.