2011-04-19 23:30:03 +00:00
|
|
|
"""
|
|
|
|
Test some ARM instruction emulation.
|
|
|
|
"""
|
|
|
|
|
2015-10-23 17:04:29 +00:00
|
|
|
from __future__ import print_function
|
|
|
|
|
2015-10-27 20:12:05 +00:00
|
|
|
import use_lldb_suite
|
2015-10-22 20:06:20 +00:00
|
|
|
|
2011-04-19 23:30:03 +00:00
|
|
|
import os, time
|
|
|
|
import lldb
|
|
|
|
from lldbtest import *
|
|
|
|
|
|
|
|
class ARMEmulationTestCase(TestBase):
|
|
|
|
|
2013-12-10 23:19:29 +00:00
|
|
|
mydir = TestBase.compute_mydir(__file__)
|
2011-04-19 23:30:03 +00:00
|
|
|
|
2015-09-30 10:12:40 +00:00
|
|
|
@no_debug_info_test
|
2011-04-19 23:30:03 +00:00
|
|
|
def test_thumb_emulations (self):
|
|
|
|
current_dir = os.getcwd();
|
2011-04-22 16:05:13 +00:00
|
|
|
test_dir = os.path.join (current_dir, "new-test-files")
|
2011-04-19 23:30:03 +00:00
|
|
|
files = os.listdir (test_dir)
|
|
|
|
thumb_files = list()
|
|
|
|
for f in files:
|
|
|
|
if '-thumb.dat' in f:
|
|
|
|
thumb_files.append (f)
|
|
|
|
|
|
|
|
for f in thumb_files:
|
|
|
|
test_file = os.path.join (test_dir, f)
|
|
|
|
self.run_a_single_test (test_file)
|
|
|
|
|
2015-09-30 10:12:40 +00:00
|
|
|
@no_debug_info_test
|
2011-04-19 23:30:03 +00:00
|
|
|
def test_arm_emulations (self):
|
|
|
|
current_dir = os.getcwd();
|
2011-04-22 16:05:13 +00:00
|
|
|
test_dir = os.path.join (current_dir, "new-test-files")
|
2011-04-19 23:30:03 +00:00
|
|
|
files = os.listdir (test_dir)
|
|
|
|
arm_files = list()
|
|
|
|
for f in files:
|
|
|
|
if '-arm.dat' in f:
|
|
|
|
arm_files.append (f)
|
|
|
|
|
|
|
|
for f in arm_files:
|
|
|
|
test_file = os.path.join (test_dir, f)
|
|
|
|
self.run_a_single_test (test_file)
|
|
|
|
|
|
|
|
def run_a_single_test (self, filename):
|
|
|
|
insn = lldb.SBInstruction ();
|
|
|
|
stream = lldb.SBStream ();
|
|
|
|
success = insn.TestEmulation (stream, filename);
|
|
|
|
output = stream.GetData();
|
2011-04-21 20:27:45 +00:00
|
|
|
if self.TraceOn():
|
2015-10-23 17:04:29 +00:00
|
|
|
print('\nRunning test ' + os.path.basename(filename))
|
|
|
|
print(output)
|
2011-04-19 23:30:03 +00:00
|
|
|
|
2011-04-21 20:27:45 +00:00
|
|
|
self.assertTrue (success, 'Emulation test succeeded.')
|