tests: Rework test suite
[babeltrace.git] / tests / plugins / src.ctf.fs / succeed / test_succeed
diff --git a/tests/plugins/src.ctf.fs/succeed/test_succeed b/tests/plugins/src.ctf.fs/succeed/test_succeed
new file mode 100755 (executable)
index 0000000..9cd77ba
--- /dev/null
@@ -0,0 +1,64 @@
+#!/bin/bash
+#
+# Copyright (C) 2019 Philippe Proulx <pproulx@efficios.com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; only version 2
+# of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+# This test validates that a `src.ctf.fs` component successfully reads
+# specific CTF traces and creates the expected messages.
+#
+# Such CTF traces to open either exist (in `tests/ctf-traces/succeed`)
+# or are generated by this test using local trace generators.
+
+SH_TAP=1
+
+if [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; then
+       UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh"
+else
+       UTILSSH="$(dirname "$0")/../../../utils/utils.sh"
+fi
+
+# shellcheck source=../../../utils/utils.sh
+source "$UTILSSH"
+
+this_dir_relative="plugins/src.ctf.fs/succeed"
+this_dir_build="$BT_TESTS_BUILDDIR/$this_dir_relative"
+succeed_trace_dir="$BT_CTF_TRACES_PATH/succeed"
+expect_dir="$BT_TESTS_DATADIR/$this_dir_relative"
+
+test_ctf_common_details_args="-p with-trace-name=no,with-stream-name=no"
+
+test_ctf_gen_single() {
+       name="$1"
+
+       diag "Generating trace '$name'"
+       bt_diff_details_ctf_gen_single "$this_dir_build/gen-trace-$name" \
+               "$expect_dir/trace-$name.expect" \
+               "$test_ctf_common_details_args -p with-uuid=no"
+       ok $? "Generated trace '$name' gives the expected output"
+}
+
+test_ctf_single() {
+       name="$1"
+
+       bt_diff_details_ctf_single "$succeed_trace_dir/$name" \
+               "$expect_dir/trace-$name.expect" "$test_ctf_common_details_args"
+       ok $? "Trace '$name' gives the expected output"
+}
+
+plan_tests 2
+
+test_ctf_gen_single simple
+test_ctf_single smalltrace
This page took 0.023829 seconds and 4 git commands to generate.