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