diff options
Diffstat (limited to '')
| -rw-r--r-- | example/disasm_03.py | 2 | ||||
| -rw-r--r-- | test/test_all.py | 16 |
2 files changed, 14 insertions, 4 deletions
diff --git a/example/disasm_03.py b/example/disasm_03.py index 1141dc55..f86a485e 100644 --- a/example/disasm_03.py +++ b/example/disasm_03.py @@ -5,7 +5,7 @@ from miasm2.analysis.binary import Container if len(sys.argv) != 3: print 'Example:' - print "%s box_upx.exe 0x410f90" % sys.argv[0] + print "%s samples/box_upx.exe 0x410f90" % sys.argv[0] sys.exit(0) ad = int(sys.argv[2], 16) 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"], []), |