tests/src.ctf.fs: add CTF 2 tests for no stream class, no trace class
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 16 Aug 2022 13:48:56 +0000 (09:48 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 23 Aug 2022 16:06:16 +0000 (12:06 -0400)
During development, we hit some crashes when the trace metadata did not
specify any data stream class fragment (with and without an explicit
trace class fragment).  Add tests for that.

Change-Id: Ic8ce4c7a2ae78b2f484a86e5b1306b7eae606528
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
tests/data/ctf-traces/2/fail/meta-no-stream-cls/metadata [new file with mode: 0644]
tests/data/ctf-traces/2/fail/meta-no-trace-cls-no-stream-cls/metadata [new file with mode: 0644]
tests/plugins/src.ctf.fs/fail/test_fail

diff --git a/tests/data/ctf-traces/2/fail/meta-no-stream-cls/metadata b/tests/data/ctf-traces/2/fail/meta-no-stream-cls/metadata
new file mode 100644 (file)
index 0000000..33af695
--- /dev/null
@@ -0,0 +1,9 @@
+\1e
+{
+  "type": "preamble",
+  "version": 2
+}
+\1e
+{
+  "type": "trace-class"
+}
diff --git a/tests/data/ctf-traces/2/fail/meta-no-trace-cls-no-stream-cls/metadata b/tests/data/ctf-traces/2/fail/meta-no-trace-cls-no-stream-cls/metadata
new file mode 100644 (file)
index 0000000..ab212ea
--- /dev/null
@@ -0,0 +1,5 @@
+\1e
+{
+  "type": "preamble",
+  "version": 2
+}
index 0b9b5d929db1619f93162d2a58a5486a8f3b74f7..9c940f5174a95849c89ea2b5b4d43b704836323f 100755 (executable)
@@ -84,7 +84,7 @@ test_fail() {
        done
 }
 
-plan_tests 24
+plan_tests 40
 
 test_fail \
        "invalid-packet-size/trace" \
@@ -104,4 +104,16 @@ test_fail \
        "/dev/null" \
        "^  At line 3 in metadata stream: syntax error, unexpected CTF_RSBRAC: token=\"]\""
 
+test_fail \
+       "meta-no-trace-cls-no-stream-cls" \
+       2 \
+       "/dev/null" \
+       "Missing data stream class fragment in metadata stream."
+
+test_fail \
+       "meta-no-trace-cls-no-stream-cls" \
+       2 \
+       "/dev/null" \
+       "Missing data stream class fragment in metadata stream."
+
 rm -f "${stdout_file}" "${stderr_file}"
This page took 0.031817 seconds and 5 git commands to generate.