| 1 | #!/bin/bash |
| 2 | |
| 3 | # Copyright (C) EfficiOS Inc. |
| 4 | # |
| 5 | # This program is free software; you can redistribute it and/or |
| 6 | # modify it under the terms of the GNU General Public License |
| 7 | # as published by the Free Software Foundation; only version 2 |
| 8 | # of the License. |
| 9 | # |
| 10 | # This program is distributed in the hope that it will be useful, |
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | # GNU General Public License for more details. |
| 14 | # |
| 15 | # You should have received a copy of the GNU General Public License |
| 16 | # along with this program; if not, write to the Free Software |
| 17 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 18 | |
| 19 | # This test verifies that generic (non-LTTng) CTF traces are output with the |
| 20 | # expected directory structure. |
| 21 | # |
| 22 | # Traces found when invoking |
| 23 | # |
| 24 | # babeltrace2 in -c sink.ctf.fs -p 'path="out"' |
| 25 | # |
| 26 | # are expected to use the same directory structure relative to `out` as the |
| 27 | # original traces had relative to `in`. |
| 28 | |
| 29 | SH_TAP=1 |
| 30 | |
| 31 | if [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; then |
| 32 | UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh" |
| 33 | else |
| 34 | UTILSSH="$(dirname "$0")/../utils/utils.sh" |
| 35 | fi |
| 36 | |
| 37 | # shellcheck source=../utils/utils.sh |
| 38 | source "$UTILSSH" |
| 39 | |
| 40 | plan_tests 3 |
| 41 | |
| 42 | temp_input_dir=$(mktemp -t -d test_output_path_ctf_non_lttng_trace_input.XXXXXX) |
| 43 | temp_output_dir=$(mktemp -t -d test_output_path_ctf_non_lttng_trace_output.XXXXXX) |
| 44 | |
| 45 | mkdir -p "${temp_input_dir}/a/b/c" |
| 46 | cp -a "${BT_CTF_TRACES_PATH}/intersection/3eventsintersect" "${temp_input_dir}/a/b/c" |
| 47 | |
| 48 | mkdir -p "${temp_input_dir}/a/b/c" |
| 49 | cp -a "${BT_CTF_TRACES_PATH}/intersection/3eventsintersectreverse" "${temp_input_dir}/a/b/c" |
| 50 | |
| 51 | mkdir -p "${temp_input_dir}/d/e/f" |
| 52 | cp -a "${BT_CTF_TRACES_PATH}/intersection/nointersect" "${temp_input_dir}/d/e/f" |
| 53 | |
| 54 | bt_cli "/dev/null" "/dev/null" "${temp_input_dir}" -c sink.ctf.fs -p "path=\"${temp_output_dir}\"" |
| 55 | |
| 56 | test -f "${temp_output_dir}/a/b/c/3eventsintersect/metadata" |
| 57 | ok "$?" "3eventsintersect output trace exists" |
| 58 | |
| 59 | test -f "${temp_output_dir}/a/b/c/3eventsintersectreverse/metadata" |
| 60 | ok "$?" "3eventsintersectreverse output trace exists" |
| 61 | |
| 62 | test -f "${temp_output_dir}/d/e/f/nointersect/metadata" |
| 63 | ok "$?" "nointersect output trace exists" |
| 64 | |
| 65 | rm -rf "${temp_input_dir}" "${temp_output_dir}" |