Revert "[ELF] Refine isExported/isPreemptible condition"
[llvm-project.git] / lldb / test / API / lang / objc / rdar-12408181 / TestRdar12408181.py
blob80942a8abd6ed2c2582c774141b7f16cf7ddddd2
1 """
2 Test that we are able to find out how many children NSWindow has
3 """
6 import lldb
7 from lldbsuite.test.decorators import *
8 from lldbsuite.test.lldbtest import *
9 from lldbsuite.test import lldbutil
12 # TODO: The Jenkins testers on OS X fail running this test because they don't
13 # have access to WindowServer so NSWindow doesn't work. We should disable this
14 # test if WindowServer isn't available.
15 # Note: Simply applying the @skipIf decorator here confuses the test harness
16 # and gives a spurious failure.
17 class Rdar12408181TestCase(TestBase):
18 def setUp(self):
19 # Call super's setUp().
20 TestBase.setUp(self)
21 # We'll use the test method name as the exe_name.
22 self.exe_name = self.testMethodName
23 # Find the line number to break inside main().
24 self.main_source = "main.m"
25 self.line = line_number(self.main_source, "// Set breakpoint here.")
27 def test_nswindow_count(self):
28 """Test that we are able to find out how many children NSWindow has."""
30 self.skipTest("Skipping this test due to timeout flakiness")
32 d = {"EXE": self.exe_name}
33 self.build(dictionary=d)
34 self.setTearDownCleanup(dictionary=d)
36 exe = self.getBuildArtifact(self.exe_name)
37 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
39 lldbutil.run_break_set_by_file_and_line(
40 self, self.main_source, self.line, num_expected_locations=1, loc_exact=True
43 self.runCmd("run", RUN_SUCCEEDED)
44 if (
45 self.frame()
46 .EvaluateExpression("(void*)_CGSDefaultConnection()")
47 .GetValueAsUnsigned()
48 != 0
50 window = self.frame().FindVariable("window")
51 window_dynamic = window.GetDynamicValue(lldb.eDynamicCanRunTarget)
52 self.assertGreater(
53 window.GetNumChildren(), 1, "NSWindow (static) only has 1 child!"
55 self.assertGreater(
56 window_dynamic.GetNumChildren(),
58 "NSWindow (dynamic) only has 1 child!",
60 self.assertTrue(
61 window.GetChildAtIndex(0).IsValid(),
62 "NSWindow (static) has an invalid child",
64 self.assertTrue(
65 window_dynamic.GetChildAtIndex(0).IsValid(),
66 "NSWindow (dynamic) has an invalid child",
68 else:
69 self.skipTest("no WindowServer connection")