about summary refs log tree commit diff stats
path: root/test/test_all.py
diff options
context:
space:
mode:
authorCamille Mougey <camille.mougey@cea.fr>2015-01-06 18:04:25 +0100
committerCamille Mougey <camille.mougey@cea.fr>2015-01-23 17:24:41 +0100
commit2e876ebdbc9bdb504f72c7af5492dc20985e3973 (patch)
tree71dda319e78d9e2e30ce8c92ff560fa25c70e8ea /test/test_all.py
parentb495563e636c223be39d5ed516572f6a8406b2b3 (diff)
downloadmiasm-2e876ebdbc9bdb504f72c7af5492dc20985e3973.tar.gz
miasm-2e876ebdbc9bdb504f72c7af5492dc20985e3973.zip
Examples: Update box_upx.exe location
Diffstat (limited to '')
-rw-r--r--test/test_all.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/test/test_all.py b/test/test_all.py
index a1b081cc..ffbca63c 100644
--- a/test/test_all.py
+++ b/test/test_all.py
@@ -73,11 +73,20 @@ class Example(Test):
     - @base_dir: example/@base_dir
     - @tags: TAGS["example"]"""
 
+    # Directory containing samples for examples
+    sample_dir = "samples"
+
     def __init__(self, *args, **kwargs):
         super(Example, self).__init__(*args, **kwargs)
         self.base_dir = os.path.join("example", self.base_dir)
         self.tags.append(TAGS["example"])
 
+    @classmethod
+    def get_sample(cls, sample_name):
+        "Return the relative path of @sample_name"
+        return os.path.join(cls.sample_dir, sample_name)
+
+
 ## Assembler
 testset += Example(['asm_x86.py'], products=["demo_x86_32.bin"])
 test_arm = Example(["asm_arm.py"], products=["demo_arm_l.bin", "demo_arm_b.bin"])
@@ -104,7 +113,7 @@ testset += test_msp430
 testset += test_mips32
 for script in [["disasm_01.py"],
                ["disasm_02.py"],
-               ["disasm_03.py", "box_upx.exe", "0x410f90"],
+               ["disasm_03.py", Example.get_sample("box_upx.exe"), "0x410f90"],
                ]:
     testset += Example(script)
 ## Expression
@@ -165,8 +174,9 @@ for jitter in ["tcc", "llvm", "python"]:
     tags = {"python": [TAGS["long"]],
             "llvm": [TAGS["llvm"]],
             }
-    testset += Example(["unpack_upx.py", "box_upx.exe"] + ["--jitter", jitter],
-                       products=["box_upx_exe_unupx.bin"],
+    testset += Example(["unpack_upx.py", Example.get_sample("box_upx.exe")] +
+                       ["--jitter", jitter],
+                       products=[Example.get_sample("box_upx_exe_unupx.bin")],
                        tags=tags.get(jitter, []))
 
 for script, dep in [(["test_jit_x86_32.py", "x86_32_sc.bin"], []),