Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / arm / emulation / TestEmulations.py
blob02d6691b514daa70ffe33d7ccff7f7d3283835e8
1 """
2 Test some ARM instruction emulation.
3 """
5 import os
6 import lldb
7 from lldbsuite.test.decorators import *
8 from lldbsuite.test.lldbtest import *
9 from lldbsuite.test import lldbutil
12 class ARMEmulationTestCase(TestBase):
13 @no_debug_info_test
14 def test_thumb_emulations(self):
15 test_dir = os.path.join(self.getSourceDir(), "new-test-files")
16 files = os.listdir(test_dir)
17 thumb_files = list()
18 for f in files:
19 if f.endswith("-thumb.dat"):
20 thumb_files.append(f)
22 for f in thumb_files:
23 test_file = os.path.join(test_dir, f)
24 self.run_a_single_test(test_file)
26 @no_debug_info_test
27 def test_arm_emulations(self):
28 test_dir = os.path.join(self.getSourceDir(), "new-test-files")
29 files = os.listdir(test_dir)
30 arm_files = list()
31 for f in files:
32 if f.endswith("-arm.dat"):
33 arm_files.append(f)
35 for f in arm_files:
36 test_file = os.path.join(test_dir, f)
37 self.run_a_single_test(test_file)
39 def run_a_single_test(self, filename):
40 insn = lldb.SBInstruction()
41 stream = lldb.SBStream()
42 success = insn.TestEmulation(stream, filename)
43 output = stream.GetData()
44 if self.TraceOn():
45 print("\nRunning test " + os.path.basename(filename))
46 print(output)
48 self.assertTrue(success, "Emulation test {} failed.".format(filename))