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):
18
18
if self .background_pid :
19
19
os .kill (self .background_pid , signal .SIGKILL )
20
20
21
- @skipUnlessDarwin
22
- @skipIfRemote
23
21
def test_getname (self ):
24
22
"""Test the SBModule::GetName() method"""
25
23
self .build ()
@@ -28,9 +26,20 @@ def test_getname(self):
28
26
)
29
27
30
28
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
34
43
def test_module_is_file_backed (self ):
35
44
"""Test the SBModule::IsFileBacked() method"""
36
45
self .build ()
You can’t perform that action at this time.
0 commit comments