xref: /llvm-project-15.0.7/lldb/test/API/arm/emulation/TestEmulations.py (revision 4e00a192)
  • Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"""
2Test some ARM instruction emulation.
3"""
4
5from __future__ import print_function
6
7
8import os
9import lldb
10from lldbsuite.test.decorators import *
11from lldbsuite.test.lldbtest import *
12from lldbsuite.test import lldbutil
13
14
15class ARMEmulationTestCase(TestBase):
16
17    mydir = TestBase.compute_mydir(__file__)
18
19    @no_debug_info_test
20    def test_thumb_emulations(self):
21        test_dir = os.path.join(self.getSourceDir(), "new-test-files")
22        files = os.listdir(test_dir)
23        thumb_files = list()
24        for f in files:
25            if '-thumb.dat' in f:
26                thumb_files.append(f)
27
28        for f in thumb_files:
29            test_file = os.path.join(test_dir, f)
30            self.run_a_single_test(test_file)
31
32    @no_debug_info_test
33    def test_arm_emulations(self):
34        test_dir = os.path.join(self.getSourceDir(), "new-test-files")
35        files = os.listdir(test_dir)
36        arm_files = list()
37        for f in files:
38            if '-arm.dat' in f:
39                arm_files.append(f)
40
41        for f in arm_files:
42            test_file = os.path.join(test_dir, f)
43            self.run_a_single_test(test_file)
44
45    def run_a_single_test(self, filename):
46        insn = lldb.SBInstruction()
47        stream = lldb.SBStream()
48        success = insn.TestEmulation(stream, filename)
49        output = stream.GetData()
50        if self.TraceOn():
51            print('\nRunning test ' + os.path.basename(filename))
52            print(output)
53
54        self.assertTrue(success, 'Emulation test succeeded.')
55

served by {OpenGrok

Last Index Update: Tue Oct 21 18:42:31 GMT 2025