| 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 | . "@abs_top_builddir@/tests/utils/common.sh" |
| 19 | |
| 20 | TRACE_PATH="${BT_CTF_TRACES}/succeed/wk-heartbeat-u/" |
| 21 | |
| 22 | NUM_TESTS=44 |
| 23 | |
| 24 | plan_tests $NUM_TESTS |
| 25 | |
| 26 | tmp_out=$(mktemp) |
| 27 | |
| 28 | "${BT_BIN}" --clock-gmt --begin 17:48:17.587029529 --end 17:48:17.588680018 \ |
| 29 | "${TRACE_PATH}" >/dev/null 2>&1 |
| 30 | ok $? "Read a trace with the trimmer enabled (GMT relative timestamps)" |
| 31 | |
| 32 | "${BT_BIN}" --clock-gmt --begin 17:48:17.587029529 "${TRACE_PATH}" \ |
| 33 | 2>/dev/null >"${tmp_out}" |
| 34 | ok $? "Ran successfully with --begin (GMT relative timestamps)" |
| 35 | cnt=$(wc -l < "${tmp_out}") |
| 36 | test $cnt == 18 |
| 37 | ok $? "Received ${cnt}/18 events (GMT relative timestamps)" |
| 38 | |
| 39 | "${BT_BIN}" --clock-gmt --end 17:48:17.588680018 "${TRACE_PATH}" \ |
| 40 | 2>/dev/null >"${tmp_out}" |
| 41 | ok $? "Ran successfully with --end (GMT relative timestamps)" |
| 42 | cnt=$(wc -l < "${tmp_out}") |
| 43 | test $cnt == 9 |
| 44 | ok $? "Received ${cnt}/9 events (GMT relative timestamps)" |
| 45 | |
| 46 | "${BT_BIN}" --clock-gmt --begin 17:48:17.587029529 --end 17:48:17.588680018 \ |
| 47 | "${TRACE_PATH}" 2>/dev/null >"${tmp_out}" |
| 48 | ok $? "Ran successfully with --begin and --end (GMT relative timestamps)" |
| 49 | cnt=$(wc -l < "${tmp_out}") |
| 50 | test $cnt == 7 |
| 51 | ok $? "Received ${cnt}/7 events (GMT relative timestamps)" |
| 52 | |
| 53 | "${BT_BIN}" --clock-gmt --begin 18:48:17.587029529 "${TRACE_PATH}" \ |
| 54 | 2>/dev/null >"${tmp_out}" |
| 55 | ok $? "Ran successfully with --begin out of range (GMT relative timestamps)" |
| 56 | cnt=$(wc -l < "${tmp_out}") |
| 57 | test $cnt == 0 |
| 58 | ok $? "No events when begin is out of range (GMT relative timestamps)" |
| 59 | |
| 60 | "${BT_BIN}" --clock-gmt --end 16:48:17.588680018 "${TRACE_PATH}" \ |
| 61 | 2>/dev/null >"${tmp_out}" |
| 62 | ok $? "Ran successfully with --end out of range (GMT relative timestamps)" |
| 63 | cnt=$(wc -l < "${tmp_out}") |
| 64 | test $cnt == 0 |
| 65 | ok $? "No events when end is out of range (GMT relative timestamps)" |
| 66 | |
| 67 | |
| 68 | "${BT_BIN}" --clock-gmt --begin "2012-10-29 17:48:17.587029529" --end "2012-10-29 17:48:17.588680018" \ |
| 69 | "${TRACE_PATH}" >/dev/null 2>&1 |
| 70 | ok $? "Read a trace with the trimmer enabled (GMT absolute timestamps)" |
| 71 | |
| 72 | "${BT_BIN}" --clock-gmt --begin "2012-10-29 17:48:17.587029529" "${TRACE_PATH}" \ |
| 73 | 2>/dev/null >"${tmp_out}" |
| 74 | ok $? "Ran successfully with --begin (GMT absolute timestamps)" |
| 75 | cnt=$(wc -l < "${tmp_out}") |
| 76 | test $cnt == 18 |
| 77 | ok $? "Received ${cnt}/18 events (GMT absolute timestamps)" |
| 78 | |
| 79 | "${BT_BIN}" --clock-gmt --end "2012-10-29 17:48:17.588680018" "${TRACE_PATH}" \ |
| 80 | 2>/dev/null >"${tmp_out}" |
| 81 | ok $? "Ran successfully with --end (GMT absolute timestamps)" |
| 82 | cnt=$(wc -l < "${tmp_out}") |
| 83 | test $cnt == 9 |
| 84 | ok $? "Received ${cnt}/9 events (GMT absolute timestamps)" |
| 85 | |
| 86 | "${BT_BIN}" --clock-gmt --begin "2012-10-29 17:48:17.587029529" --end "2012-10-29 17:48:17.588680018" \ |
| 87 | "${TRACE_PATH}" 2>/dev/null >"${tmp_out}" |
| 88 | ok $? "Ran successfully with --begin and --end (GMT absolute timestamps)" |
| 89 | cnt=$(wc -l < "${tmp_out}") |
| 90 | test $cnt == 7 |
| 91 | ok $? "Received ${cnt}/7 events (GMT absolute timestamps)" |
| 92 | |
| 93 | "${BT_BIN}" --clock-gmt --begin "2012-10-29 18:48:17.587029529" "${TRACE_PATH}" \ |
| 94 | 2>/dev/null >"${tmp_out}" |
| 95 | ok $? "Ran successfully with --begin out of range (GMT absolute timestamps)" |
| 96 | cnt=$(wc -l < "${tmp_out}") |
| 97 | test $cnt == 0 |
| 98 | ok $? "No events when begin is out of range (GMT absolute timestamps)" |
| 99 | |
| 100 | "${BT_BIN}" --clock-gmt --end "2012-10-29 16:48:17.588680018" "${TRACE_PATH}" \ |
| 101 | 2>/dev/null >"${tmp_out}" |
| 102 | ok $? "Ran successfully with --end out of range (GMT absolute timestamps)" |
| 103 | cnt=$(wc -l < "${tmp_out}") |
| 104 | test $cnt == 0 |
| 105 | ok $? "No events when end is out of range (GMT absolute timestamps)" |
| 106 | |
| 107 | |
| 108 | export TZ=EST |
| 109 | |
| 110 | "${BT_BIN}" --begin "12:48:17.587029529" --end "12:48:17.588680018" \ |
| 111 | "${TRACE_PATH}" >/dev/null 2>&1 |
| 112 | ok $? "Read a trace with the trimmer enabled (EST relative timestamps)" |
| 113 | |
| 114 | "${BT_BIN}" --begin "12:48:17.587029529" "${TRACE_PATH}" \ |
| 115 | 2>/dev/null >"${tmp_out}" |
| 116 | ok $? "Ran successfully with --begin (EST relative timestamps)" |
| 117 | cnt=$(wc -l < "${tmp_out}") |
| 118 | test $cnt == 18 |
| 119 | ok $? "Received ${cnt}/18 events (EST relative timestamps)" |
| 120 | |
| 121 | "${BT_BIN}" --end "12:48:17.588680018" "${TRACE_PATH}" \ |
| 122 | 2>/dev/null >"${tmp_out}" |
| 123 | ok $? "Ran successfully with --end (EST relative timestamps)" |
| 124 | cnt=$(wc -l < "${tmp_out}") |
| 125 | test $cnt == 9 |
| 126 | ok $? "Received ${cnt}/9 events (EST relative timestamps)" |
| 127 | |
| 128 | "${BT_BIN}" --begin "12:48:17.587029529" --end "12:48:17.588680018" \ |
| 129 | "${TRACE_PATH}" 2>/dev/null >"${tmp_out}" |
| 130 | ok $? "Ran successfully with --begin and --end (EST relative timestamps)" |
| 131 | cnt=$(wc -l < "${tmp_out}") |
| 132 | test $cnt == 7 |
| 133 | ok $? "Received ${cnt}/7 events (EST relative timestamps)" |
| 134 | |
| 135 | "${BT_BIN}" --begin "13:48:17.587029529" "${TRACE_PATH}" \ |
| 136 | 2>/dev/null >"${tmp_out}" |
| 137 | ok $? "Ran successfully with --begin out of range (EST relative timestamps)" |
| 138 | cnt=$(wc -l < "${tmp_out}") |
| 139 | test $cnt == 0 |
| 140 | ok $? "No events when begin is out of range (EST relative timestamps)" |
| 141 | |
| 142 | "${BT_BIN}" --end "11:48:17.588680018" "${TRACE_PATH}" \ |
| 143 | 2>/dev/null >"${tmp_out}" |
| 144 | ok $? "Ran successfully with --end out of range (EST relative timestamps)" |
| 145 | cnt=$(wc -l < "${tmp_out}") |
| 146 | test $cnt == 0 |
| 147 | ok $? "No events when end is out of range (EST relative timestamps)" |
| 148 | |
| 149 | |
| 150 | "${BT_BIN}" --begin "2012-10-29 12:48:17.587029529" --end "2012-10-29 12:48:17.588680018" \ |
| 151 | "${TRACE_PATH}" >/dev/null 2>&1 |
| 152 | ok $? "Read a trace with the trimmer enabled (EST absolute timestamps)" |
| 153 | |
| 154 | "${BT_BIN}" --begin "2012-10-29 12:48:17.587029529" "${TRACE_PATH}" \ |
| 155 | 2>/dev/null >"${tmp_out}" |
| 156 | ok $? "Ran successfully with --begin (EST absolute timestamps)" |
| 157 | cnt=$(wc -l < "${tmp_out}") |
| 158 | test $cnt == 18 |
| 159 | ok $? "Received ${cnt}/18 events (EST absolute timestamps)" |
| 160 | |
| 161 | "${BT_BIN}" --end "2012-10-29 12:48:17.588680018" "${TRACE_PATH}" \ |
| 162 | 2>/dev/null >"${tmp_out}" |
| 163 | ok $? "Ran successfully with --end (EST absolute timestamps)" |
| 164 | cnt=$(wc -l < "${tmp_out}") |
| 165 | test $cnt == 9 |
| 166 | ok $? "Received ${cnt}/9 events (EST absolute timestamps)" |
| 167 | |
| 168 | "${BT_BIN}" --begin "2012-10-29 12:48:17.587029529" --end "2012-10-29 12:48:17.588680018" \ |
| 169 | "${TRACE_PATH}" 2>/dev/null >"${tmp_out}" |
| 170 | ok $? "Ran successfully with --begin and --end (EST absolute timestamps)" |
| 171 | cnt=$(wc -l < "${tmp_out}") |
| 172 | test $cnt == 7 |
| 173 | ok $? "Received ${cnt}/7 events (EST absolute timestamps)" |
| 174 | |
| 175 | "${BT_BIN}" --begin "2012-10-29 13:48:17.587029529" "${TRACE_PATH}" \ |
| 176 | 2>/dev/null >"${tmp_out}" |
| 177 | ok $? "Ran successfully with --begin out of range (EST absolute timestamps)" |
| 178 | cnt=$(wc -l < "${tmp_out}") |
| 179 | test $cnt == 0 |
| 180 | ok $? "No events when begin is out of range (EST absolute timestamps)" |
| 181 | |
| 182 | "${BT_BIN}" --end "2012-10-29 11:48:17.588680018" "${TRACE_PATH}" \ |
| 183 | 2>/dev/null >"${tmp_out}" |
| 184 | ok $? "Ran successfully with --end out of range (EST absolute timestamps)" |
| 185 | cnt=$(wc -l < "${tmp_out}") |
| 186 | test $cnt == 0 |
| 187 | ok $? "No events when end is out of range (EST absolute timestamps)" |
| 188 | |
| 189 | rm "${tmp_out}" |