X64EmitterTest: Check bytes instead of disassembly in JMP test

Check bytes directly to avoid ambiguity in the disassembly between short
and near jumps, which could hypothetically cause the test to pass when
it shouldn't.
This commit is contained in:
Dentomologist 2023-08-05 13:47:11 -07:00
parent dcd5ba6587
commit 4ccac53e9f

View file

@ -297,15 +297,13 @@ TEST_F(x64EmitterTest, POP_Register)
TEST_F(x64EmitterTest, JMP) TEST_F(x64EmitterTest, JMP)
{ {
emitter->NOP(6); emitter->NOP(1);
emitter->JMP(code_buffer); emitter->JMP(code_buffer, XEmitter::Jump::Short);
ExpectDisassembly("multibyte nop " ExpectBytes({/* nop */ 0x90, /* short jmp */ 0xeb, /* offset -3 */ 0xfd});
"jmp .-8");
emitter->NOP(6); emitter->NOP(1);
emitter->JMP(code_buffer, XEmitter::Jump::Near); emitter->JMP(code_buffer, XEmitter::Jump::Near);
ExpectDisassembly("multibyte nop " ExpectBytes({/* nop */ 0x90, /* near jmp */ 0xe9, /* offset -6 */ 0xfa, 0xff, 0xff, 0xff});
"jmp .-11");
} }
TEST_F(x64EmitterTest, JMPptr_Register) TEST_F(x64EmitterTest, JMPptr_Register)