33 lines · python
1"""Test that the clang modules cache directory can be controlled."""2 3 4import os5import shutil6 7import lldb8from lldbsuite.test.decorators import *9from lldbsuite.test.lldbtest import *10from lldbsuite.test import lldbutil11 12 13class ObjCModulesTestCase(TestBase):14 NO_DEBUG_INFO_TESTCASE = True15 16 def test_expr(self):17 self.build()18 self.main_source_file = lldb.SBFileSpec("main.m")19 self.runCmd("settings set target.auto-import-clang-modules true")20 mod_cache = self.getBuildArtifact("my-clang-modules-cache")21 if os.path.isdir(mod_cache):22 shutil.rmtree(mod_cache)23 self.assertFalse(os.path.isdir(mod_cache), "module cache should not exist")24 self.runCmd('settings set symbols.clang-modules-cache-path "%s"' % mod_cache)25 self.runCmd(26 'settings set target.clang-module-search-paths "%s"' % self.getSourceDir()27 )28 (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(29 self, "Set breakpoint here", self.main_source_file30 )31 self.runCmd("expr @import Foo")32 self.assertTrue(os.path.isdir(mod_cache), "module cache exists")33