X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=tests%2Fcli%2Ftest_output_path_ctf_non_lttng_trace;fp=tests%2Fcli%2Ftest_output_path_ctf_non_lttng_trace;h=a18644c5406ac384b1d851d619b0d31fe36815aa;hb=005d49d64c989f20ba4fb40833064ac2d17514ef;hp=0000000000000000000000000000000000000000;hpb=a1a22a55ca5aed7228803ca87896bf7741090380;p=babeltrace.git diff --git a/tests/cli/test_output_path_ctf_non_lttng_trace b/tests/cli/test_output_path_ctf_non_lttng_trace new file mode 100755 index 00000000..a18644c5 --- /dev/null +++ b/tests/cli/test_output_path_ctf_non_lttng_trace @@ -0,0 +1,65 @@ +#!/bin/bash + +# Copyright (C) EfficiOS Inc. +# +# 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 verifies that generic (non-LTTng) CTF traces are output with the +# expected directory structure. +# +# Traces found when invoking +# +# babeltrace2 in -c sink.ctf.fs -p 'path="out"' +# +# are expected to use the same directory structure relative to `out` as the +# original traces had relative to `in`. + +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" + +plan_tests 3 + +temp_input_dir=$(mktemp -d) +temp_output_dir=$(mktemp -d) + +mkdir -p "${temp_input_dir}/a/b/c" +cp -a "${BT_CTF_TRACES_PATH}/intersection/3eventsintersect" "${temp_input_dir}/a/b/c" + +mkdir -p "${temp_input_dir}/a/b/c" +cp -a "${BT_CTF_TRACES_PATH}/intersection/3eventsintersectreverse" "${temp_input_dir}/a/b/c" + +mkdir -p "${temp_input_dir}/d/e/f" +cp -a "${BT_CTF_TRACES_PATH}/intersection/nointersect" "${temp_input_dir}/d/e/f" + +"${BT_TESTS_BT2_BIN}" "${temp_input_dir}" -c sink.ctf.fs -p "path=\"${temp_output_dir}\"" + +test -f "${temp_output_dir}/a/b/c/3eventsintersect/metadata" +ok "$?" "3eventsintersect output trace exists" + +test -f "${temp_output_dir}/a/b/c/3eventsintersectreverse/metadata" +ok "$?" "3eventsintersectreverse output trace exists" + +test -f "${temp_output_dir}/d/e/f/nointersect/metadata" +ok "$?" "nointersect output trace exists" + +rm -rf "${temp_input_dir}" "${temp_output_dir}"