From 2ff7161eaba5da7845c69be28e8092f030b94bed Mon Sep 17 00:00:00 2001 From: serpilliere Date: Mon, 20 Jul 2015 22:01:57 +0200 Subject: X86/Test: add stack unit test --- test/arch/x86/unit/mn_stack.py | 60 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 test/arch/x86/unit/mn_stack.py (limited to 'test/arch/x86/unit/mn_stack.py') 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]] -- cgit 1.4.1