tests/tracing: add trace type feature tests
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 24 Sep 2020 23:15:59 +0000 (19:15 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 24 Sep 2020 23:37:53 +0000 (19:37 -0400)
This patch adds a new tracing test category named `counter-clock`.

This is because the `counter-clock` platform (in
`tests/tracing/support/counter-clock`) has a data stream clock which is
a simpler counter starting at 0.

The platform's base YAML trace type object,
`tests/tracing/support/counter-clock/base.yaml`, specifies a single
event record type `dummy` so that test-specific configurations which do
not need event record types are lighter.

The C files in `tests/tracing/src/counter-clock/trace-type-features`
do not call any tracing function: they only initialize and finalize
the test platform, which effectively opens and closes a single packet.

In the new `test-platform.c` file, test_platform_fini() closes the
current packet whether or not it's empty.

`tests/tracing/support/counter-clock/base-no-features.yaml` is a YAML
trace type object file which disables all the trace type and data stream
type features except the data stream type ID and event record type ID
features.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
30 files changed:
tests/tracing/configs/counter-clock/trace-type-features/dst-id-uint8.yaml [new file with mode: 0644]
tests/tracing/configs/counter-clock/trace-type-features/magic-hex.yaml [new file with mode: 0644]
tests/tracing/configs/counter-clock/trace-type-features/magic.yaml [new file with mode: 0644]
tests/tracing/configs/counter-clock/trace-type-features/none.yaml [new file with mode: 0644]
tests/tracing/configs/counter-clock/trace-type-features/uuid-hex.yaml [new file with mode: 0644]
tests/tracing/configs/counter-clock/trace-type-features/uuid.yaml [new file with mode: 0644]
tests/tracing/conftest.py
tests/tracing/expect/counter-clock/trace-type-features/dst-id-uint8.data.expect [new file with mode: 0644]
tests/tracing/expect/counter-clock/trace-type-features/dst-id-uint8.metadata.expect [new file with mode: 0644]
tests/tracing/expect/counter-clock/trace-type-features/magic-hex.data.expect [new file with mode: 0644]
tests/tracing/expect/counter-clock/trace-type-features/magic-hex.metadata.expect [new file with mode: 0644]
tests/tracing/expect/counter-clock/trace-type-features/magic.data.expect [new file with mode: 0644]
tests/tracing/expect/counter-clock/trace-type-features/magic.metadata.expect [new file with mode: 0644]
tests/tracing/expect/counter-clock/trace-type-features/none.data.expect [new file with mode: 0644]
tests/tracing/expect/counter-clock/trace-type-features/none.metadata.expect [new file with mode: 0644]
tests/tracing/expect/counter-clock/trace-type-features/uuid-hex.data.expect [new file with mode: 0644]
tests/tracing/expect/counter-clock/trace-type-features/uuid-hex.metadata.expect [new file with mode: 0644]
tests/tracing/expect/counter-clock/trace-type-features/uuid.data.expect [new file with mode: 0644]
tests/tracing/expect/counter-clock/trace-type-features/uuid.metadata.expect [new file with mode: 0644]
tests/tracing/src/counter-clock/trace-type-features/dst-id-uint8.c [new file with mode: 0644]
tests/tracing/src/counter-clock/trace-type-features/magic-hex.c [new file with mode: 0644]
tests/tracing/src/counter-clock/trace-type-features/magic.c [new file with mode: 0644]
tests/tracing/src/counter-clock/trace-type-features/none.c [new file with mode: 0644]
tests/tracing/src/counter-clock/trace-type-features/uuid-hex.c [new file with mode: 0644]
tests/tracing/src/counter-clock/trace-type-features/uuid.c [new file with mode: 0644]
tests/tracing/support/counter-clock/Makefile [new file with mode: 0644]
tests/tracing/support/counter-clock/base-no-features.yaml [new file with mode: 0644]
tests/tracing/support/counter-clock/base.yaml [new file with mode: 0644]
tests/tracing/support/counter-clock/test-platform.c [new file with mode: 0644]
tests/tracing/support/counter-clock/test-platform.h [new file with mode: 0644]

diff --git a/tests/tracing/configs/counter-clock/trace-type-features/dst-id-uint8.yaml b/tests/tracing/configs/counter-clock/trace-type-features/dst-id-uint8.yaml
new file mode 100644 (file)
index 0000000..d05a5e9
--- /dev/null
@@ -0,0 +1,32 @@
+# 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.
+
+%YAML 1.2
+--- !<tag:barectf.org,2020/3/config>
+trace:
+  type:
+    $include:
+      - base-no-features.yaml
+      - stdint.yaml
+    $features:
+      data-stream-type-id-field-type: uint8
diff --git a/tests/tracing/configs/counter-clock/trace-type-features/magic-hex.yaml b/tests/tracing/configs/counter-clock/trace-type-features/magic-hex.yaml
new file mode 100644 (file)
index 0000000..8e722eb
--- /dev/null
@@ -0,0 +1,34 @@
+# 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.
+
+%YAML 1.2
+--- !<tag:barectf.org,2020/3/config>
+trace:
+  type:
+    $include:
+      - base-no-features.yaml
+      - stdint.yaml
+    $features:
+      magic-field-type:
+        $inherit: uint32
+        preferred-display-base: hex
diff --git a/tests/tracing/configs/counter-clock/trace-type-features/magic.yaml b/tests/tracing/configs/counter-clock/trace-type-features/magic.yaml
new file mode 100644 (file)
index 0000000..86507e0
--- /dev/null
@@ -0,0 +1,31 @@
+# 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.
+
+%YAML 1.2
+--- !<tag:barectf.org,2020/3/config>
+trace:
+  type:
+    $include:
+      - base-no-features.yaml
+    $features:
+      magic-field-type: true
diff --git a/tests/tracing/configs/counter-clock/trace-type-features/none.yaml b/tests/tracing/configs/counter-clock/trace-type-features/none.yaml
new file mode 100644 (file)
index 0000000..9b97a4b
--- /dev/null
@@ -0,0 +1,29 @@
+# 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.
+
+%YAML 1.2
+--- !<tag:barectf.org,2020/3/config>
+trace:
+  type:
+    $include:
+      - base-no-features.yaml
diff --git a/tests/tracing/configs/counter-clock/trace-type-features/uuid-hex.yaml b/tests/tracing/configs/counter-clock/trace-type-features/uuid-hex.yaml
new file mode 100644 (file)
index 0000000..b895596
--- /dev/null
@@ -0,0 +1,38 @@
+# 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.
+
+%YAML 1.2
+--- !<tag:barectf.org,2020/3/config>
+trace:
+  type:
+    $include:
+      - base-no-features.yaml
+      - stdint.yaml
+    $features:
+      uuid-field-type:
+        class: static-array
+        length: 16
+        element-field-type:
+          $inherit: uint8
+          preferred-display-base: hex
+    uuid: 79e49040-21b5-42d4-a83b-646f78666b62
diff --git a/tests/tracing/configs/counter-clock/trace-type-features/uuid.yaml b/tests/tracing/configs/counter-clock/trace-type-features/uuid.yaml
new file mode 100644 (file)
index 0000000..0abb2b2
--- /dev/null
@@ -0,0 +1,32 @@
+# 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.
+
+%YAML 1.2
+--- !<tag:barectf.org,2020/3/config>
+trace:
+  type:
+    $include:
+      - base-no-features.yaml
+    $features:
+      uuid-field-type: true
+    uuid: 79e49040-21b5-42d4-a83b-646f78666b62
index ffd539a0eeb1566036674e3e56783ce7245a2124..cb2e8e3424ccb495599b700ca640007ac375846a 100644 (file)
@@ -57,7 +57,7 @@ def pytest_collect_file(parent, path):
     cat = os.path.basename(cat_dir)
     configs_dir = os.path.dirname(cat_dir)
 
-    if cat not in {'basic'} or os.path.basename(configs_dir) != 'configs':
+    if cat not in {'basic', 'counter-clock'} or os.path.basename(configs_dir) != 'configs':
         # not a YAML configuration test
         return
 
diff --git a/tests/tracing/expect/counter-clock/trace-type-features/dst-id-uint8.data.expect b/tests/tracing/expect/counter-clock/trace-type-features/dst-id-uint8.data.expect
new file mode 100644 (file)
index 0000000..f9a59cd
Binary files /dev/null and b/tests/tracing/expect/counter-clock/trace-type-features/dst-id-uint8.data.expect differ
diff --git a/tests/tracing/expect/counter-clock/trace-type-features/dst-id-uint8.metadata.expect b/tests/tracing/expect/counter-clock/trace-type-features/dst-id-uint8.metadata.expect
new file mode 100644 (file)
index 0000000..bd9e6c4
--- /dev/null
@@ -0,0 +1,101 @@
+/* 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 = 8;
+                       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;
+       } 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);
+};
diff --git a/tests/tracing/expect/counter-clock/trace-type-features/magic-hex.data.expect b/tests/tracing/expect/counter-clock/trace-type-features/magic-hex.data.expect
new file mode 100644 (file)
index 0000000..193f37d
Binary files /dev/null and b/tests/tracing/expect/counter-clock/trace-type-features/magic-hex.data.expect differ
diff --git a/tests/tracing/expect/counter-clock/trace-type-features/magic-hex.metadata.expect b/tests/tracing/expect/counter-clock/trace-type-features/magic-hex.metadata.expect
new file mode 100644 (file)
index 0000000..9090c5c
--- /dev/null
@@ -0,0 +1,108 @@
+/* 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 = 32;
+                       align = 32;
+                       byte_order = native;
+                       base = 16;
+               } magic;
+               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;
+       } 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);
+};
diff --git a/tests/tracing/expect/counter-clock/trace-type-features/magic.data.expect b/tests/tracing/expect/counter-clock/trace-type-features/magic.data.expect
new file mode 100644 (file)
index 0000000..193f37d
Binary files /dev/null and b/tests/tracing/expect/counter-clock/trace-type-features/magic.data.expect differ
diff --git a/tests/tracing/expect/counter-clock/trace-type-features/magic.metadata.expect b/tests/tracing/expect/counter-clock/trace-type-features/magic.metadata.expect
new file mode 100644 (file)
index 0000000..ea8b06f
--- /dev/null
@@ -0,0 +1,108 @@
+/* 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 = 32;
+                       align = 8;
+                       byte_order = native;
+                       base = 10;
+               } magic;
+               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;
+       } 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);
+};
diff --git a/tests/tracing/expect/counter-clock/trace-type-features/none.data.expect b/tests/tracing/expect/counter-clock/trace-type-features/none.data.expect
new file mode 100644 (file)
index 0000000..bd21619
Binary files /dev/null and b/tests/tracing/expect/counter-clock/trace-type-features/none.data.expect differ
diff --git a/tests/tracing/expect/counter-clock/trace-type-features/none.metadata.expect b/tests/tracing/expect/counter-clock/trace-type-features/none.metadata.expect
new file mode 100644 (file)
index 0000000..6df91b5
--- /dev/null
@@ -0,0 +1,101 @@
+/* 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;
+       } 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);
+};
diff --git a/tests/tracing/expect/counter-clock/trace-type-features/uuid-hex.data.expect b/tests/tracing/expect/counter-clock/trace-type-features/uuid-hex.data.expect
new file mode 100644 (file)
index 0000000..630be98
Binary files /dev/null and b/tests/tracing/expect/counter-clock/trace-type-features/uuid-hex.data.expect differ
diff --git a/tests/tracing/expect/counter-clock/trace-type-features/uuid-hex.metadata.expect b/tests/tracing/expect/counter-clock/trace-type-features/uuid-hex.metadata.expect
new file mode 100644 (file)
index 0000000..43002f0
--- /dev/null
@@ -0,0 +1,109 @@
+/* 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;
+       uuid = "79e49040-21b5-42d4-a83b-646f78666b62";
+       packet.header := struct {
+               integer {
+                       signed = false;
+                       size = 8;
+                       align = 8;
+                       byte_order = native;
+                       base = 16;
+               } uuid[16];
+               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;
+       } 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);
+};
diff --git a/tests/tracing/expect/counter-clock/trace-type-features/uuid.data.expect b/tests/tracing/expect/counter-clock/trace-type-features/uuid.data.expect
new file mode 100644 (file)
index 0000000..630be98
Binary files /dev/null and b/tests/tracing/expect/counter-clock/trace-type-features/uuid.data.expect differ
diff --git a/tests/tracing/expect/counter-clock/trace-type-features/uuid.metadata.expect b/tests/tracing/expect/counter-clock/trace-type-features/uuid.metadata.expect
new file mode 100644 (file)
index 0000000..39ef882
--- /dev/null
@@ -0,0 +1,109 @@
+/* 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;
+       uuid = "79e49040-21b5-42d4-a83b-646f78666b62";
+       packet.header := struct {
+               integer {
+                       signed = false;
+                       size = 8;
+                       align = 8;
+                       byte_order = native;
+                       base = 10;
+               } uuid[16];
+               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;
+       } 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);
+};
diff --git a/tests/tracing/src/counter-clock/trace-type-features/dst-id-uint8.c b/tests/tracing/src/counter-clock/trace-type-features/dst-id-uint8.c
new file mode 100644 (file)
index 0000000..7c3856a
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * 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 <stdint.h>
+
+#include "test-platform.h"
+#include "barectf.h"
+
+int main()
+{
+       struct test_platform_ctx * const platform_ctx = test_platform_init(512);
+
+       assert(platform_ctx);
+       test_platform_fini(platform_ctx);
+       return 0;
+}
diff --git a/tests/tracing/src/counter-clock/trace-type-features/magic-hex.c b/tests/tracing/src/counter-clock/trace-type-features/magic-hex.c
new file mode 100644 (file)
index 0000000..7c3856a
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * 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 <stdint.h>
+
+#include "test-platform.h"
+#include "barectf.h"
+
+int main()
+{
+       struct test_platform_ctx * const platform_ctx = test_platform_init(512);
+
+       assert(platform_ctx);
+       test_platform_fini(platform_ctx);
+       return 0;
+}
diff --git a/tests/tracing/src/counter-clock/trace-type-features/magic.c b/tests/tracing/src/counter-clock/trace-type-features/magic.c
new file mode 100644 (file)
index 0000000..7c3856a
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * 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 <stdint.h>
+
+#include "test-platform.h"
+#include "barectf.h"
+
+int main()
+{
+       struct test_platform_ctx * const platform_ctx = test_platform_init(512);
+
+       assert(platform_ctx);
+       test_platform_fini(platform_ctx);
+       return 0;
+}
diff --git a/tests/tracing/src/counter-clock/trace-type-features/none.c b/tests/tracing/src/counter-clock/trace-type-features/none.c
new file mode 100644 (file)
index 0000000..7c3856a
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * 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 <stdint.h>
+
+#include "test-platform.h"
+#include "barectf.h"
+
+int main()
+{
+       struct test_platform_ctx * const platform_ctx = test_platform_init(512);
+
+       assert(platform_ctx);
+       test_platform_fini(platform_ctx);
+       return 0;
+}
diff --git a/tests/tracing/src/counter-clock/trace-type-features/uuid-hex.c b/tests/tracing/src/counter-clock/trace-type-features/uuid-hex.c
new file mode 100644 (file)
index 0000000..7c3856a
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * 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 <stdint.h>
+
+#include "test-platform.h"
+#include "barectf.h"
+
+int main()
+{
+       struct test_platform_ctx * const platform_ctx = test_platform_init(512);
+
+       assert(platform_ctx);
+       test_platform_fini(platform_ctx);
+       return 0;
+}
diff --git a/tests/tracing/src/counter-clock/trace-type-features/uuid.c b/tests/tracing/src/counter-clock/trace-type-features/uuid.c
new file mode 100644 (file)
index 0000000..7c3856a
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * 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 <stdint.h>
+
+#include "test-platform.h"
+#include "barectf.h"
+
+int main()
+{
+       struct test_platform_ctx * const platform_ctx = test_platform_init(512);
+
+       assert(platform_ctx);
+       test_platform_fini(platform_ctx);
+       return 0;
+}
diff --git a/tests/tracing/support/counter-clock/Makefile b/tests/tracing/support/counter-clock/Makefile
new file mode 100644 (file)
index 0000000..a572962
--- /dev/null
@@ -0,0 +1,31 @@
+# The MIT License (MIT)
+#
+# Copyright (c) 2016-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.
+
+CFLAGS += -O0 -g -Wall -pedantic -Wno-unused-function
+TARGET = test
+OBJS = $(TARGET).o barectf.o test-platform.o
+
+$(TARGET): $(OBJS)
+       $(CC) -o $@ $(LDFLAGS) $^
+
+barectf.o: barectf.c
+       $(CC) $(CFLAGS) -ansi -c $<
diff --git a/tests/tracing/support/counter-clock/base-no-features.yaml b/tests/tracing/support/counter-clock/base-no-features.yaml
new file mode 100644 (file)
index 0000000..c1fdd34
--- /dev/null
@@ -0,0 +1,13 @@
+$include: [base.yaml]
+$features:
+  magic-field-type: false
+  uuid-field-type: false
+data-stream-types:
+  default:
+    $features:
+      packet:
+        beginning-timestamp-field-type: false
+        end-timestamp-field-type: false
+        discarded-event-records-counter-snapshot-field-type: false
+      event-record:
+        timestamp-field-type: false
diff --git a/tests/tracing/support/counter-clock/base.yaml b/tests/tracing/support/counter-clock/base.yaml
new file mode 100644 (file)
index 0000000..1027c36
--- /dev/null
@@ -0,0 +1,17 @@
+native-byte-order: le
+clock-types:
+  default:
+    origin-is-unix-epoch: false
+    $c-type: uint64_t
+data-stream-types:
+  default:
+    $is-default: true
+    $default-clock-type-name: default
+    event-record-types:
+      dummy:
+        payload-field-type:
+          class: struct
+          members:
+            - u:
+                field-type:
+                  class: str
diff --git a/tests/tracing/support/counter-clock/test-platform.c b/tests/tracing/support/counter-clock/test-platform.c
new file mode 100644 (file)
index 0000000..6862590
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+ * 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 <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <assert.h>
+
+#include "barectf.h"
+#include "test-platform.h"
+
+struct test_platform_ctx {
+       struct barectf_default_ctx ctx;
+       FILE *fh;
+       uint64_t clock_val;
+};
+
+static uint64_t get_clock_val(void * const data)
+{
+       struct test_platform_ctx * const platform_ctx = (void *) data;
+       const uint64_t ret = platform_ctx->clock_val;
+
+       ++platform_ctx->clock_val;
+       return ret;
+}
+
+static void write_packet(struct test_platform_ctx * const platform_ctx)
+{
+       const size_t nmemb = fwrite(barectf_packet_buf(&platform_ctx->ctx),
+               barectf_packet_buf_size(&platform_ctx->ctx), 1,
+                       platform_ctx->fh);
+
+       assert(nmemb == 1);
+}
+
+static int is_backend_full(void * const data)
+{
+       return 0;
+}
+
+static void open_packet(void * const data)
+{
+       struct test_platform_ctx * const platform_ctx = (void *) data;
+
+       memset(barectf_packet_buf(&platform_ctx->ctx), 0,
+               barectf_packet_buf_size(&platform_ctx->ctx));
+       barectf_default_open_packet(&platform_ctx->ctx);
+}
+
+static void close_packet(void * const data)
+{
+       struct test_platform_ctx * const platform_ctx = (void *) data;
+
+       barectf_default_close_packet(&platform_ctx->ctx);
+       write_packet(platform_ctx);
+}
+
+struct test_platform_ctx *test_platform_init(const size_t buf_size)
+{
+       uint8_t *buf;
+       struct test_platform_ctx *platform_ctx;
+       struct barectf_platform_callbacks cbs;
+
+       cbs.default_clock_get_value = get_clock_val;
+       cbs.is_backend_full = is_backend_full;
+       cbs.open_packet = open_packet;
+       cbs.close_packet = close_packet;
+       platform_ctx = malloc(sizeof(*platform_ctx));
+       assert(platform_ctx);
+       platform_ctx->clock_val = 0;
+       buf = malloc(buf_size);
+       assert(buf);
+       platform_ctx->fh = fopen("stream", "wb");
+       assert(platform_ctx->fh);
+       barectf_init(&platform_ctx->ctx, buf, buf_size, cbs, platform_ctx);
+       open_packet(platform_ctx);
+       return platform_ctx;
+}
+
+void test_platform_fini(struct test_platform_ctx * const platform_ctx)
+{
+       if (barectf_packet_is_open(&platform_ctx->ctx)) {
+               close_packet(platform_ctx);
+       }
+
+       fclose(platform_ctx->fh);
+       free(barectf_packet_buf(&platform_ctx->ctx));
+       free(platform_ctx);
+}
+
+struct barectf_default_ctx *test_platform_barectf_ctx(
+       struct test_platform_ctx * const platform_ctx)
+{
+       return &platform_ctx->ctx;
+}
+
+void test_platform_new_packet(struct test_platform_ctx * const platform_ctx)
+{
+       if (barectf_packet_is_open(&platform_ctx->ctx)) {
+               close_packet(platform_ctx);
+       }
+
+       open_packet(platform_ctx);
+}
diff --git a/tests/tracing/support/counter-clock/test-platform.h b/tests/tracing/support/counter-clock/test-platform.h
new file mode 100644 (file)
index 0000000..1bf4870
--- /dev/null
@@ -0,0 +1,37 @@
+#ifndef _BARECTF_TEST_PLATFORM_H
+#define _BARECTF_TEST_PLATFORM_H
+
+/*
+ * 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 <stdlib.h>
+
+struct test_platform_ctx;
+struct barectf_default_ctx;
+
+struct test_platform_ctx *test_platform_init(size_t buf_size);
+void test_platform_fini(struct test_platform_ctx *platform_ctx);
+struct barectf_default_ctx *test_platform_barectf_ctx(
+       struct test_platform_ctx *platform_ctx);
+void test_platform_new_packet(struct test_platform_ctx *platform_ctx);
+
+#endif /* _BARECTF_TEST_PLATFORM_H */
This page took 0.04209 seconds and 4 git commands to generate.