#!/bin/bash # # Copyright (C) - 2017 Julien Desfossez # # 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. . "@abs_top_srcdir@/tests/utils/common.sh" SUCCESS_TRACES=(${BT_CTF_TRACES}/succeed/*) # -2 because there is an empty trace that we skip NUM_TESTS=$((${#SUCCESS_TRACES[@]} * 3 - 2)) plan_tests $NUM_TESTS for path in "${SUCCESS_TRACES[@]}"; do out_path="$(mktemp -d)" text_output1="$(mktemp)" text_output2="$(mktemp)" trace="$(basename "${path}")" "${BT_BIN}" "${path}" 2>/dev/null >"${text_output1}" ret=$? cnt="$(wc -l < "${text_output1}")" if test "$ret" == 0 && test "$cnt" == 0; then pass "Empty trace, nothing to copy" continue fi "${BT_BIN}" "${path}" --component sink.ctf.fs --path "${out_path}" >/dev/null 2>&1 ok $? "Copy trace ${trace} with ctf-fs sink" "${BT_BIN}" "${out_path}" >/dev/null 2>&1 if test $? != 0; then fail "Read the new trace in ${out_path}" continue fi pass "Read the new trace in ${out_path}" "${BT_BIN}" "${out_path}" 2>/dev/null >"${text_output2}" cnt=$(diff "${text_output1}" "${text_output2}" | wc -l) test "$cnt" == 0 ok $? "Exact same content between the two traces" rm -rf "${out_path}" "${text_output1}" "${text_output2}" done