Exemplo n.º 1
0
 def test_iter_no_intersection_end(self):
     specs = [bt2.ComponentSpec('ctf', 'fs', _3EVENTS_INTERSECT_TRACE_PATH)]
     notif_iter = bt2.TraceCollectionNotificationIterator(
         specs,
         notification_types=[bt2.EventNotification],
         end=13515309.000000075)
     self.assertEqual(len(list(notif_iter)), 5)
Exemplo n.º 2
0
 def test_iter_intersection_subscribe(self):
     specs = [bt2.ComponentSpec('ctf', 'fs', _3EVENTS_INTERSECT_TRACE_PATH)]
     notif_iter = bt2.TraceCollectionNotificationIterator(
         specs,
         stream_intersection_mode=True,
         notification_types=[bt2.EventNotification])
     self.assertEqual(len(list(notif_iter)), 3)
Exemplo n.º 3
0
    def test_iter_intersection_no_path_param(self):
        specs = [bt2.ComponentSpec('text', 'dmesg', {'read-from-stdin': True})]

        with self.assertRaises(bt2.Error):
            notif_iter = bt2.TraceCollectionNotificationIterator(
                specs,
                stream_intersection_mode=True,
                notification_types=[bt2.EventNotification])
Exemplo n.º 4
0
 def test_iter_custom_filter(self):
     src_spec = bt2.ComponentSpec('ctf', 'fs',
                                  _3EVENTS_INTERSECT_TRACE_PATH)
     flt_spec = bt2.ComponentSpec('utils', 'trimmer', {
         'end': 13515309000000075,
     })
     notif_iter = bt2.TraceCollectionNotificationIterator(
         src_spec, flt_spec, notification_types=[bt2.EventNotification])
     self.assertEqual(len(list(notif_iter)), 5)
Exemplo n.º 5
0
 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 _get_event_declarations(self):
        notif_iter = bt2.TraceCollectionNotificationIterator(
            [bt2.ComponentSpec('ctf', 'fs', self._path)])

        # raises if the trace contains no streams
        first_notif = next(notif_iter)
        assert (type(first_notif) is bt2.StreamBeginningNotification)
        trace = first_notif.stream.stream_class.trace
        ec_iters = [sc.values() for sc in trace.values()]
        return map(reader_event_declaration._create_event_declaration,
                   itertools.chain(*ec_iters))
 def test_debug_info(self):
     debug_info_data_dir = os.environ['DEBUG_INFO_DATA_DIR']
     trace_path = os.path.join(debug_info_data_dir, 'trace')
     target_prefix = os.path.join(debug_info_data_dir, '..', '..')
     src = bt2.ComponentSpec('ctf', 'fs', trace_path)
     flt = bt2.ComponentSpec('lttng-utils', 'debug-info', {
         'target-prefix': target_prefix,
     })
     it = bt2.TraceCollectionNotificationIterator(src, flt,
                                                  [bt2.EventNotification])
     notifs = list(it)
     debug_info = notifs[2].event['debug_info']
     self.assertEqual(debug_info['bin'], 'libhello_so+0x14d4')
     self.assertEqual(debug_info['func'], 'foo+0xa9')
     self.assertEqual(debug_info['src'], 'libhello.c:7')
     debug_info = notifs[3].event['debug_info']
     self.assertEqual(debug_info['bin'], 'libhello_so+0x15a6')
     self.assertEqual(debug_info['func'], 'bar+0xa9')
     self.assertEqual(debug_info['src'], 'libhello.c:13')
Exemplo n.º 8
0
 def test_iter_specs_not_list(self):
     spec = bt2.ComponentSpec('ctf', 'fs', _3EVENTS_INTERSECT_TRACE_PATH)
     notif_iter = bt2.TraceCollectionNotificationIterator(
         spec, notification_types=[bt2.EventNotification])
     self.assertEqual(len(list(notif_iter)), 8)
Exemplo n.º 9
0
 def test_iter_no_intersection(self):
     specs = [bt2.ComponentSpec('ctf', 'fs', _3EVENTS_INTERSECT_TRACE_PATH)]
     notif_iter = bt2.TraceCollectionNotificationIterator(specs)
     self.assertEqual(len(list(notif_iter)), 28)
Exemplo n.º 10
0
 def test_create_end_datetime(self):
     specs = [bt2.ComponentSpec('ctf', 'fs', _3EVENTS_INTERSECT_TRACE_PATH)]
     notif_iter = bt2.TraceCollectionNotificationIterator(
         specs, end=datetime.datetime.now())
Exemplo n.º 11
0
 def test_create_begin_s(self):
     specs = [bt2.ComponentSpec('ctf', 'fs', _3EVENTS_INTERSECT_TRACE_PATH)]
     notif_iter = bt2.TraceCollectionNotificationIterator(
         specs, begin=19457.918232)
Exemplo n.º 12
0
    def test_create_no_such_plugin(self):
        specs = [bt2.ComponentSpec('77', '101', _3EVENTS_INTERSECT_TRACE_PATH)]

        with self.assertRaises(bt2.Error):
            notif_iter = bt2.TraceCollectionNotificationIterator(specs)
Exemplo n.º 13
0
    def test_create_wrong_end_type(self):
        specs = [bt2.ComponentSpec('ctf', 'fs', _3EVENTS_INTERSECT_TRACE_PATH)]

        with self.assertRaises(TypeError):
            notif_iter = bt2.TraceCollectionNotificationIterator(specs,
                                                                 begin='lel')