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