Skip to content

Commit

Permalink
Adds missing test coverage for EbpfError::ExecutionOverrun.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichtso committed Sep 12, 2024
1 parent 01aa047 commit 15b5bcd
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3453,12 +3453,47 @@ fn test_err_fixed_stack_out_of_bound() {
);
}

#[test]
fn test_execution_overrun() {
let config = Config {
enabled_sbpf_versions: SBPFVersion::V1..=SBPFVersion::V1,
..Config::default()
};
test_interpreter_and_jit_asm!(
"
add r1, 0",
config.clone(),
[],
(),
TestContextObject::new(2),
ProgramResult::Err(EbpfError::ExecutionOverrun),
);
test_interpreter_and_jit_asm!(
"
add r1, 0",
config.clone(),
[],
(),
TestContextObject::new(1),
ProgramResult::Err(EbpfError::ExceededMaxInstructions),
);
}

#[test]
fn test_lddw() {
let config = Config {
enabled_sbpf_versions: SBPFVersion::V1..=SBPFVersion::V1,
..Config::default()
};
test_interpreter_and_jit_asm!(
"
lddw r0, 0x1122334455667788",
config.clone(),
[],
(),
TestContextObject::new(2),
ProgramResult::Err(EbpfError::ExecutionOverrun),
);
test_interpreter_and_jit_asm!(
"
lddw r0, 0x1122334455667788
Expand Down

0 comments on commit 15b5bcd

Please sign in to comment.