#!/bin/bash # # Copyright (C) 2019 Simon Marchi # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License, version 2 only, as # published by the Free Software Foundation. # # 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., 51 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 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" NUM_TESTS=3 plan_tests $NUM_TESTS tmp_metadata=$(mktemp) # Test a valid trace directory. "${BT_TESTS_BT2_BIN}" -o ctf-metadata "${BT_CTF_TRACES_PATH}/succeed/wk-heartbeat-u" > "$tmp_metadata" ok $? "Run babeltrace -o ctf-metadata with a valid trace directory, correct exit status" cmp -s "$tmp_metadata" "${BT_TESTS_DATADIR}/cli/test_output_ctf_metadata.ref" ok $? "Run babeltrace -o ctf-metadata with a valid trace directory, correct output" # Test an invalid trace directory. "${BT_TESTS_BT2_BIN}" -o ctf-metadata "${BT_CTF_TRACES_PATH}" >/dev/null 2>&1 isnt $? 0 "Run babeltrace -o ctf-metadata with an invalid trace directory, expecting failure" rm -f "$tmp_metadata"