File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
lldb/test/API/python_api/sbmodule Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -18,8 +18,6 @@ def tearDown(self):
1818 if self .background_pid :
1919 os .kill (self .background_pid , signal .SIGKILL )
2020
21- @skipUnlessDarwin
22- @skipIfRemote
2321 def test_getname (self ):
2422 """Test the SBModule::GetName() method"""
2523 self .build ()
@@ -28,9 +26,20 @@ def test_getname(self):
2826 )
2927
3028 self .assertGreater (target .GetNumModules (), 0 )
31- module_names = {target .GetModuleAtIndex (i ).GetName () for i in range (target .GetNumModules ())}
32- self .assertIn ("a.out" , module_names )
33-
29+ for i in range (target .GetNumModules ()):
30+ module = target .GetModuleAtIndex (i )
31+ file_spec = module .GetFileSpec ()
32+ name = module .GetName ()
33+ if file_spec .IsValid () and file_spec .exists :
34+ #If file is valid and file exist, expect GetName() to be None
35+ self .assertIsNone (name , f"Expected None for module with valid file { file_spec .GetFilename ()} , got { name !r} " )
36+ else :
37+ #If no valid file, expect GetName() to be a non - empty string
38+ self .assertIsInstance (name , str )
39+ self .assertTrue (name , "Expected a non-empty name for module without a valid file" )
40+
41+ @skipUnlessDarwin
42+ @skipIfRemote
3443 def test_module_is_file_backed (self ):
3544 """Test the SBModule::IsFileBacked() method"""
3645 self .build ()
You can’t perform that action at this time.
0 commit comments