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 mydir = TestBase.compute_mydir(__file__) 16 17 # If your test case doesn't stress debug info, the 18 # set this to true. That way it won't be run once for 19 # each debug info format. 20 NO_DEBUG_INFO_TESTCASE = True 21 22 def test_get_version_zero(self): 23 """Read in a library with a version of 0.0.0. Test SBModule::GetVersion""" 24 self.yaml2obj("libDylib.dylib.yaml", self.getBuildArtifact("libDylib.dylib")) 25 self.do_test() 26 27 def do_test(self): 28 lib_name = "libDylib.dylib" 29 target = lldbutil.run_to_breakpoint_make_target(self, exe_name=lib_name) 30 module = target.FindModule(lldb.SBFileSpec(lib_name)) 31 self.assertTrue(module.IsValid(), "Didn't find the libDylib.dylib module") 32 # For now the actual version numbers are wrong for a library of 0.0.0 33 # but the previous code would crash iterating over the resultant 34 # list. So we are testing that that doesn't happen. 35 did_iterate = False 36 for elem in module.GetVersion(): 37 did_iterate = True 38 self.assertTrue(did_iterate, "Didn't get into the GetVersion loop") 39 40