about summary refs log tree commit diff stats
path: root/test/test_all.py
diff options
context:
space:
mode:
authorajax <devnull@localhost>2014-06-16 19:25:57 +0200
committerajax <devnull@localhost>2014-06-16 19:25:57 +0200
commitb4672a0881de3a62d6ea711603870db9a28f6cce (patch)
tree8257106a0d244179b7cf0cf81bfb7e662cde431c /test/test_all.py
parentca3d3ae4ebe17e010a14071d9a91d53ce6f0eb82 (diff)
downloadmiasm-b4672a0881de3a62d6ea711603870db9a28f6cce.tar.gz
miasm-b4672a0881de3a62d6ea711603870db9a28f6cce.zip
Test: Yes, we can use a function to invoke all jitter each time
Diffstat (limited to 'test/test_all.py')
-rw-r--r--test/test_all.py56
1 files changed, 23 insertions, 33 deletions
diff --git a/test/test_all.py b/test/test_all.py
index ca9383f0..d822b244 100644
--- a/test/test_all.py
+++ b/test/test_all.py
@@ -5,6 +5,18 @@ import time
 import argparse
 import tempfile
 
+# Test derivations
+def all_jit(assembly_line):
+    """Add all available jitter options to assembly_line thanks to '--jitter'
+    option.
+    @assembly_line: list(str)
+    Return a list of assembly lines: list(list(str)).
+    """
+    out = []
+    for jitter in ["tcc", "llvm", "python"]:
+        out.append(assembly_line + ["--jitter", jitter])
+    return out
+
 # Available tests
 
 all_tests = {
@@ -67,39 +79,17 @@ all_tests = {
             ["expression/solve_condition_stp.py",
                 "expression/simple_test.bin"],
         ],
-        "jitter": [
-            ["unpack_upx.py", "--jitter", "tcc", "box_upx.exe"],
-            ["unpack_upx.py", "--jitter", "llvm", "box_upx.exe"],
-            # Take 5 mins on a Core i5 2.7Ghz
-            ["unpack_upx.py", "--jitter", "python", "box_upx.exe"],
-            ["test_jit_x86_32.py", "--jitter", "tcc", "x86_32_sc.bin"],
-            ["test_jit_x86_32.py", "--jitter", "llvm", "x86_32_sc.bin"],
-            ["test_jit_x86_32.py", "--jitter", "python", "x86_32_sc.bin"],
-            ["test_jit_arm.py", "--jitter", "tcc","md5_arm", "A684"],
-            ["test_jit_arm.py", "--jitter", "llvm","md5_arm", "A684"],
-            ["test_jit_arm.py", "--jitter", "python","md5_arm", "A684"],
-            ["sandbox_pe_x86_32.py", "--jitter", "tcc", "box_x86_32.bin"],
-            ["sandbox_pe_x86_32.py", "--jitter", "llvm", "box_x86_32.bin"],
-            ["sandbox_pe_x86_32.py", "--jitter", "python", "box_x86_32.bin"],
-            ["sandbox_pe_x86_32.py", "--jitter", "tcc", "box_x86_32_enc.bin"],
-            ["sandbox_pe_x86_32.py", "--jitter", "llvm", "box_x86_32_enc.bin"],
-            ["sandbox_pe_x86_32.py", "--jitter", "python", "box_x86_32_enc.bin"],
-            ["sandbox_pe_x86_32.py", "--jitter", "tcc", "box_x86_32_mod.bin"],
-            ["sandbox_pe_x86_32.py", "--jitter", "llvm", "box_x86_32_mod.bin"],
-            ["sandbox_pe_x86_32.py", "--jitter", "python", "box_x86_32_mod.bin"],
-            ["sandbox_pe_x86_32.py", "--jitter",
-                "tcc", "box_x86_32_mod_self.bin"],
-            ["sandbox_pe_x86_32.py", "--jitter",
-                "llvm", "box_x86_32_mod_self.bin"],
-            ["sandbox_pe_x86_32.py", "--jitter",
-                "python", "box_x86_32_mod_self.bin"],
-            ["sandbox_pe_x86_32.py", "--jitter",
-                "tcc", "box_x86_32_repmod.bin"],
-            ["sandbox_pe_x86_32.py", "--jitter",
-                "llvm", "box_x86_32_repmod.bin"],
-            ["sandbox_pe_x86_32.py", "--jitter",
-                "python", "box_x86_32_repmod.bin"],
-        ],
+        "jitter": reduce(lambda x, y: x + y,
+                         map(all_jit, [
+                    ["unpack_upx.py", "box_upx.exe"], # Take 5 mins on a Core i5
+                    ["test_jit_x86_32.py", "x86_32_sc.bin"],
+                    ["test_jit_arm.py", "md5_arm", "A684"],
+                    ["sandbox_pe_x86_32.py", "box_x86_32.bin"],
+                    ["sandbox_pe_x86_32.py", "box_x86_32_enc.bin"],
+                    ["sandbox_pe_x86_32.py", "box_x86_32_mod.bin"],
+                    ["sandbox_pe_x86_32.py", "box_x86_32_repmod.bin"],
+                    ["sandbox_pe_x86_32.py", "box_x86_32_mod_self.bin"],
+                    ])),
         "order": [
             "assembler",
             "expression",