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