Update Trace action test
This commit is contained in:
		
							parent
							
								
									99a656a5c6
								
							
						
					
					
						commit
						be9e54b629
					
				
					 1 changed files with 27 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -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__':
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue