+#
+# Copyright (C) 2019 EfficiOS Inc.
+#
+# 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.
+#
+
import unittest
import bt2
from utils import run_in_component_init
self.assertIsNone(sc.default_clock_class)
self.assertTrue(sc.assigns_automatic_event_class_id)
self.assertTrue(sc.assigns_automatic_stream_id)
- self.assertFalse(sc.packets_have_default_beginning_clock_snapshot)
- self.assertFalse(sc.packets_have_default_end_clock_snapshot)
+ self.assertFalse(sc.packets_have_beginning_default_clock_snapshot)
+ self.assertFalse(sc.packets_have_end_default_clock_snapshot)
+ self.assertFalse(sc.supports_discarded_events)
+ self.assertFalse(sc.discarded_events_have_default_clock_snapshots)
+ self.assertFalse(sc.supports_discarded_packets)
+ self.assertFalse(sc.discarded_packets_have_default_clock_snapshots)
def test_create_name(self):
sc = self._tc.create_stream_class(name='bozo')
with self.assertRaises(ValueError):
sc.create_event_class()
- def test_packets_have_default_beginning_clock_snapshot(self):
- sc = self._tc.create_stream_class(default_clock_class=self._cc, packets_have_default_beginning_clock_snapshot=True)
- self.assertTrue(sc.packets_have_default_beginning_clock_snapshot)
+ def test_packets_have_beginning_default_clock_snapshot(self):
+ sc = self._tc.create_stream_class(default_clock_class=self._cc, packets_have_beginning_default_clock_snapshot=True)
+ self.assertTrue(sc.packets_have_beginning_default_clock_snapshot)
- def test_packets_have_default_beginning_clock_snapshot_raises(self):
+ def test_packets_have_beginning_default_clock_snapshot_raises(self):
with self.assertRaises(TypeError):
- sc = self._tc.create_stream_class(packets_have_default_beginning_clock_snapshot="something")
+ sc = self._tc.create_stream_class(packets_have_beginning_default_clock_snapshot="something")
+
+ def test_packets_have_end_default_clock_snapshot(self):
+ sc = self._tc.create_stream_class(default_clock_class=self._cc, packets_have_end_default_clock_snapshot=True)
+ self.assertTrue(sc.packets_have_end_default_clock_snapshot)
- def test_packets_have_default_end_clock_snapshot(self):
- sc = self._tc.create_stream_class(default_clock_class=self._cc, packets_have_default_end_clock_snapshot=True)
- self.assertTrue(sc.packets_have_default_end_clock_snapshot)
+ def test_packets_have_end_default_clock_snapshot_raises(self):
+ with self.assertRaises(TypeError):
+ sc = self._tc.create_stream_class(packets_have_end_default_clock_snapshot="something")
+
+ def test_supports_discarded_events_without_cs(self):
+ sc = self._tc.create_stream_class(default_clock_class=self._cc,
+ supports_discarded_events=True)
+ self.assertTrue(sc.supports_discarded_events)
+ self.assertFalse(sc.discarded_events_have_default_clock_snapshots)
+
+ def test_supports_discarded_events_with_cs(self):
+ sc = self._tc.create_stream_class(default_clock_class=self._cc,
+ supports_discarded_events=True,
+ discarded_events_have_default_clock_snapshots=True)
+ self.assertTrue(sc.supports_discarded_events)
+ self.assertTrue(sc.discarded_events_have_default_clock_snapshots)
+
+ def test_supports_discarded_events_raises_type_error(self):
+ with self.assertRaises(TypeError):
+ sc = self._tc.create_stream_class(default_clock_class=self._cc,
+ supports_discarded_events=23)
- def test_packets_have_default_end_clock_snapshot_raises(self):
+ def test_discarded_events_have_default_cs_raises_type_error(self):
with self.assertRaises(TypeError):
- sc = self._tc.create_stream_class(packets_have_default_end_clock_snapshot="something")
+ sc = self._tc.create_stream_class(default_clock_class=self._cc,
+ discarded_events_have_default_clock_snapshots=23)
+
+ def test_does_not_support_discarded_events_raises_with_cs(self):
+ with self.assertRaises(ValueError):
+ sc = self._tc.create_stream_class(default_clock_class=self._cc,
+ discarded_events_have_default_clock_snapshots=True)
+
+ def test_supports_discarded_packets_without_cs(self):
+ sc = self._tc.create_stream_class(default_clock_class=self._cc,
+ supports_discarded_packets=True)
+ self.assertTrue(sc.supports_discarded_packets)
+ self.assertFalse(sc.discarded_packets_have_default_clock_snapshots)
+
+ def test_supports_discarded_packets_with_cs(self):
+ sc = self._tc.create_stream_class(default_clock_class=self._cc,
+ supports_discarded_packets=True,
+ discarded_packets_have_default_clock_snapshots=True)
+ self.assertTrue(sc.supports_discarded_packets)
+ self.assertTrue(sc.discarded_packets_have_default_clock_snapshots)
+
+ def test_supports_discarded_packets_raises_type_error(self):
+ with self.assertRaises(TypeError):
+ sc = self._tc.create_stream_class(default_clock_class=self._cc,
+ supports_discarded_packets=23)
+
+ def test_discarded_packets_have_default_cs_raises_type_error(self):
+ with self.assertRaises(TypeError):
+ sc = self._tc.create_stream_class(default_clock_class=self._cc,
+ discarded_packets_have_default_clock_snapshots=23)
+
+ def test_does_not_support_discarded_packets_raises_with_cs(self):
+ with self.assertRaises(ValueError):
+ sc = self._tc.create_stream_class(default_clock_class=self._cc,
+ discarded_packets_have_default_clock_snapshots=True)
def test_trace_class(self):
sc = self._tc.create_stream_class()