barectf: add support for packet sequence number
authorJon Lamb <jon@auxon.io>
Fri, 4 Mar 2022 15:19:12 +0000 (07:19 -0800)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 8 Mar 2022 12:56:51 +0000 (07:56 -0500)
Adds a new optional packet features object `sequence-number-field-type`,
which generates the metadata field type name `packet_seq_num` when
defined (defaults to false).

Currently this is conditionally maintained in `struct barectf_ctx` as a
`uint32_t` type like `events_discarded`.

In the future this could be improved to use the config type defined by
the stream in `struct barectf_default_ctx` so that the types are
aligned.

[Philippe Proulx: add documentation to Jon's patch.]

Refs: https://github.com/efficios/barectf/pull/24
Closes: https://github.com/efficios/barectf/issues/23
Signed-off-by: Jon Lamb <jon@auxon.io>
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ibfa9e4ab73a7c338e41377aae01d498dee62086b

15 files changed:
barectf/cgen.py
barectf/config.py
barectf/config_parse_v3.py
barectf/schemas/config/3/config-pre-field-type-expansion.yaml
barectf/schemas/config/3/config.yaml
barectf/templates/c/barectf.c.j2
barectf/templates/c/barectf.h.j2
barectf/templates/c/serialize-write-seq-num-statements.j2 [new file with mode: 0644]
docs/modules/how-barectf-works/pages/ctf-primer.adoc
docs/modules/platform/pages/api.adoc
docs/modules/yaml/pages/dst-obj.adoc
tests/tracing/configs/counter-clock/dst-packet-features/seq-num.yaml [new file with mode: 0644]
tests/tracing/expect/counter-clock/dst-packet-features/seq-num.data.expect [new file with mode: 0644]
tests/tracing/expect/counter-clock/dst-packet-features/seq-num.metadata.expect [new file with mode: 0644]
tests/tracing/src/counter-clock/dst-packet-features/seq-num.c [new file with mode: 0644]

index 0bc03208d49013561ba8712d4b71919733c9b749..a523f2f131ee2b7aa68849baea74847ecc453657 100644 (file)
@@ -509,6 +509,7 @@ class _CodeGen:
         self._serialize_write_dst_id_statements_templ = self._create_template('serialize-write-dst-id-statements.j2')
         self._serialize_write_timestamp_statements_templ = self._create_template('serialize-write-timestamp-statements.j2')
         self._serialize_write_packet_size_statements_templ = self._create_template('serialize-write-packet-size-statements.j2')
+        self._serialize_write_seq_num_statements_templ = self._create_template('serialize-write-seq-num-statements.j2')
         self._serialize_write_skip_save_statements_templ = self._create_template('serialize-write-skip-save-statements.j2')
         self._serialize_write_ert_id_statements_templ = self._create_template('serialize-write-ert-id-statements.j2')
         self._size_align_statements_templ = self._create_template('size-align-statements.j2')
@@ -644,6 +645,7 @@ class _CodeGen:
             'packet_size',
             'content_size',
             'events_discarded',
+            'packet_seq_num',
         }
         parts.append(self._proto_params_str(dst._pkt_ctx_ft, _RootFtPrefixes.PC, const_params,
                                             exclude_set))
@@ -724,6 +726,7 @@ class _CodeGen:
                     'timestamp_end': self._serialize_write_skip_save_statements_templ,
                     'events_discarded': self._serialize_write_skip_save_statements_templ,
                     'content_size': self._serialize_write_skip_save_statements_templ,
+                    'packet_seq_num': self._serialize_write_seq_num_statements_templ,
                 }
                 pkt_ctx_op = builder.build_for_root_ft(dst._pkt_ctx_ft, _RootFtPrefixes.PC,
                                                        spec_serialize_write_templates)
index 7f454a164892d11909865cd5dc6a98ae498d1012..20849ad184b4ee42659600f56656422f6d940586 100644 (file)
@@ -442,7 +442,8 @@ class DataStreamTypePacketFeatures:
                  content_size_field_type: _DefaultableUIntFt = DEFAULT_FIELD_TYPE,
                  beginning_timestamp_field_type: _OptDefaultableUIntFt = None,
                  end_timestamp_field_type: _OptDefaultableUIntFt = None,
-                 discarded_event_records_snapshot_counter_field_type: _OptDefaultableUIntFt = DEFAULT_FIELD_TYPE):
+                 discarded_event_records_snapshot_counter_field_type: _OptDefaultableUIntFt = DEFAULT_FIELD_TYPE,
+                 sequence_number_field_type: _OptDefaultableUIntFt = None):
         def get_ft(user_ft: _OptDefaultableUIntFt) -> _OptUIntFt:
             if user_ft == DEFAULT_FIELD_TYPE:
                 return UnsignedIntegerFieldType(64)
@@ -454,6 +455,11 @@ class DataStreamTypePacketFeatures:
         self._beginning_timestamp_field_type = get_ft(beginning_timestamp_field_type)
         self._end_timestamp_field_type = get_ft(end_timestamp_field_type)
         self._discarded_event_records_snapshot_counter_field_type = get_ft(discarded_event_records_snapshot_counter_field_type)
+        self._sequence_number_field_type = get_ft(sequence_number_field_type)
+
+    @property
+    def sequence_number_field_type(self) -> _OptUIntFt:
+        return self._sequence_number_field_type
 
     @property
     def total_size_field_type(self) -> _OptUIntFt:
@@ -602,6 +608,8 @@ class DataStreamType(_UniqueByName):
                              True)
         add_member_if_exists('events_discarded',
                              self._features.packet_features.discarded_event_records_snapshot_counter_field_type)
+        add_member_if_exists('packet_seq_num',
+                             self._features.packet_features.sequence_number_field_type)
 
         if self._packet_context_field_type_extra_members is not None:
             for name, field_type in self._packet_context_field_type_extra_members.items():
index 5fe35ecd89b64da94a0a49785f1249842b5cd9d3..346b9ca467db25b376652286cd347d6c80c53c69 100644 (file)
@@ -438,6 +438,7 @@ class _Parser(barectf_config_parse_common._Parser):
             pkt_disc_er_counter_snap_ft = barectf_config.DEFAULT_FIELD_TYPE
             ert_id_ft = barectf_config.DEFAULT_FIELD_TYPE
             ert_ts_ft = None
+            pkt_seq_num_ft = None
 
             if def_clk_type is not None:
                 # The data stream type has a default clock type.
@@ -472,6 +473,8 @@ class _Parser(barectf_config_parse_common._Parser):
                     pkt_disc_er_counter_snap_ft = self._feature_ft(pkt_node,
                                                                    'discarded-event-records-counter-snapshot-field-type',
                                                                    pkt_disc_er_counter_snap_ft)
+                    pkt_seq_num_ft = self._feature_ft(pkt_node, 'sequence-number-field-type',
+                                                      pkt_seq_num_ft)
 
                 # create event record feature field types
                 er_node = features_node.get('event-record')
@@ -503,7 +506,8 @@ class _Parser(barectf_config_parse_common._Parser):
                                                                        pkt_content_size_ft,
                                                                        pkt_beginning_ts_ft,
                                                                        pkt_end_ts_ft,
-                                                                       pkt_disc_er_counter_snap_ft)
+                                                                       pkt_disc_er_counter_snap_ft,
+                                                                       pkt_seq_num_ft)
             er_features = barectf_config.DataStreamTypeEventRecordFeatures(ert_id_ft, ert_ts_ft)
             features = barectf_config.DataStreamTypeFeatures(pkt_features, er_features)
 
@@ -811,6 +815,7 @@ class _Parser(barectf_config_parse_common._Parser):
                                 resolve_ft_alias_from(pkt_node, 'end-timestamp-field-type')
                                 resolve_ft_alias_from(pkt_node,
                                                       'discarded-event-records-counter-snapshot-field-type')
+                                resolve_ft_alias_from(pkt_node, 'sequence-number-field-type')
                             except _ConfigurationParseError as exc:
                                 _append_error_ctx(exc, f'`{pkt_prop_name}` property')
 
@@ -889,6 +894,7 @@ class _Parser(barectf_config_parse_common._Parser):
                     apply_ft_inheritance(pkt_node, 'end-timestamp-field-type')
                     apply_ft_inheritance(pkt_node,
                                          'discarded-event-records-counter-snapshot-field-type')
+                    apply_ft_inheritance(pkt_node, 'sequence-number-field-type')
 
                 er_node = features_node.get('event-record')
 
@@ -978,6 +984,7 @@ class _Parser(barectf_config_parse_common._Parser):
                     normalize_struct_ft_member_nodes(pkt_node, 'end-timestamp-field-type')
                     normalize_struct_ft_member_nodes(pkt_node,
                                                      'discarded-event-records-counter-snapshot-field-type')
+                    normalize_struct_ft_member_nodes(pkt_node, 'sequence-number-field-type')
 
                 er_node = features_node.get('event-record')
 
index 2caf07ff30f7298a0e60c814640bdfa730e89082..66b823b5e474e72f136d3b979bb4442e36d7a14d 100644 (file)
@@ -132,6 +132,8 @@ properties:
                                 $ref: '#/definitions/partial-ft'
                               discarded-event-records-counter-snapshot-field-type:
                                 $ref: '#/definitions/partial-ft'
+                              sequence-number-field-type:
+                                $ref: '#/definitions/partial-ft'
                           else:
                             type: 'null'
                         event-record:
index 5dcb4618a8213bb5539f2a64216707e76c2037e1..76027c853359691a7df368584fc904966a1bcd3a 100644 (file)
@@ -209,6 +209,8 @@ definitions:
                     $ref: '#/definitions/opt-or-def-feature-uint-ft'
                   discarded-event-records-counter-snapshot-field-type:
                     $ref: '#/definitions/opt-or-def-feature-uint-ft'
+                  sequence-number-field-type:
+                    $ref: '#/definitions/opt-or-def-feature-uint-ft'
                 additionalProperties: false
               else:
                 type: 'null'
index 6086a74de5fff73981b5dfe8c0d84c78389d3b22..12e14e8584014f6c9b0fc7b3b3fab7b65d089442 100644 (file)
@@ -95,6 +95,11 @@ uint32_t {{ prefix }}discarded_event_records_count(const void * const vctx)
        return {{ prefix }}packet_events_discarded(vctx);
 }
 
+uint32_t {{ prefix }}packet_sequence_number(const void * const vctx)
+{
+       return _FROM_VOID_PTR(const struct {{ ctx_struct_name }}, vctx)->sequence_number;
+}
+
 uint8_t *{{ prefix }}packet_buf(const void * const vctx)
 {
        return _FROM_VOID_PTR(const struct {{ ctx_struct_name }}, vctx)->buf;
@@ -239,6 +244,7 @@ void _commit_er(void * const vctx)
        ctx->packet_size = _BYTES_TO_BITS(buf_size);
        ctx->at = 0;
        ctx->events_discarded = 0;
+       ctx->sequence_number = 0;
        ctx->packet_is_open = 0;
        ctx->in_tracing_section = 0;
        ctx->is_tracing_enabled = 1;
@@ -386,6 +392,10 @@ end:
 
        /* Mark packet as closed */
        ctx->packet_is_open = 0;
+       {% if 'packet_seq_num' in dst._pkt_ctx_ft.members %}
+       /* Increment sequence number for next packet */
+       ctx->sequence_number++;
+       {% endif %}
 
        /* Not tracing anymore */
        ctx->in_tracing_section = saved_in_tracing_section;
index ca9ae398e5507c7ebfc2974e2b286088c773f9c7..53e20011fed5aa3ead8a431b10b76f18107c1f03 100644 (file)
@@ -69,6 +69,7 @@ int {{ prefix }}packet_is_full(const void *vctx);
 int {{ prefix }}packet_is_empty(const void *vctx);
 uint32_t {{ prefix }}packet_events_discarded(const void *vctx);
 uint32_t {{ prefix }}discarded_event_records_count(const void * const vctx);
+uint32_t {{ prefix }}packet_sequence_number(const void * const vctx);
 uint8_t *{{ prefix }}packet_buf(const void *vctx);
 uint8_t *{{ prefix }}packet_buf_addr(const void * const vctx);
 void {{ prefix }}packet_set_buf(void *vctx, uint8_t *buf, uint32_t buf_size);
@@ -125,6 +126,9 @@ struct {{ prefix }}ctx {
        /* Discarded event records counter snapshot */
        uint32_t events_discarded;
 
+       /* Packet's sequence number */
+       uint32_t sequence_number;
+
        /* Current packet is open? */
        int packet_is_open;
 
diff --git a/barectf/templates/c/serialize-write-seq-num-statements.j2 b/barectf/templates/c/serialize-write-seq-num-statements.j2
new file mode 100644 (file)
index 0000000..1fa63bc
--- /dev/null
@@ -0,0 +1,28 @@
+{#
+ # The MIT License (MIT)
+ #
+ # Copyright (c) 2022 Jon Lamb <jon@auxon.io>
+ #
+ # 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.
+ #}
+{% set c_type = op.ft | ft_c_type %}
+{% set src = 'ctx->sequence_number' %}
+/* Write `packet_seq_num` field */
+{% include 'c/serialize-write-bit-array-statements.j2' %}
index 3d400ec4d361f142faab9f4240837eef57a0e3ea..9dce0ea8e8affaf693564b87b051d77de5131d37 100644 (file)
@@ -150,7 +150,13 @@ See the data stream type packet features object's
 xref:yaml:dst-obj.adoc#disc-er-counter-snapshot-ft-prop[`discarded-event-records-counter-snapshot-field-type`
 property].
 
-** [.opt]##Optional##A packet sequence number.
+** [.opt]##Optional##A packet sequence number (within its <<ds,data
+   stream>>).
++
+See the data stream type packet features object's
+xref:yaml:dst-obj.adoc#seq-num-ft-prop[`sequence-number-field-type`
+property].
+
 ** [.opt]##Optional##User fields.
 +
 See the data stream type object's
index 57ed7e9fe2859f4fb496685b82cf31f9aab065e9..aef6c2521eeb5b4da3eede53cd4b44f4c9985b00 100644 (file)
@@ -191,6 +191,15 @@ Returns the number of
 xref:how-barectf-works:ctf-primer.adoc#disc-er-counter[discarded event
 records] in the barectf context `vctx`.
 
+* [[barectf-pkt-seq-num-func]]{empty}
++
+[source,c]
+----
+uint32_t barectf_packet_sequence_number(const void *vctx);
+----
++
+Returns the packet sequence number in the barectf context `vctx`.
+
 * {empty}
 +
 [source,c]
@@ -301,11 +310,15 @@ void barectf_NAME_close_packet(struct barectf_NAME_ctx *sctx);
 
 A packet closing function:
 
-. Writes some
-  xref:how-barectf-works:ctf-primer.adoc#pkt[packet context]
+. Marks the current packet as being closed.
+
+. Writes some xref:how-barectf-works:ctf-primer.adoc#pkt[packet context]
   fields.
 
-. Marks the current packet as being closed.
+. If the
+  xref:yaml:dst-obj.adoc#seq-num-ft-prop[`sequence-number-field-type`
+  packet feature] of the corresponding data stream type is enabled:
+  increments the packet sequence number of `sctx`.
 
 In general, a <<cb-close,packet closing platform callback function>> and
 a platform finalization function (for the last packet) call this
index 26c732de18828fed541e295656652e65cc15b8b1..614f8d005fabf3a86415adc5bdf55d1ad1b3bc02 100644 (file)
@@ -232,6 +232,15 @@ record counter] snapshot field.
 If this property's value is a string, it must be the name of an existing
 xref:trace-type-obj.adoc#ft-aliases-prop[field type alias].
 |Use a default field type (true)
+
+|[[seq-num-ft-prop]]`sequence-number-field-type`
+|Unsigned xref:int-ft-obj.adoc[integer field type object], string,
+or boolean
+|Type of packet context's sequence number field.
+
+If this property's value is a string, it must be the name of an existing
+xref:trace-type-obj.adoc#ft-aliases-prop[field type alias].
+|Disabled (false)
 |===
 
 [[er-features-obj]]
@@ -333,6 +342,18 @@ event-record-types:
 ----
 ====
 
+.Data stream type object with an enabled packet <<seq-num-ft-prop,sequence number field type feature>>.
+====
+[source,yaml]
+----
+$features:
+  packet:
+    sequence-number-field-type: true
+event-record-types:
+  # ...
+----
+====
+
 .Data stream type object with 16-bit packet <<total-size-ft-prop,total>> and <<content-size-ft-prop,content size field type features>>.
 ====
 [source,yaml]
diff --git a/tests/tracing/configs/counter-clock/dst-packet-features/seq-num.yaml b/tests/tracing/configs/counter-clock/dst-packet-features/seq-num.yaml
new file mode 100644 (file)
index 0000000..fe6b45d
--- /dev/null
@@ -0,0 +1,42 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2022 Jon Lamb <jon@auxon.io>
+#
+# 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.
+
+%YAML 1.2
+--- !<tag:barectf.org,2020/3/config>
+trace:
+  type:
+    $include:
+      - base-no-features.yaml
+    data-stream-types:
+      default:
+        $features:
+          packet:
+            sequence-number-field-type: true
+        event-record-types:
+          ev:
+            payload-field-type:
+              class: struct
+              members:
+                - s:
+                    field-type:
+                      class: string
diff --git a/tests/tracing/expect/counter-clock/dst-packet-features/seq-num.data.expect b/tests/tracing/expect/counter-clock/dst-packet-features/seq-num.data.expect
new file mode 100644 (file)
index 0000000..472b448
Binary files /dev/null and b/tests/tracing/expect/counter-clock/dst-packet-features/seq-num.data.expect differ
diff --git a/tests/tracing/expect/counter-clock/dst-packet-features/seq-num.metadata.expect b/tests/tracing/expect/counter-clock/dst-packet-features/seq-num.metadata.expect
new file mode 100644 (file)
index 0000000..e21cfe8
--- /dev/null
@@ -0,0 +1,119 @@
+/* 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 {
+               integer {
+                       signed = false;
+                       size = 64;
+                       align = 8;
+                       byte_order = native;
+                       base = 10;
+               } stream_id;
+       } align(8);
+};
+
+env {
+       domain = "bare";
+       tracer_name = "barectf";
+};
+
+clock {
+       name = default;
+       freq = 1000000000;
+       precision = 0;
+       offset_s = 0;
+       offset = 0;
+       absolute = false;
+};
+
+/* Data stream type `default` */
+stream {
+       id = 0;
+       packet.context := struct {
+               integer {
+                       signed = false;
+                       size = 64;
+                       align = 8;
+                       byte_order = native;
+                       base = 10;
+               } packet_size;
+               integer {
+                       signed = false;
+                       size = 64;
+                       align = 8;
+                       byte_order = native;
+                       base = 10;
+               } content_size;
+               integer {
+                       signed = false;
+                       size = 64;
+                       align = 8;
+                       byte_order = native;
+                       base = 10;
+               } packet_seq_num;
+       } align(8);
+       event.header := struct {
+               integer {
+                       signed = false;
+                       size = 64;
+                       align = 8;
+                       byte_order = native;
+                       base = 10;
+               } id;
+       } align(8);
+};
+
+event {
+       stream_id = 0;
+       id = 0;
+       name = "dummy";
+       fields := struct {
+               string {
+                       encoding = UTF8;
+               } u;
+       } align(1);
+};
+
+event {
+       stream_id = 0;
+       id = 1;
+       name = "ev";
+       fields := struct {
+               string {
+                       encoding = UTF8;
+               } s;
+       } align(1);
+};
diff --git a/tests/tracing/src/counter-clock/dst-packet-features/seq-num.c b/tests/tracing/src/counter-clock/dst-packet-features/seq-num.c
new file mode 100644 (file)
index 0000000..3a1ecbc
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2022 Jon Lamb <jon@auxon.io>
+ *
+ * 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 <stdint.h>
+
+#include "test-platform.h"
+#include "barectf.h"
+
+int main(void)
+{
+       struct test_platform_ctx * const platform_ctx = test_platform_init(64);
+
+       assert(platform_ctx);
+       assert(barectf_packet_sequence_number(test_platform_barectf_ctx(platform_ctx)) == 0);
+       barectf_trace_ev(test_platform_barectf_ctx(platform_ctx),
+               "I feel special.");
+       barectf_trace_ev(test_platform_barectf_ctx(platform_ctx),
+               "I feel special.");
+       assert(barectf_packet_sequence_number(test_platform_barectf_ctx(platform_ctx)) == 1);
+       barectf_trace_ev(test_platform_barectf_ctx(platform_ctx),
+               "I feel special.");
+       assert(barectf_packet_sequence_number(test_platform_barectf_ctx(platform_ctx)) == 2);
+       barectf_trace_ev(test_platform_barectf_ctx(platform_ctx),
+               "I feel special.");
+       assert(barectf_packet_sequence_number(test_platform_barectf_ctx(platform_ctx)) == 3);
+       test_platform_fini(platform_ctx);
+       return 0;
+}
This page took 0.033882 seconds and 4 git commands to generate.