From 7ee20c0a89b78d6426e2befbe83f931fb500f12f Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 12 Nov 2024 19:38:02 -0300 Subject: [PATCH] Do not use assembly for tests --- tests/execution.rs | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/tests/execution.rs b/tests/execution.rs index 0a4d2ced..3cacd0dc 100644 --- a/tests/execution.rs +++ b/tests/execution.rs @@ -3466,40 +3466,27 @@ fn test_invalid_exit_or_return() { #[test] fn callx_unsupported_instruction_and_exceeded_max_instructions() { - test_interpreter_and_jit_asm!( - " + let program = " sub32 r7, r1 sub64 r5, 8 sub64 r7, 0 callx r5 callx r5 return - ", + "; + test_interpreter_and_jit_asm!( + program, [], TestContextObject::new(4), ProgramResult::Err(EbpfError::UnsupportedInstruction), ); - let prog = &[ - 0x1c, 0x17, 0x17, 0x95, 0x61, 0x61, 0x61, 0x61, // sub32 - 0x17, 0x55, 0x54, 0xff, 0x08, 0x00, 0x00, 0x00, // sub64 - 0x17, 0x17, 0x17, 0xff, 0x00, 0x00, 0x00, 0x00, // sub64 - 0x8d, 0x55, 0x54, 0xff, 0x09, 0x00, 0x00, 0x00, // callx - 0x8d, 0x55, 0x54, 0x23, 0x08, 0x00, 0x11, 0x4e, // callx - ]; - let loader = Arc::new(BuiltinProgram::new_loader( Config::default(), FunctionRegistry::default(), )); - let mut executable = Executable::::from_text_bytes( - prog, - loader, - SBPFVersion::V2, - FunctionRegistry::default(), - ) - .unwrap(); + let mut executable = assemble(program, loader).unwrap(); test_interpreter_and_jit!( true, false,