--- /dev/null
+/* CTF 1.8 */
+
+/* This was generated by a Babeltrace `sink.ctf.fs` component. */
+
+trace {
+ major = 1;
+ minor = 8;
+ uuid = "1c810767-575e-4c4e-afa1-5d3e15081cb9";
+ byte_order = le;
+ packet.header := struct {
+ integer { size = 32; align = 8; base = x; } magic;
+ integer { size = 8; align = 8; } uuid[16];
+ integer { size = 64; align = 8; } stream_id;
+ integer { size = 64; align = 8; } stream_instance_id;
+ } align(8);
+};
+
+clock {
+ name = default;
+ freq = 1000000000;
+ precision = 0;
+ offset_s = 0;
+ offset = 0;
+ absolute = true;
+};
+
+stream {
+ id = 0;
+ packet.context := struct {
+ integer { size = 64; align = 8; } packet_size;
+ integer { size = 64; align = 8; } content_size;
+ integer { size = 64; align = 8; map = clock.default.value; } timestamp_begin;
+ integer { size = 64; align = 8; map = clock.default.value; } timestamp_end;
+ integer { size = 64; align = 8; } packet_seq_num;
+ } align(8);
+
+ event.header := struct {
+ integer { size = 64; align = 8; } id;
+ integer { size = 64; align = 8; map = clock.default.value; } timestamp;
+ } align(8);
+};
+
+event {
+ name = "my-event";
+ stream_id = 0;
+ id = 0;
+};
+
--- /dev/null
+Trace class:
+ Stream class (ID 0):
+ Supports packets: Yes
+ Packets have beginning default clock snapshot: Yes
+ Packets have end default clock snapshot: Yes
+ Supports discarded events: No
+ Supports discarded packets: Yes
+ Discarded packets have default clock snapshots: Yes
+ Default clock class:
+ Name: default
+ Frequency (Hz): 1,000,000,000
+ Precision (cycles): 0
+ Offset (s): 0
+ Offset (cycles): 0
+ Origin is Unix epoch: Yes
+ Event class `my-event` (ID 0):
+
+[Unknown]
+{Trace 0, Stream class ID 0, Stream ID 0}
+Stream beginning:
+ Name: stream-0
+ Trace:
+ UUID: 1c810767-575e-4c4e-afa1-5d3e15081cb9
+ Stream (ID 0, Class ID 0)
+
+[0 cycles, 0 ns from origin]
+{Trace 0, Stream class ID 0, Stream ID 0}
+Packet beginning
+
+[10 cycles, 10 ns from origin]
+{Trace 0, Stream class ID 0, Stream ID 0}
+Event `my-event` (Class ID 0):
+
+[20 cycles, 20 ns from origin]
+{Trace 0, Stream class ID 0, Stream ID 0}
+Packet end
+
+[80 cycles, 80 ns from origin]
+Message iterator inactivity:
+ Clock class:
+ Name: default
+ Frequency (Hz): 1,000,000,000
+ Precision (cycles): 0
+ Offset (s): 0
+ Offset (cycles): 0
+ Origin is Unix epoch: Yes
+
+[80 cycles, 80 ns from origin]
+[121 cycles, 121 ns from origin]
+{Trace 0, Stream class ID 0, Stream ID 0}
+Discarded packets (7 packets)
+
+[121 cycles, 121 ns from origin]
+{Trace 0, Stream class ID 0, Stream ID 0}
+Packet beginning
+
+[133 cycles, 133 ns from origin]
+{Trace 0, Stream class ID 0, Stream ID 0}
+Event `my-event` (Class ID 0):
+
+[140 cycles, 140 ns from origin]
+{Trace 0, Stream class ID 0, Stream ID 0}
+Packet end
+
+[Unknown]
+{Trace 0, Stream class ID 0, Stream ID 0}
+Stream end
--- /dev/null
+[
+ {
+ "name": "7_lost_between_2_with_index",
+ "id": 0,
+ "hostname": "hostname",
+ "live-timer-freq": 1,
+ "client-count": 0,
+ "traces": [
+ {
+ "path": "packet_seq_num/7_lost_between_2_with_index/",
+ "beacons": {
+ "stream_0": [ 80 ]
+ }
+ }
+ ]
+ }
+]
rm -f "$expected_stderr"
}
-plan_tests 12
+test_inactivity_discarded_packet() {
+ # Attach and consume data from a multi-packet trace with discarded
+ # packets and emit an inactivity beacon during the discarded packets
+ # period.
+ #
+ # | pkt seq:0 |<-------discarded packets------>| pkt seq:8 |
+ # 0 20 121 140
+ #
+ # This test was introduced to cover the following bug:
+ #
+ # When reading this type of trace locally, the CTF source is expected
+ # to introduce a "Discarded packets" message between packets 0 and 8.
+ # The timestamps of this message are [pkt0.end_ts, pkt8.begin_ts].
+ #
+ # In the context of a live source, the tracer could report an inactivity
+ # period during the interval of the "Discarded packets" message.
+ # Those messages eventually translate into a
+ # "Iterator inactivity" message with a timestamp set at the end of the
+ # inactivity period.
+ #
+ # If the tracer reports an inactivity period that ends at a point
+ # between pkt0 and pkt7 (resulting in an "Iterator inactivity" message),
+ # the live source could send a "Discarded packets" message that starts
+ # before the preceding "Iterator inactivity" message. This would break
+ # the monotonicity constraint of the graph.
+ local test_text="CLI attach and fetch from single-domains session - inactivity discarded packet"
+ local cli_args_template="-i lttng-live net://localhost:@PORT@/host/hostname/7_lost_between_2_with_index -c sink.text.details"
+ local sessions_file="$test_data_dir/inactivity_discarded_packet.json"
+ local server_args="--sessions-filename '$sessions_file'"
+ local expected_stdout="$test_data_dir/inactivity_discarded_packet.expect"
+ local expected_stderr
+
+ # Empty file for stderr expected
+ expected_stderr="$(mktemp -t test_live_inactivity_discarded_packet_stderr_expected.XXXXXX)"
+
+ run_test "$test_text" "$cli_args_template" "$server_args" "$expected_stdout" "$expected_stderr"
+
+ rm -f "$expected_stderr"
+}
+
+plan_tests 14
test_list_sessions
test_base
test_multi_domains
test_rate_limited
test_compare_to_ctf_fs
+test_inactivity_discarded_packet