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
:
16 module Foo { header "f.h" }
19 with
open(self
.getBuildArtifact("f.h"), "w") as f
:
23 @interface Foo : NSObject {
31 mod_cache
= self
.getBuildArtifact("private-module-cache")
34 if os
.path
.isdir(mod_cache
):
35 shutil
.rmtree(mod_cache
)
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")
49 os
.remove(self
.getBuildArtifact("main.o"))
50 os
.remove(self
.getBuildArtifact("a.out"))
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")