[mlir][acc] Introduce MappableType interface (#122146)
[llvm-project.git] / lldb / test / API / lang / objc / modules-app-update / TestClangModulesAppUpdate.py
blob0d98a1f2d3c1a673011a8152fe97d7106dc96500
1 import os
2 import shutil
4 import lldb
5 from lldbsuite.test.decorators import *
6 from lldbsuite.test.lldbtest import *
7 from lldbsuite.test import lldbutil
10 class TestClangModuleAppUpdate(TestBase):
11 @add_test_categories(["gmodules"])
12 def test_rebuild_app_modules_untouched(self):
13 with open(self.getBuildArtifact("module.modulemap"), "w") as f:
14 f.write(
15 """
16 module Foo { header "f.h" }
17 """
19 with open(self.getBuildArtifact("f.h"), "w") as f:
20 f.write(
21 """
22 @import ObjectiveC;
23 @interface Foo : NSObject {
24 int i;
26 +(instancetype)init;
27 @end
28 """
31 mod_cache = self.getBuildArtifact("private-module-cache")
32 import os
34 if os.path.isdir(mod_cache):
35 shutil.rmtree(mod_cache)
36 self.build()
37 self.assertTrue(os.path.isdir(mod_cache), "module cache exists")
39 target, process, _, bkpt = lldbutil.run_to_source_breakpoint(
40 self, "break here", lldb.SBFileSpec("main.m")
42 bar = target.FindTypes("Bar").GetTypeAtIndex(0)
43 foo = bar.GetDirectBaseClassAtIndex(0).GetType()
44 self.assertEqual(foo.GetNumberOfFields(), 1)
45 self.assertEqual(foo.GetFieldAtIndex(0).GetName(), "i")
47 # Rebuild.
48 process.Kill()
49 os.remove(self.getBuildArtifact("main.o"))
50 os.remove(self.getBuildArtifact("a.out"))
51 self.build()
53 # Reattach.
54 target, process, _, _ = lldbutil.run_to_breakpoint_do_run(self, target, bkpt)
55 bar = target.FindTypes("Bar").GetTypeAtIndex(0)
56 foo = bar.GetDirectBaseClassAtIndex(0).GetType()
57 self.assertEqual(foo.GetNumberOfFields(), 1)
58 self.assertEqual(foo.GetFieldAtIndex(0).GetName(), "i")