{% for dst in cfg.trace.type.data_stream_types | sort %}
/* Data stream type `{{ dst.name }}` */
stream {
+ {% if cfg.trace.type.features.data_stream_type_id_field_type %}
id = {{ dst.id }};
+ {% endif %}
{{ root_ft('packet.context', dst._pkt_ctx_ft) | indent_tab }}
{% if dst._er_header_ft %}
{{ root_ft('event.header', dst._er_header_ft) | indent_tab }}
{# data stream type's event record types #}
{% for ert in dst.event_record_types | sort %}
event {
+ {% if cfg.trace.type.features.data_stream_type_id_field_type %}
stream_id = {{ dst.id }};
+ {% endif %}
id = {{ ert.id }};
name = "{{ ert.name }}";
{% if ert.log_level %}
--- /dev/null
+# The MIT License (MIT)
+#
+# Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
+# Copyright (c) 2023 Erica Bugden <ebugden@efficios.com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+# Test Purpose
+#
+# This test configuration aims to verify that when the config property
+# 'data-stream-type-id-field-type' is set to false, that the metadata
+# file generated by barectf will not mention the type id (in either the
+# stream type description or in the event type descriptions).
+#
+# This makes sure that two common CTF trace readers (Babeltrace and
+# Trace Compass) will be able to read the traces produced.
+
+%YAML 1.2
+--- !<tag:barectf.org,2020/3/config>
+trace:
+ type:
+ $include:
+ - base.yaml
+ - stdmisc.yaml
+ $features:
+ magic-field-type: false
+ uuid-field-type: false
+ data-stream-type-id-field-type: false
+ data-stream-types:
+ default:
+ $features:
+ packet:
+ total-size-field-type:
+ class: unsigned-integer
+ size: 16
+ content-size-field-type:
+ class: unsigned-integer
+ size: 16
+ beginning-timestamp-field-type: false
+ end-timestamp-field-type: false
+ event-record:
+ type-id-field-type: false
+ timestamp-field-type: false
+ event-record-types:
+ my_event:
+ payload-field-type:
+ class: structure
+ members:
+ - my_field: string
--- /dev/null
+/* CTF 1.8 */
+
+/*
+ * The MIT License (MIT)
+ *
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ *
+ *
+ * For more details, see <https://barectf.org/>.
+ */
+
+trace {
+ major = 1;
+ minor = 8;
+ byte_order = le;
+ packet.header := struct {
+ } align(8);
+};
+
+env {
+ domain = "bare";
+ tracer_name = "barectf";
+};
+
+/* Data stream type `default` */
+stream {
+ packet.context := struct {
+ integer {
+ signed = false;
+ size = 16;
+ align = 8;
+ byte_order = native;
+ base = 10;
+ } packet_size;
+ integer {
+ signed = false;
+ size = 16;
+ align = 8;
+ byte_order = native;
+ base = 10;
+ } content_size;
+ } align(8);
+ event.header := struct {
+ } align(8);
+};
+
+event {
+ id = 0;
+ name = "my_event";
+ fields := struct {
+ string {
+ encoding = UTF8;
+ } my_field;
+ } align(1);
+};
--- /dev/null
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <assert.h>
+
+#include "test-platform.h"
+#include "barectf.h"
+
+int main(void)
+{
+ struct test_platform_ctx * const platform_ctx = test_platform_init(128);
+
+ assert(platform_ctx);
+ barectf_default_trace_my_event(test_platform_barectf_ctx(platform_ctx),
+ "When she was younger, Akko went to a magic show hosted by a witch named Shiny Chariot.");
+ barectf_default_trace_my_event(test_platform_barectf_ctx(platform_ctx),
+ "Akko was so inspired that she dreamed to someday be a cool witch.");
+ test_platform_fini(platform_ctx);
+ return 0;
+}