| 1 | #!/bin/bash |
| 2 | # |
| 3 | # SPDX-License-Identifier: GPL-2.0-only |
| 4 | # |
| 5 | # Copyright (C) EfficiOS Inc. |
| 6 | # |
| 7 | |
| 8 | # This test verifies that generic (non-LTTng) CTF traces are output with the |
| 9 | # expected directory structure. |
| 10 | # |
| 11 | # Traces found when invoking |
| 12 | # |
| 13 | # babeltrace2 in -c sink.ctf.fs -p 'path="out"' |
| 14 | # |
| 15 | # are expected to use the same directory structure relative to `out` as the |
| 16 | # original traces had relative to `in`. |
| 17 | |
| 18 | SH_TAP=1 |
| 19 | |
| 20 | if [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; then |
| 21 | UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh" |
| 22 | else |
| 23 | UTILSSH="$(dirname "$0")/../utils/utils.sh" |
| 24 | fi |
| 25 | |
| 26 | # shellcheck source=../utils/utils.sh |
| 27 | source "$UTILSSH" |
| 28 | |
| 29 | plan_tests 3 |
| 30 | |
| 31 | temp_input_dir=$(mktemp -t -d test_output_path_ctf_non_lttng_trace_input.XXXXXX) |
| 32 | temp_output_dir=$(mktemp -t -d test_output_path_ctf_non_lttng_trace_output.XXXXXX) |
| 33 | |
| 34 | mkdir -p "${temp_input_dir}/a/b/c" |
| 35 | cp -a "${BT_CTF_TRACES_PATH}/intersection/3eventsintersect" "${temp_input_dir}/a/b/c" |
| 36 | |
| 37 | mkdir -p "${temp_input_dir}/a/b/c" |
| 38 | cp -a "${BT_CTF_TRACES_PATH}/intersection/3eventsintersectreverse" "${temp_input_dir}/a/b/c" |
| 39 | |
| 40 | mkdir -p "${temp_input_dir}/d/e/f" |
| 41 | cp -a "${BT_CTF_TRACES_PATH}/intersection/nointersect" "${temp_input_dir}/d/e/f" |
| 42 | |
| 43 | bt_cli "/dev/null" "/dev/null" "${temp_input_dir}" -c sink.ctf.fs -p "path=\"${temp_output_dir}\"" |
| 44 | |
| 45 | test -f "${temp_output_dir}/a/b/c/3eventsintersect/metadata" |
| 46 | ok "$?" "3eventsintersect output trace exists" |
| 47 | |
| 48 | test -f "${temp_output_dir}/a/b/c/3eventsintersectreverse/metadata" |
| 49 | ok "$?" "3eventsintersectreverse output trace exists" |
| 50 | |
| 51 | test -f "${temp_output_dir}/d/e/f/nointersect/metadata" |
| 52 | ok "$?" "nointersect output trace exists" |
| 53 | |
| 54 | rm -rf "${temp_input_dir}" "${temp_output_dir}" |