From 0fd756a43bce605875565a14c1ed1b070fa3ad94 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Thu, 6 Jun 2019 18:17:14 -0400 Subject: [PATCH] Remove everything related to the `bt2.ctf_writer` Python module This module wraps CTF writer, but is currently incomplete and would require much work to finish, as CTF writer is completely decoupled from the Babeltrace library. Since we plan to make Babeltrace 1 and Babeltrace 2 coinstallable, and that CTF writer 2 does not add many important features to CTF writer 1, we decided to postpone the development of its Python bindings to when it supports CTF 2. Signed-off-by: Philippe Proulx Change-Id: Ie8ceeac8bfcce86dec3cb426d7030ad445274cd2 Reviewed-on: https://review.lttng.org/c/babeltrace/+/1392 --- bindings/python/bt2/Makefile.am | 1 - bindings/python/bt2/bt2/__init__.py.in | 2 - bindings/python/bt2/bt2/ctf_writer.py | 315 --------------------- bindings/python/bt2/bt2/stream_class.py | 16 -- configure.ac | 1 - tests/Makefile.am | 1 - tests/lib/Makefile.am | 2 - tests/lib/ctf-writer/test_auto_populate.py | 264 ----------------- tests/lib/ctf-writer/test_ctf_writer.in | 36 --- 9 files changed, 638 deletions(-) delete mode 100644 bindings/python/bt2/bt2/ctf_writer.py delete mode 100644 tests/lib/ctf-writer/test_auto_populate.py delete mode 100644 tests/lib/ctf-writer/test_ctf_writer.in diff --git a/bindings/python/bt2/Makefile.am b/bindings/python/bt2/Makefile.am index 428588e8..31d9e177 100644 --- a/bindings/python/bt2/Makefile.am +++ b/bindings/python/bt2/Makefile.am @@ -37,7 +37,6 @@ STATIC_BINDINGS_DEPS = \ bt2/clock_snapshot.py \ bt2/component.py \ bt2/connection.py \ - bt2/ctf_writer.py \ bt2/event_class.py \ bt2/event.py \ bt2/field.py \ diff --git a/bindings/python/bt2/bt2/__init__.py.in b/bindings/python/bt2/bt2/__init__.py.in index bb970ac6..f80cf658 100644 --- a/bindings/python/bt2/bt2/__init__.py.in +++ b/bindings/python/bt2/bt2/__init__.py.in @@ -37,8 +37,6 @@ from bt2.component import _UserSinkComponent from bt2.component import _UserSourceComponent from bt2.connection import * from bt2.connection import _Connection -from bt2.ctf_writer import * -from bt2.ctf_writer import _CtfWriterStream from bt2.event import _Event from bt2.event_class import * from bt2.field_class import * diff --git a/bindings/python/bt2/bt2/ctf_writer.py b/bindings/python/bt2/bt2/ctf_writer.py deleted file mode 100644 index bbcc2b40..00000000 --- a/bindings/python/bt2/bt2/ctf_writer.py +++ /dev/null @@ -1,315 +0,0 @@ -# The MIT License (MIT) -# -# Copyright (c) 2016-2017 Philippe Proulx -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -from bt2 import native_bt, object, stream, utils -import uuid as uuidp -import bt2.event -import bt2.field -import abc -import bt2 - - -class CtfWriterClock(bt2.object._SharedObject): - def __init__(self, name, description=None, frequency=None, precision=None, - offset=None, is_absolute=None, uuid=None): - utils._check_str(name) - ptr = native_bt.ctf_clock_create(name) - - if ptr is None: - raise bt2.CreationError('cannot create CTF writer clock object') - - super().__init__(ptr) - - if description is not None: - self.description = description - - if frequency is not None: - self.frequency = frequency - - if precision is not None: - self.precision = precision - - if offset is not None: - self.offset = offset - - if is_absolute is not None: - self.is_absolute = is_absolute - - if uuid is not None: - self.uuid = uuid - - def __eq__(self, other): - if type(self) is not type(other): - # not comparing apples to apples - return False - - if self.addr == other.addr: - return True - - self_props = ( - self.name, - self.description, - self.frequency, - self.precision, - self.offset, - self.is_absolute, - self.uuid - ) - other_props = ( - other.name, - other.description, - other.frequency, - other.precision, - other.offset, - other.is_absolute, - other.uuid - ) - return self_props == other_props - - def __copy__(self): - return CtfWriterClock(name=self.name, description=self.description, - frequency=self.frequency, - precision=self.precision, offset=self.offset, - is_absolute=self.is_absolute, uuid=self.uuid) - - def __deepcopy__(self, memo): - cpy = self.__copy__() - memo[id(self)] = cpy - return cpy - - @property - def name(self): - name = native_bt.ctf_clock_get_name(self._ptr) - assert(name is not None) - return name - - @property - def description(self): - description = native_bt.ctf_clock_get_description(self._ptr) - return description - - @description.setter - def description(self, description): - utils._check_str(description) - ret = native_bt.ctf_clock_set_description(self._ptr, description) - utils._handle_ret(ret, "cannot set CTF writer clock object's description") - - @property - def frequency(self): - frequency = native_bt.ctf_clock_get_frequency(self._ptr) - assert(frequency >= 1) - return frequency - - @frequency.setter - def frequency(self, frequency): - utils._check_uint64(frequency) - ret = native_bt.ctf_clock_set_frequency(self._ptr, frequency) - utils._handle_ret(ret, "cannot set CTF writer clock object's frequency") - - @property - def precision(self): - precision = native_bt.ctf_clock_get_precision(self._ptr) - assert(precision >= 0) - return precision - - @precision.setter - def precision(self, precision): - utils._check_uint64(precision) - ret = native_bt.ctf_clock_set_precision(self._ptr, precision) - utils._handle_ret(ret, "cannot set CTF writer clock object's precision") - - @property - def offset(self): - ret, offset_s = native_bt.ctf_clock_get_offset_s(self._ptr) - assert(ret == 0) - ret, offset_cycles = native_bt.ctf_clock_get_offset(self._ptr) - assert(ret == 0) - return bt2.ClockClassOffset(offset_s, offset_cycles) - - @offset.setter - def offset(self, offset): - utils._check_type(offset, bt2.ClockClassOffset) - ret = native_bt.ctf_clock_set_offset_s(self._ptr, offset.seconds) - utils._handle_ret(ret, "cannot set CTF writer clock object's offset (seconds)") - ret = native_bt.ctf_clock_set_offset(self._ptr, offset.cycles) - utils._handle_ret(ret, "cannot set CTF writer clock object's offset (cycles)") - - @property - def is_absolute(self): - is_absolute = native_bt.ctf_clock_get_is_absolute(self._ptr) - assert(is_absolute >= 0) - return is_absolute > 0 - - @is_absolute.setter - def is_absolute(self, is_absolute): - utils._check_bool(is_absolute) - ret = native_bt.ctf_clock_set_is_absolute(self._ptr, int(is_absolute)) - utils._handle_ret(ret, "cannot set CTF writer clock object's absoluteness") - - @property - def uuid(self): - uuid_bytes = native_bt.ctf_clock_get_uuid(self._ptr) - assert(uuid_bytes is not None) - return uuidp.UUID(bytes=uuid_bytes) - - @uuid.setter - def uuid(self, uuid): - utils._check_type(uuid, uuidp.UUID) - ret = native_bt.ctf_clock_set_uuid(self._ptr, uuid.bytes) - utils._handle_ret(ret, "cannot set CTF writer clock object's UUID") - - def _time(self, time): - utils._check_int64(time) - ret = native_bt.ctf_clock_set_time(self._ptr, time) - - time = property(fset=_time) - - -class _CtfWriterStream: - @property - def discarded_events_count(self): - ret, count = native_bt.stream_get_discarded_events_count(self._ptr) - utils._handle_ret(ret, "cannot get CTF writer stream object's discarded events count") - return count - - def append_discarded_events(self, count): - utils._check_uint64(count) - native_bt.stream_append_discarded_events(self._ptr, count) - - def append_event(self, event): - utils._check_type(event, bt2.event._Event) - ret = native_bt.stream_append_event(self._ptr, event._ptr) - utils._handle_ret(ret, 'cannot append event object to CTF writer stream object') - - def flush(self): - ret = native_bt.stream_flush(self._ptr) - utils._handle_ret(ret, 'cannot flush CTF writer stream object') - - @property - def packet_header_field(self): - field_ptr = native_bt.stream_get_packet_header(self._ptr) - - if field_ptr is None: - return - - return bt2.field._create_from_ptr(field_ptr) - - @packet_header_field.setter - def packet_header_field(self, packet_header_field): - packet_header_field_ptr = None - - if packet_header_field is not None: - utils._check_type(packet_header_field, bt2.field._Field) - packet_header_field_ptr = packet_header_field._ptr - - ret = native_bt.stream_set_packet_header(self._ptr, - packet_header_field_ptr) - utils._handle_ret(ret, "cannot set CTF writer stream object's packet header field") - - @property - def packet_context_field(self): - field_ptr = native_bt.stream_get_packet_context(self._ptr) - - if field_ptr is None: - return - - return bt2.field._create_from_ptr(field_ptr) - - @packet_context_field.setter - def packet_context_field(self, packet_context_field): - packet_context_field_ptr = None - - if packet_context_field is not None: - utils._check_type(packet_context_field, bt2.field._Field) - packet_context_field_ptr = packet_context_field._ptr - - ret = native_bt.stream_set_packet_context(self._ptr, - packet_context_field_ptr) - utils._handle_ret(ret, "cannot set CTF writer stream object's packet context field") - - def __eq__(self, other): - if type(other) is not type(self): - return False - - if self.addr == other.addr: - return True - - if not _StreamBase.__eq__(self, other): - return False - - self_props = ( - self.discarded_events_count, - self.packet_header_field, - self.packet_context_field, - ) - other_props = ( - other.discarded_events_count, - other.packet_header_field, - other.packet_context_field, - ) - return self_props == other_props - - def _copy(self, copy_func): - cpy = self.stream_class(self.name) - cpy.append_discarded_events(self.discarded_events_count) - cpy.packet_header_field = copy_func(self.packet_header_field) - cpy.packet_context_field = copy_func(self.packet_context_field) - return cpy - - def __copy__(self): - return self._copy(copy.copy) - - def __deepcopy__(self, memo): - cpy = self._copy(copy.deepcopy) - memo[id(self)] = cpy - return cpy - - -class CtfWriter(bt2.object._SharedObject): - def __init__(self, path): - utils._check_str(path) - ptr = native_bt.ctf_writer_create(path) - - if ptr is None: - raise bt2.CreationError('cannot create CTF writer object') - - super().__init__(ptr) - - @property - def trace(self): - trace_ptr = native_bt.ctf_writer_get_trace(self._ptr) - assert(trace_ptr) - return bt2.Trace._create_from_ptr(trace_ptr) - - @property - def metadata_string(self): - metadata_string = native_bt.ctf_writer_get_metadata_string(self._ptr) - assert(metadata_string is not None) - return metadata_string - - def flush_metadata(self): - native_bt.ctf_writer_flush_metadata(self._ptr) - - def add_clock(self, clock): - utils._check_type(clock, CtfWriterClock) - ret = native_bt.ctf_writer_add_clock(self._ptr, clock._ptr) - utils._handle_ret(ret, 'cannot add CTF writer clock object to CTF writer object') diff --git a/bindings/python/bt2/bt2/stream_class.py b/bindings/python/bt2/bt2/stream_class.py index 048cb70d..684b952b 100644 --- a/bindings/python/bt2/bt2/stream_class.py +++ b/bindings/python/bt2/bt2/stream_class.py @@ -23,7 +23,6 @@ from bt2 import native_bt, object, utils import bt2.field_class import collections.abc -import bt2.ctf_writer import bt2.stream import bt2 @@ -197,21 +196,6 @@ class StreamClass(object._SharedObject, collections.abc.Mapping): ret = native_bt.stream_class_set_id(self._ptr, id) utils._handle_ret(ret, "cannot set stream class object's ID") - @property - def clock(self): - clock_ptr = native_bt.stream_class_get_clock(self._ptr) - - if clock_ptr is None: - return - - return bt2.ctf_writer.CtfWriterClock._create_from_ptr(clock_ptr) - - @clock.setter - def clock(self, clock): - utils._check_type(clock, bt2.ctf_writer.CtfWriterClock) - ret = native_bt.stream_class_set_clock(self._ptr, clock._ptr) - utils._handle_ret(ret, "cannot set stream class object's CTF writer clock object") - @property def packet_context_field_class(self): fc_ptr = native_bt.stream_class_borrow_packet_context_field_class_const(self._ptr) diff --git a/configure.ac b/configure.ac index 6789ef6c..51c2ab59 100644 --- a/configure.ac +++ b/configure.ac @@ -797,7 +797,6 @@ AC_CONFIG_FILES([tests/cli/test_trimmer], [chmod +x tests/cli/test_trimmer]) AC_CONFIG_FILES([tests/lib/test_ctf_writer_complete], [chmod +x tests/lib/test_ctf_writer_complete]) AC_CONFIG_FILES([tests/lib/test_plugin_complete], [chmod +x tests/lib/test_plugin_complete]) AC_CONFIG_FILES([tests/lib/trace-ir/test_trace_ir], [chmod +x tests/lib/trace-ir/test_trace_ir]) -AC_CONFIG_FILES([tests/lib/ctf-writer/test_ctf_writer], [chmod +x tests/lib/ctf-writer/test_ctf_writer]) AC_CONFIG_FILES([tests/plugins/ctf/test_ctf_plugin], [chmod +x tests/plugins/ctf/test_ctf_plugin]) AC_CONFIG_FILES([tests/plugins/test_utils_muxer_complete], [chmod +x tests/plugins/test_utils_muxer_complete]) AC_CONFIG_FILES([tests/plugins/test_lttng_utils_debug_info], [chmod +x tests/plugins/test_lttng_utils_debug_info]) diff --git a/tests/Makefile.am b/tests/Makefile.am index 0a8f01c9..344bc646 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -59,7 +59,6 @@ endif if ENABLE_PYTHON_BINDINGS TESTS_LIB += lib/trace-ir/test_trace_ir -TESTS_LIB += lib/ctf-writer/test_ctf_writer endif TESTS_PLUGINS = diff --git a/tests/lib/Makefile.am b/tests/lib/Makefile.am index e4930d88..4ef581b2 100644 --- a/tests/lib/Makefile.am +++ b/tests/lib/Makefile.am @@ -4,8 +4,6 @@ AM_CPPFLAGS += -I$(top_srcdir)/tests/utils LIBTAP=$(top_builddir)/tests/utils/tap/libtap.la -dist_check_SCRIPTS = ctf-writer/test_auto_populate.py - libtestcommon_la_SOURCES = common.c common.h noinst_LTLIBRARIES = libtestcommon.la diff --git a/tests/lib/ctf-writer/test_auto_populate.py b/tests/lib/ctf-writer/test_auto_populate.py deleted file mode 100644 index c71532cb..00000000 --- a/tests/lib/ctf-writer/test_auto_populate.py +++ /dev/null @@ -1,264 +0,0 @@ -import tempfile -import unittest -import bt2 -import shutil - - -@unittest.skip("this is broken") -class AutoPopulatePacketContextTimestampsTestCase(unittest.TestCase): - def setUp(self): - self._trace_path = tempfile.mkdtemp() - self._writer = bt2.CtfWriter(self._trace_path) - self._cc = bt2.ClockClass('default', int(1e9)) - self._writer.trace.add_clock_class(self._cc) - self._sc = bt2.StreamClass() - pcft = bt2.StructureFieldType() - pcft.append_field('packet_size', bt2.IntegerFieldType(32)) - pcft.append_field('content_size', bt2.IntegerFieldType(32)) - pcft.append_field('timestamp_begin', bt2.IntegerFieldType(64, mapped_clock_class=self._cc)) - pcft.append_field('timestamp_end', bt2.IntegerFieldType(64, mapped_clock_class=self._cc)) - self._sc.packet_context_field_type = pcft - - def tearDown(self): - shutil.rmtree(self._trace_path) - - def _get_trace_notifs(self): - del self._cc - del self._sc - del self._ec - del self._stream - del self._writer - specs = [bt2.ComponentSpec('ctf', 'fs', self._trace_path)] - notif_iter = bt2.TraceCollectionNotificationIterator(specs) - return list(notif_iter) - - def _complete_sc(self): - self._sc.add_event_class(self._ec) - self._writer.trace.add_stream_class(self._sc) - self._stream = self._sc() - - def _complete_sc_event_simple_ts(self): - ehft = bt2.StructureFieldType() - ehft.append_field('id', bt2.IntegerFieldType(32)) - ehft.append_field('timestamp', bt2.IntegerFieldType(16, mapped_clock_class=self._cc)) - self._sc.event_header_field_type = ehft - self._ec = bt2.EventClass('evt') - payloadft = bt2.StructureFieldType() - payloadft.append_field('value', bt2.IntegerFieldType(32)) - self._ec.payload_field_type = payloadft - self._complete_sc() - - def _complete_sc_event_ts_in_payload(self): - ehft = bt2.StructureFieldType() - ehft.append_field('id', bt2.IntegerFieldType(32)) - ehft.append_field('timestamp', bt2.IntegerFieldType(16, mapped_clock_class=self._cc)) - self._sc.event_header_field_type = ehft - self._ec = bt2.EventClass('evt') - payloadft = bt2.StructureFieldType() - payloadft.append_field('value', bt2.IntegerFieldType(32)) - payloadft.append_field('a_ts', bt2.IntegerFieldType(8, mapped_clock_class=self._cc)) - self._ec.payload_field_type = payloadft - self._complete_sc() - - def _append_event_simple_ts(self, ts): - evt = self._ec() - evt.header_field['timestamp'] = ts - evt.payload_field['value'] = 23 - self._stream.append_event(evt) - - def _append_event_ts_in_payload(self, header_ts, payload_ts): - evt = self._ec() - evt.header_field['timestamp'] = header_ts - evt.payload_field['value'] = 23 - evt.payload_field['a_ts'] = payload_ts - self._stream.append_event(evt) - - def _set_ts_begin_end(self, ts_begin=None, ts_end=None): - if ts_begin is not None: - self._stream.packet_context_field['timestamp_begin'] = ts_begin - - if ts_end is not None: - self._stream.packet_context_field['timestamp_end'] = ts_end - - def _get_packet_ts_begin_end(self, notifs): - ts_begin_end_list = [] - - for notif in notifs: - if type(notif) is bt2.PacketBeginningNotification: - ts_begin_end_list.append(( - int(notif.packet.context_field['timestamp_begin']), - int(notif.packet.context_field['timestamp_end']), - )) - - return ts_begin_end_list - - def test_ts_inc(self): - self._complete_sc_event_simple_ts() - self._append_event_simple_ts(12) - self._append_event_simple_ts(144) - self._stream.flush() - ts_begin_end_list = self._get_packet_ts_begin_end(self._get_trace_notifs()) - self.assertEqual(ts_begin_end_list[0][0], 0) - self.assertEqual(ts_begin_end_list[0][1], 144) - - def test_ts_equal(self): - self._complete_sc_event_simple_ts() - self._append_event_simple_ts(12) - self._append_event_simple_ts(144) - self._append_event_simple_ts(144) - self._stream.flush() - ts_begin_end_list = self._get_packet_ts_begin_end(self._get_trace_notifs()) - self.assertEqual(ts_begin_end_list[0][0], 0) - self.assertEqual(ts_begin_end_list[0][1], 144) - - def test_ts_wraps(self): - self._complete_sc_event_simple_ts() - self._append_event_simple_ts(12) - self._append_event_simple_ts(144) - self._append_event_simple_ts(11) - self._stream.flush() - ts_begin_end_list = self._get_packet_ts_begin_end(self._get_trace_notifs()) - self.assertEqual(ts_begin_end_list[0][0], 0) - self.assertEqual(ts_begin_end_list[0][1], 65547) - - def test_ts_begin_from_0(self): - self._complete_sc_event_simple_ts() - self._append_event_simple_ts(12) - self._append_event_simple_ts(144) - self._stream.flush() - ts_begin_end_list = self._get_packet_ts_begin_end(self._get_trace_notifs()) - self.assertEqual(ts_begin_end_list[0][0], 0) - self.assertEqual(ts_begin_end_list[0][1], 144) - - def test_ts_begin_from_last_ts_end(self): - self._complete_sc_event_simple_ts() - self._append_event_simple_ts(12) - self._append_event_simple_ts(144) - self._stream.flush() - self._append_event_simple_ts(2001) - self._append_event_simple_ts(3500) - self._stream.flush() - ts_begin_end_list = self._get_packet_ts_begin_end(self._get_trace_notifs()) - self.assertEqual(ts_begin_end_list[0][0], 0) - self.assertEqual(ts_begin_end_list[0][1], 144) - self.assertEqual(ts_begin_end_list[1][0], 144) - self.assertEqual(ts_begin_end_list[1][1], 3500) - - def test_ts_begin_from_provided(self): - self._complete_sc_event_simple_ts() - self._set_ts_begin_end(ts_begin=17) - self._append_event_simple_ts(11) - self._append_event_simple_ts(15) - self._stream.flush() - ts_begin_end_list = self._get_packet_ts_begin_end(self._get_trace_notifs()) - self.assertEqual(ts_begin_end_list[0][0], 17) - self.assertEqual(ts_begin_end_list[0][1], 65551) - - def test_ts_end_from_provided(self): - self._complete_sc_event_simple_ts() - self._set_ts_begin_end(ts_end=1001) - self._append_event_simple_ts(11) - self._append_event_simple_ts(15) - self._stream.flush() - ts_begin_end_list = self._get_packet_ts_begin_end(self._get_trace_notifs()) - self.assertEqual(ts_begin_end_list[0][0], 0) - self.assertEqual(ts_begin_end_list[0][1], 1001) - - def test_ts_end_from_provided_equal(self): - self._complete_sc_event_simple_ts() - self._set_ts_begin_end(ts_end=1001) - self._append_event_simple_ts(11) - self._append_event_simple_ts(1001) - self._stream.flush() - ts_begin_end_list = self._get_packet_ts_begin_end(self._get_trace_notifs()) - self.assertEqual(ts_begin_end_list[0][0], 0) - self.assertEqual(ts_begin_end_list[0][1], 1001) - - def test_ts_end_from_provided_too_small(self): - self._complete_sc_event_simple_ts() - self._set_ts_begin_end(ts_end=1001) - self._append_event_simple_ts(11) - self._append_event_simple_ts(1002) - - with self.assertRaises(bt2.Error): - self._stream.flush() - - def test_ts_begin_provided_equal_last_ts_end_two_packets(self): - self._complete_sc_event_simple_ts() - self._append_event_simple_ts(12) - self._append_event_simple_ts(1001) - self._stream.flush() - self._set_ts_begin_end(ts_begin=1001) - self._append_event_simple_ts(2001) - self._append_event_simple_ts(3500) - self._stream.flush() - ts_begin_end_list = self._get_packet_ts_begin_end(self._get_trace_notifs()) - self.assertEqual(ts_begin_end_list[0][0], 0) - self.assertEqual(ts_begin_end_list[0][1], 1001) - self.assertEqual(ts_begin_end_list[1][0], 1001) - self.assertEqual(ts_begin_end_list[1][1], 3500) - - def test_ts_begin_provided_less_than_last_ts_end_two_packets(self): - self._complete_sc_event_simple_ts() - self._append_event_simple_ts(12) - self._append_event_simple_ts(1001) - self._stream.flush() - self._set_ts_begin_end(ts_begin=1000) - self._append_event_simple_ts(2001) - self._append_event_simple_ts(3500) - - with self.assertRaises(bt2.Error): - self._stream.flush() - - def test_ts_end_from_value_event_payload(self): - self._complete_sc_event_ts_in_payload() - self._append_event_ts_in_payload(11, 15) - self._append_event_ts_in_payload(5, 10) - self._append_event_ts_in_payload(18, 10) - self._stream.flush() - ts_begin_end_list = self._get_packet_ts_begin_end(self._get_trace_notifs()) - self.assertEqual(ts_begin_end_list[0][0], 0) - self.assertEqual(ts_begin_end_list[0][1], 65802) - - def test_empty_packet_auto_ts_begin_end(self): - self._complete_sc_event_simple_ts() - self._stream.flush() - ts_begin_end_list = self._get_packet_ts_begin_end(self._get_trace_notifs()) - self.assertEqual(ts_begin_end_list[0][0], 0) - self.assertEqual(ts_begin_end_list[0][1], 0) - - def test_empty_packet_provided_ts_begin(self): - self._complete_sc_event_simple_ts() - self._set_ts_begin_end(ts_begin=1001) - self._stream.flush() - ts_begin_end_list = self._get_packet_ts_begin_end(self._get_trace_notifs()) - self.assertEqual(ts_begin_end_list[0][0], 1001) - self.assertEqual(ts_begin_end_list[0][1], 1001) - - def test_empty_packet_provided_ts_end(self): - self._complete_sc_event_simple_ts() - self._set_ts_begin_end(ts_end=1001) - self._stream.flush() - ts_begin_end_list = self._get_packet_ts_begin_end(self._get_trace_notifs()) - self.assertEqual(ts_begin_end_list[0][0], 0) - self.assertEqual(ts_begin_end_list[0][1], 1001) - - def test_empty_packet_provided_ts_begin_end(self): - self._complete_sc_event_simple_ts() - self._set_ts_begin_end(1001, 3003) - self._stream.flush() - ts_begin_end_list = self._get_packet_ts_begin_end(self._get_trace_notifs()) - self.assertEqual(ts_begin_end_list[0][0], 1001) - self.assertEqual(ts_begin_end_list[0][1], 3003) - - def test_empty_packet_ts_begin_from_last_ts_end(self): - self._complete_sc_event_simple_ts() - self._set_ts_begin_end(1001, 3003) - self._stream.flush() - self._set_ts_begin_end(ts_end=6000) - self._stream.flush() - ts_begin_end_list = self._get_packet_ts_begin_end(self._get_trace_notifs()) - self.assertEqual(ts_begin_end_list[0][0], 1001) - self.assertEqual(ts_begin_end_list[0][1], 3003) - self.assertEqual(ts_begin_end_list[1][0], 3003) - self.assertEqual(ts_begin_end_list[1][1], 6000) diff --git a/tests/lib/ctf-writer/test_ctf_writer.in b/tests/lib/ctf-writer/test_ctf_writer.in deleted file mode 100644 index 6cdb7c41..00000000 --- a/tests/lib/ctf-writer/test_ctf_writer.in +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2017 - Philippe Proulx -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; only version 2 -# of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# - -NO_SH_TAP=1 -. "@abs_top_builddir@/tests/utils/common.sh" - -PYTHON_BUILD_DIR="${BT_BUILD_PATH}/bindings/python/bt2/build/build_lib" -TESTS_UTILS_PYTHON_DIR="${BT_SRC_PATH}/tests/utils/python" -TESTRUNNER_PY="${BT_SRC_PATH}/tests/utils/python/testrunner.py" -THIS_DIR="${BT_SRC_PATH}/tests/lib/ctf-writer" - -if [ "x${MSYSTEM}" != "x" ]; then - export PATH="${BT_BUILD_PATH}/lib/.libs:${PATH}" -else - export LD_LIBRARY_PATH="${BT_BUILD_PATH}/lib/.libs:${LD_LIBRARY_PATH}" -fi - -PYTHONPATH="${PYTHON_BUILD_DIR}:${TESTS_UTILS_PYTHON_DIR}" \ - "@PYTHON@" "${TESTRUNNER_PY}" "${THIS_DIR}" -exit $? -- 2.34.1