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