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 | ||
03f007c8 | 18 | . "@abs_top_builddir@/tests/utils/common.sh" |
e8b45bc8 JD |
19 | |
20 | NUM_TESTS=10 | |
21 | ||
22 | plan_tests $NUM_TESTS | |
23 | ||
24 | test_intersect() { | |
03f007c8 MJ |
25 | trace="$1" |
26 | totalevents="$2" | |
27 | intersect="$3" | |
e8b45bc8 | 28 | |
ce349ade | 29 | test $("${BT_BIN}" "$trace" | wc -l) = "$totalevents" |
e8b45bc8 | 30 | ok $? "$totalevents events in the whole trace" |
ce349ade | 31 | test $("${BT_BIN}" --stream-intersection "$trace" 2>/dev/null| wc -l) = "$intersect" |
e8b45bc8 JD |
32 | ok $? "$intersect events in packets intersecting" |
33 | } | |
34 | ||
35 | diag "Test the stream intersection feature" | |
36 | ||
37 | diag "2 streams offsetted with 3 packets intersecting" | |
bbff0ab4 | 38 | test_intersect "${BT_CTF_TRACES_PATH}/intersection/3eventsintersect" 8 3 |
e8b45bc8 JD |
39 | |
40 | diag "2 streams offsetted with 3 packets intersecting (exchanged file names)" | |
bbff0ab4 | 41 | test_intersect "${BT_CTF_TRACES_PATH}/intersection/3eventsintersectreverse" 8 3 |
e8b45bc8 JD |
42 | |
43 | diag "No intersection between 2 streams" | |
bbff0ab4 | 44 | test_intersect "${BT_CTF_TRACES_PATH}/intersection/nointersect" 6 0 |
e8b45bc8 JD |
45 | |
46 | diag "Only 1 stream" | |
bbff0ab4 | 47 | test_intersect "${BT_CTF_TRACES_PATH}/intersection/onestream" 3 3 |
e8b45bc8 JD |
48 | |
49 | diag "No stream at all" | |
bbff0ab4 | 50 | test_intersect "${BT_CTF_TRACES_PATH}/intersection/nostream" 0 0 |