Skip to content

Commit

Permalink
Test unregistered callx in both versions
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasSte committed Nov 18, 2024
1 parent 7ee20c0 commit e724f76
Showing 1 changed file with 26 additions and 13 deletions.
39 changes: 26 additions & 13 deletions tests/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2364,19 +2364,32 @@ fn test_callx() {

#[test]
fn test_err_callx_unregistered() {
// We execute three instructions when callx errors out.
test_interpreter_and_jit_asm!(
"
mov64 r0, 0x0
or64 r8, 0x20
callx r8
exit
mov64 r0, 0x2A
exit",
[],
TestContextObject::new(3),
ProgramResult::Err(EbpfError::UnsupportedInstruction),
);
let versions = [SBPFVersion::V1, SBPFVersion::V2];
let expected_errors = [
EbpfError::CallOutsideTextSegment,
EbpfError::UnsupportedInstruction,
];

for (version, error) in versions.iter().zip(expected_errors) {
let config = Config {
enabled_sbpf_versions: *version..=*version,
..Config::default()
};

test_interpreter_and_jit_asm!(
"
mov64 r0, 0x0
or64 r8, 0x20
callx r8
exit
mov64 r0, 0x2A
exit",
config,
[],
TestContextObject::new(3),
ProgramResult::Err(error),
);
}
}

#[test]
Expand Down

0 comments on commit e724f76

Please sign in to comment.