Commit | Line | Data |
---|---|---|
5177c351 JD |
1 | #!/bin/bash |
2 | # | |
3 | # Copyright (C) - 2017 Julien Desfossez <jdesfossez@efficios.com> | |
4 | # | |
5 | # This program is free software; you can redistribute it and/or modify it | |
6 | # under the terms of the GNU General Public License, version 2 only, as | |
7 | # published by the Free Software Foundation. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, but WITHOUT | |
10 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
12 | # more details. | |
13 | # | |
14 | # You should have received a copy of the GNU General Public License along with | |
15 | # this program; if not, write to the Free Software Foundation, Inc., 51 | |
16 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
17 | ||
03f007c8 | 18 | . "@abs_top_srcdir@/tests/utils/common.sh" |
5177c351 | 19 | |
03f007c8 | 20 | SUCCESS_TRACES=(${BT_CTF_TRACES}/succeed/*) |
5177c351 | 21 | |
c22ffa09 JD |
22 | # -2 because there is an empty trace that we skip |
23 | NUM_TESTS=$((${#SUCCESS_TRACES[@]} * 3 - 2)) | |
5177c351 JD |
24 | |
25 | plan_tests $NUM_TESTS | |
26 | ||
03f007c8 MJ |
27 | for path in "${SUCCESS_TRACES[@]}"; do |
28 | out_path="$(mktemp -d)" | |
29 | text_output1="$(mktemp)" | |
30 | text_output2="$(mktemp)" | |
31 | trace="$(basename "${path}")" | |
32 | ||
33 | "${BT_BIN}" "${path}" 2>/dev/null >"${text_output1}" | |
34 | ret=$? | |
35 | cnt="$(wc -l < "${text_output1}")" | |
36 | if test "$ret" == 0 && test "$cnt" == 0; then | |
37 | pass "Empty trace, nothing to copy" | |
c22ffa09 JD |
38 | continue |
39 | fi | |
5177c351 | 40 | |
03f007c8 | 41 | "${BT_BIN}" "${path}" --component sink.ctf.fs --path "${out_path}" >/dev/null 2>&1 |
5177c351 JD |
42 | ok $? "Copy trace ${trace} with ctf-fs sink" |
43 | ||
03f007c8 | 44 | "${BT_BIN}" "${out_path}" >/dev/null 2>&1 |
c22ffa09 JD |
45 | if test $? != 0; then |
46 | fail "Read the new trace in ${out_path}" | |
47 | continue | |
48 | fi | |
03f007c8 | 49 | pass "Read the new trace in ${out_path}" |
5177c351 | 50 | |
03f007c8 MJ |
51 | "${BT_BIN}" "${out_path}" 2>/dev/null >"${text_output2}" |
52 | cnt=$(diff "${text_output1}" "${text_output2}" | wc -l) | |
53 | test "$cnt" == 0 | |
c22ffa09 | 54 | ok $? "Exact same content between the two traces" |
5177c351 | 55 | |
03f007c8 | 56 | rm -rf "${out_path}" "${text_output1}" "${text_output2}" |
5177c351 | 57 | done |