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 | ||
18 | CURDIR=$(dirname $0) | |
19 | TESTDIR=$CURDIR/.. | |
20 | ||
21 | BABELTRACE_BIN=$CURDIR/../../cli/babeltrace | |
22 | ||
23 | CTF_TRACES=@abs_top_srcdir@/tests/ctf-traces | |
24 | ||
25 | source $TESTDIR/utils/tap/tap.sh | |
26 | ||
27 | SUCCESS_TRACES=(${CTF_TRACES}/succeed/*) | |
28 | FAIL_TRACES=(${CTF_TRACES}/fail/*) | |
29 | ||
30 | NUM_TESTS=$((${#SUCCESS_TRACES[@]} * 3)) | |
31 | ||
32 | plan_tests $NUM_TESTS | |
33 | ||
34 | for path in ${SUCCESS_TRACES[@]}; do | |
35 | out_path=$(mktemp -d) | |
36 | trace=$(basename ${path}) | |
37 | ||
38 | orig_cnt=$($BABELTRACE_BIN ${path} 2>/dev/null | wc -l) | |
39 | ||
40 | $BABELTRACE_BIN ${path} --component sink.ctf.fs --path ${out_path} >/dev/null 2>&1 | |
41 | ok $? "Copy trace ${trace} with ctf-fs sink" | |
42 | ||
43 | $BABELTRACE_BIN ${out_path} >/dev/null 2>&1 | |
44 | ok $? "Read the new trace in ${out_path}" | |
45 | ||
46 | new_cnt=$($BABELTRACE_BIN ${out_path} 2>/dev/null | wc -l) | |
47 | ||
48 | test $orig_cnt == $new_cnt | |
49 | ok $? "Same number of events as the original trace ($orig_cnt -> $new_cnt)" | |
50 | ||
51 | rm -rf ${out_path} | |
52 | done |