diff options
| author | serpilliere <fabrice.desclaux@cea.fr> | 2015-07-20 22:01:57 +0200 |
|---|---|---|
| committer | serpilliere <fabrice.desclaux@cea.fr> | 2015-07-20 22:01:57 +0200 |
| commit | 2ff7161eaba5da7845c69be28e8092f030b94bed (patch) | |
| tree | 480e2af9a1f30c027b07c8feb2889eb8bed01a77 /test | |
| parent | be4fdd14245bfb4a1f69a29dc6f1605679446b78 (diff) | |
| download | miasm-2ff7161eaba5da7845c69be28e8092f030b94bed.tar.gz miasm-2ff7161eaba5da7845c69be28e8092f030b94bed.zip | |
X86/Test: add stack unit test
Diffstat (limited to 'test')
| -rw-r--r-- | test/arch/x86/unit/mn_stack.py | 60 | ||||
| -rw-r--r-- | test/test_all.py | 1 |
2 files changed, 61 insertions, 0 deletions
diff --git a/test/arch/x86/unit/mn_stack.py b/test/arch/x86/unit/mn_stack.py new file mode 100644 index 00000000..dd349d54 --- /dev/null +++ b/test/arch/x86/unit/mn_stack.py @@ -0,0 +1,60 @@ +#! /usr/bin/env python +from asm_test import Asm_Test + + +class Test_PUSHPOP(Asm_Test): + TXT = ''' + main: + MOV EBP, ESP + PUSH 0x11223344 + POP EAX + CMP EBP, ESP + JNZ BAD + + PUSHW 0x1122 + POPW AX + CMP EBP, ESP + JNZ BAD + + PUSH SS + POP EAX + CMP EBP, ESP + JNZ BAD + + PUSHW SS + POPW AX + CMP EBP, ESP + JNZ BAD + + PUSHFD + POP EAX + CMP EBP, ESP + JNZ BAD + + PUSHFW + POPW AX + CMP EBP, ESP + JNZ BAD + + PUSH EAX + POPFD + CMP EBP, ESP + JNZ BAD + + PUSHW AX + POPFW + CMP EBP, ESP + JNZ BAD + + RET + +BAD: + INT 0x3 + RET + ''' + def check(self): + assert(self.myjit.cpu.ESP-4 == self.myjit.cpu.EBP) + + +if __name__ == "__main__": + [test()() for test in [Test_PUSHPOP]] diff --git a/test/test_all.py b/test/test_all.py index 895dbdac..f59e3781 100644 --- a/test/test_all.py +++ b/test/test_all.py @@ -35,6 +35,7 @@ testset += RegressionTest(["x86/arch.py"], base_dir="arch", for script in ["x86/sem.py", "x86/unit/mn_strings.py", "x86/unit/mn_float.py", + "x86/unit/mn_stack.py", "arm/arch.py", "arm/sem.py", "msp430/arch.py", |