Commit | Line | Data |
---|---|---|
1866f792 JD |
1 | #!/bin/bash |
2 | # | |
3 | # Copyright (C) - 2015 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/../../converter/babeltrace | |
fcacebd5 | 22 | CTF_TRACES=@abs_top_srcdir@/tests/ctf-traces |
1866f792 JD |
23 | |
24 | source $TESTDIR/utils/tap/tap.sh | |
25 | ||
26 | NUM_TESTS=10 | |
27 | ||
28 | plan_tests $NUM_TESTS | |
29 | ||
30 | test_intersect() { | |
31 | trace=$1 | |
32 | totalevents=$2 | |
33 | intersect=$3 | |
34 | ||
35 | test $($BABELTRACE_BIN $trace | wc -l) = $totalevents | |
36 | ok $? "$totalevents events in the whole trace" | |
37 | test $($BABELTRACE_BIN --stream-intersection $trace 2>/dev/null| wc -l) = $intersect | |
38 | ok $? "$intersect events in packets intersecting" | |
39 | } | |
40 | ||
41 | diag "Test the stream intersection feature" | |
42 | ||
43 | diag "2 streams offsetted with 3 packets intersecting" | |
3a25c1e8 | 44 | test_intersect ${CTF_TRACES}/intersection/3eventsintersect 8 3 |
1866f792 JD |
45 | |
46 | diag "2 streams offsetted with 3 packets intersecting (exchanged file names)" | |
3a25c1e8 | 47 | test_intersect ${CTF_TRACES}/intersection/3eventsintersectreverse 8 3 |
1866f792 JD |
48 | |
49 | diag "No intersection between 2 streams" | |
3a25c1e8 | 50 | test_intersect ${CTF_TRACES}/intersection/nointersect 6 0 |
1866f792 JD |
51 | |
52 | diag "Only 1 stream" | |
3a25c1e8 | 53 | test_intersect ${CTF_TRACES}/intersection/onestream 3 3 |
1866f792 JD |
54 | |
55 | diag "No stream at all" | |
3a25c1e8 | 56 | test_intersect ${CTF_TRACES}/intersection/nostream 0 0 |