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