From be9e54b6298258c19fb179cee0fc3db161d4fd96 Mon Sep 17 00:00:00 2001 From: Christophe Bedard Date: Fri, 27 Dec 2019 13:23:43 -0500 Subject: [PATCH] Update Trace action test --- .../tracetools_launch/test_trace_action.py | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/tracetools_launch/test/tracetools_launch/test_trace_action.py b/tracetools_launch/test/tracetools_launch/test_trace_action.py index 9f27407..626a531 100644 --- a/tracetools_launch/test/tracetools_launch/test_trace_action.py +++ b/tracetools_launch/test/tracetools_launch/test_trace_action.py @@ -15,6 +15,7 @@ import unittest from tracetools_launch.action import Trace +from tracetools_launch.actions.ld_preload import LdPreload class TestTraceAction(unittest.TestCase): @@ -48,9 +49,34 @@ class TestTraceAction(unittest.TestCase): for events in events_lists_no_match: self.assertFalse(Trace.has_profiling_events(events)) + def test_has_ust_memory_events(self) -> None: + events_lists_match = [ + [ + 'hashtag:yopo', + 'lttng_ust_libc:malloc', + 'lttng_ust_libc:realloc', + ], + [ + 'lttng_ust_libc:still_a_match', + ], + ] + events_lists_no_match = [ + [], + [ + 'my_random:event', + 'lttng_ust_whatever' + ] + ] + for events in events_lists_match: + self.assertTrue(Trace.has_ust_memory_events(events)) + for events in events_lists_no_match: + self.assertFalse(Trace.has_ust_memory_events(events)) + def test_get_shared_lib_path(self) -> None: # Only test not finding a lib for now - self.assertIsNone(Trace.get_shared_lib_path('random_lib_that_does_not_exist_I_hope.so')) + self.assertIsNone( + LdPreload.get_shared_lib_path('random_lib_that_does_not_exist_I_hope.so') + ) if __name__ == '__main__':