Skip to content

Commit

Permalink
Move binary view initialization into function body for LLIL test
Browse files Browse the repository at this point in the history
  • Loading branch information
emesare committed Jan 18, 2025
1 parent f741ac9 commit 03b8ae7
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions rust/tests/llil.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use binaryninja::architecture::Register;
use binaryninja::binary_view::{BinaryView, BinaryViewExt};
use binaryninja::binary_view::BinaryViewExt;
use binaryninja::headless::Session;
use binaryninja::low_level_il::expression::LowLevelExpressionIndex;
use binaryninja::low_level_il::instruction::{
InstructionHandler, LowLevelILInstructionKind, LowLevelInstructionIndex,
};
use binaryninja::low_level_il::LowLevelILRegister;
use binaryninja::rc::Ref;
use rstest::*;
use std::path::PathBuf;

Expand All @@ -16,15 +15,11 @@ fn session() -> Session {
Session::new().expect("Failed to initialize session")
}

#[fixture]
#[once]
fn view() -> Ref<BinaryView> {
#[rstest]
fn test_llil_info(_session: &Session) {
let out_dir = env!("OUT_DIR").parse::<PathBuf>().unwrap();
binaryninja::load(out_dir.join("atox.obj")).expect("Failed to create view")
}
let view = binaryninja::load(out_dir.join("atox.obj")).expect("Failed to create view");

#[rstest]
fn test_llil_info(_session: &Session, view: &BinaryView) {
let entry_function = view.entry_point_function().unwrap();
let llil_function = entry_function.low_level_il().unwrap();
let llil_basic_blocks = llil_function.basic_blocks();
Expand Down

0 comments on commit 03b8ae7

Please sign in to comment.