about summary refs log tree commit diff stats
path: root/test/test_all.py
diff options
context:
space:
mode:
authorserpilliere <serpilliere@users.noreply.github.com>2015-11-16 13:39:29 +0100
committerserpilliere <serpilliere@users.noreply.github.com>2015-11-16 13:39:29 +0100
commitd8d4a99b21559514d8371b46e1d1df459b43a41e (patch)
tree13af39242090b9d400e679ad496ccb440b34eb57 /test/test_all.py
parent1f892fabed6300aeb592121af5b2137ac35c07f6 (diff)
parent35822fc551ce0c881c7e5216e2a2119cbed0a162 (diff)
downloadmiasm-d8d4a99b21559514d8371b46e1d1df459b43a41e.tar.gz
miasm-d8d4a99b21559514d8371b46e1d1df459b43a41e.zip
Merge pull request #274 from commial/test-qemu
Test qemu
Diffstat (limited to '')
-rw-r--r--test/test_all.py66
1 files changed, 66 insertions, 0 deletions
diff --git a/test/test_all.py b/test/test_all.py
index 28da3d5a..6288466a 100644
--- a/test/test_all.py
+++ b/test/test_all.py
@@ -51,6 +51,72 @@ for script in ["x86/sem.py",
                ]:
     testset += RegressionTest([script], base_dir="arch")
 
+### QEMU regression tests
+class QEMUTest(RegressionTest):
+    """Test against QEMU regression tests
+    An expected output is provided, computed on a x86 host"""
+
+    SCRIPT_NAME = "testqemu.py"
+    SAMPLE_NAME = "test-i386"
+    EXPECTED_PATH = "expected"
+
+    def __init__(self, name, jitter, *args, **kwargs):
+        super(QEMUTest, self).__init__([self.SCRIPT_NAME], *args, **kwargs)
+        self.base_dir = os.path.join(self.base_dir, "arch", "x86", "qemu")
+        test_name = "test_%s" % name
+        expected_output = os.path.join(self.EXPECTED_PATH, test_name) + ".exp"
+        self.command_line += [self.SAMPLE_NAME,
+                              test_name,
+                              expected_output,
+                              "--jitter",
+                              jitter,
+        ]
+
+# Test name -> supported jitter engines
+QEMU_TESTS = {
+    # Operations
+    "btr": ("tcc", "python"),
+    "bts": ("tcc", "python"),
+    "bt": ("tcc", "python"),
+    "shrd": ("tcc", "python"),
+    "shld": ("tcc", "python"),
+    "rcl": ("tcc", "python"),
+    "rcr": ("tcc", "python"),
+    "ror": ("tcc", "python"),
+    "rol": ("tcc", "python"),
+    "sar": ("tcc", "python"),
+    "shr": ("tcc", "python"),
+    "shl": ("tcc", "python"),
+    "not": ("tcc", "python"),
+    "neg": ("tcc", "python"),
+    "dec": ("tcc", "python"),
+    "inc": ("tcc", "python"),
+    "sbb": ("tcc", "python"),
+    "adc": ("tcc", "python"),
+    "cmp": ("tcc", "python"),
+    "or": ("tcc", "python"),
+    "and": ("tcc", "python"),
+    "xor": ("tcc", "python"),
+    "sub": ("tcc", "python"),
+    "add": ("tcc", "python"),
+    # Specifics
+    "bsx": ("tcc", "python"),
+    "mul": ("tcc", "python"),
+    "jcc": ("tcc", "python"),
+    "loop": ("tcc", "python"),
+    "lea": ("tcc", "python"),
+    "self_modifying_code": ("tcc", "python"),
+    "conv": ("tcc", "python"),
+    # Unsupported
+    # "floats", "bcd", "xchg", "string", "misc", "segs", "code16", "exceptions",
+    # "single_step"
+}
+
+
+for test_name, jitters in QEMU_TESTS.iteritems():
+    for jitter_engine in jitters:
+        testset += QEMUTest(test_name, jitter_engine)
+
 
 ## Semantic
 class SemanticTestAsm(RegressionTest):