| 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright (C) 2019 Francis Deslauriers <francis.deslauriers@efficios.com> |
| 4 | # |
| 5 | # This program is free software; you can redistribute it and/or |
| 6 | # modify it under the terms of the GNU General Public License |
| 7 | # as published by the Free Software Foundation; only version 2 |
| 8 | # of the License. |
| 9 | # |
| 10 | # This program is distributed in the hope that it will be useful, |
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | # GNU General Public License for more details. |
| 14 | # |
| 15 | # You should have received a copy of the GNU General Public License |
| 16 | # along with this program; if not, write to the Free Software |
| 17 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 18 | |
| 19 | # This file tests what happens when we mux messages. |
| 20 | |
| 21 | SH_TAP=1 |
| 22 | |
| 23 | if [ "x${BT_TESTS_SRCDIR:-}" != "x" ]; then |
| 24 | UTILSSH="$BT_TESTS_SRCDIR/utils/utils.sh" |
| 25 | else |
| 26 | UTILSSH="$(dirname "$0")/../../../utils/utils.sh" |
| 27 | fi |
| 28 | |
| 29 | # shellcheck source=../../../utils/utils.sh |
| 30 | source "$UTILSSH" |
| 31 | |
| 32 | data_dir="$BT_TESTS_DATADIR/plugins/flt.utils.muxer" |
| 33 | |
| 34 | plan_tests 12 |
| 35 | |
| 36 | function run_test |
| 37 | { |
| 38 | local test_name="$1" |
| 39 | local local_args=( |
| 40 | "--plugin-path" "$data_dir" |
| 41 | "-c" "src.test-muxer.TheSourceOfConfusion" |
| 42 | "-p" "test-name=$test_name" |
| 43 | "-c" "sink.text.details" |
| 44 | "--params=compact=false,with-metadata=false" |
| 45 | ) |
| 46 | |
| 47 | stdout_expected="$data_dir/succeed/$test_name.expect" |
| 48 | bt_diff_cli "$stdout_expected" /dev/null "${local_args[@]}" |
| 49 | ok $? "$test_name" |
| 50 | } |
| 51 | |
| 52 | |
| 53 | test_cases=( |
| 54 | basic_timestamp_ordering |
| 55 | diff_event_class_id |
| 56 | diff_event_class_name |
| 57 | diff_inactivity_msg_cs |
| 58 | diff_stream_class_id |
| 59 | diff_stream_class_name |
| 60 | diff_stream_class_no_name |
| 61 | diff_stream_id |
| 62 | diff_stream_name |
| 63 | diff_stream_no_name |
| 64 | diff_trace_name |
| 65 | multi_iter_ordering |
| 66 | ) |
| 67 | |
| 68 | for i in "${test_cases[@]}" |
| 69 | do |
| 70 | run_test "$i" |
| 71 | done |