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 mydir = TestBase.compute_mydir(__file__) 18 19 @skipUnlessDarwin 20 def test_expr(self): 21 self.build() 22 self.main_source_file = lldb.SBFileSpec("main.m") 23 self.runCmd("settings set target.auto-import-clang-modules true") 24 mod_cache = self.getBuildArtifact("my-clang-modules-cache") 25 if os.path.isdir(mod_cache): 26 shutil.rmtree(mod_cache) 27 self.assertFalse(os.path.isdir(mod_cache), 28 "module cache should not exist") 29 self.runCmd('settings set symbols.clang-modules-cache-path "%s"' % mod_cache) 30 self.runCmd('settings set target.clang-module-search-paths "%s"' 31 % self.getSourceDir()) 32 (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( 33 self, "Set breakpoint here", self.main_source_file) 34 self.runCmd("expr @import Foo") 35 self.assertTrue(os.path.isdir(mod_cache), "module cache exists") 36