1""" 2Test 'target modules dump pcm-info'. 3""" 4 5import os 6import shutil 7import glob 8 9from lldbsuite.test.decorators import * 10from lldbsuite.test.lldbtest import * 11from lldbsuite.test import lldbutil 12 13 14class TestCase(TestBase): 15 @no_debug_info_test 16 @skipUnlessDarwin 17 def test(self): 18 self.build() 19 20 lldbutil.run_to_source_breakpoint(self, "return", lldb.SBFileSpec("main.m")) 21 22 mod_cache = self.getBuildArtifact("private-module-cache") 23 if os.path.isdir(mod_cache): 24 shutil.rmtree(mod_cache) 25 26 self.runCmd(f"settings set symbols.clang-modules-cache-path '{mod_cache}'") 27 28 # Cause lldb to generate a Darwin-*.pcm 29 self.runCmd("expression @import Darwin") 30 31 # root/<config-hash>/<module-name>-<modulemap-path-hash>.pcm 32 pcm_paths = glob.glob(os.path.join(mod_cache, "*", "Darwin-*.pcm")) 33 self.assertEqual(len(pcm_paths), 1, "Expected one Darwin pcm") 34 pcm_path = pcm_paths[0] 35 36 self.expect( 37 f"target modules dump pcm-info '{pcm_path}'", 38 startstr=f"Information for module file '{pcm_path}'", 39 substrs=["Module name: Darwin"], 40 ) 41