1""" 2Read in a library with a version number of 0.0.0, make sure we produce a good version. 3""" 4 5 6 7import lldb 8from lldbsuite.test.decorators import * 9import lldbsuite.test.lldbutil as lldbutil 10from lldbsuite.test.lldbtest import * 11 12 13class TestGetVersionForZero(TestBase): 14 15 # If your test case doesn't stress debug info, then 16 # set this to true. That way it won't be run once for 17 # each debug info format. 18 NO_DEBUG_INFO_TESTCASE = True 19 20 def test_get_version_zero(self): 21 """Read in a library with a version of 0.0.0. Test SBModule::GetVersion""" 22 self.yaml2obj("libDylib.dylib.yaml", self.getBuildArtifact("libDylib.dylib")) 23 self.do_test() 24 25 def do_test(self): 26 lib_name = "libDylib.dylib" 27 target = lldbutil.run_to_breakpoint_make_target(self, exe_name=lib_name) 28 module = target.FindModule(lldb.SBFileSpec(lib_name)) 29 self.assertTrue(module.IsValid(), "Didn't find the libDylib.dylib module") 30 # For now the actual version numbers are wrong for a library of 0.0.0 31 # but the previous code would crash iterating over the resultant 32 # list. So we are testing that that doesn't happen. 33 did_iterate = False 34 for elem in module.GetVersion(): 35 did_iterate = True 36 self.assertTrue(did_iterate, "Didn't get into the GetVersion loop") 37 38