[AMDGPU] Add True16 register classes.
[llvm-project.git] / lldb / test / API / commands / expression / save_jit_objects / TestSaveJITObjects.py
blob438b92cdc484627407b7770c7b7046d2414016e0
1 """
2 Test that LLDB can emit JIT objects when the appropriate setting is enabled
3 """
6 import os
7 import lldb
8 from lldbsuite.test.decorators import *
9 from lldbsuite.test.lldbtest import *
10 from lldbsuite.test import lldbutil
13 class SaveJITObjectsTestCase(TestBase):
14 def enumerateJITFiles(self):
15 return [f for f in os.listdir(self.getBuildDir()) if f.startswith("jit")]
17 def countJITFiles(self):
18 return len(self.enumerateJITFiles())
20 def cleanJITFiles(self):
21 for j in self.enumerateJITFiles():
22 os.remove(j)
23 return
25 @expectedFailureAll(oslist=["windows"])
26 def test_save_jit_objects(self):
27 self.build()
28 os.chdir(self.getBuildDir())
29 src_file = "main.c"
30 src_file_spec = lldb.SBFileSpec(src_file)
32 (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
33 self, "break", src_file_spec
36 frame = thread.frames[0]
38 self.cleanJITFiles()
39 frame.EvaluateExpression("(void*)malloc(0x1)")
40 self.assertEquals(
41 self.countJITFiles(), 0, "No files emitted with save-jit-objects-dir empty"
44 self.runCmd(
45 "settings set target.save-jit-objects-dir {0}".format(self.getBuildDir())
47 frame.EvaluateExpression("(void*)malloc(0x1)")
48 jit_files_count = self.countJITFiles()
49 self.cleanJITFiles()
50 self.assertNotEqual(
51 jit_files_count,
53 "At least one file emitted with save-jit-objects-dir set to the build dir",
56 process.Kill()
57 os.chdir(self.getSourceDir())