Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 72 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 31 additions & 28 deletions analysis/test/src/pointers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,37 +355,40 @@ pub unsafe extern "C" fn insertion_sort(n: libc::c_int, p: *mut libc::c_int) {
}
}
unsafe fn main_0(mut argc: libc::c_int, mut argv: *mut *mut libc::c_char) -> libc::c_int {
// simple();
// exercise_allocator();
// simple_analysis();
// analysis2();
// inter_function_analysis();
// no_owner(0i32);
// no_owner(1i32);
// invalid();
// testing();
// simple1();
simple();
exercise_allocator();
simple_analysis();
analysis2();
inter_function_analysis();
no_owner(0i32);
no_owner(1i32);
invalid();
testing();
simple1();
// segfault at:
// chunks[10].iov_base = ((*(*c).mem).ptr).offset((*c).offset as isize) as *mut libc::c_void;
// due to nullptr arg
// lighttpd_test(std::ptr::null_mut());

// test_malloc_free();
// test_malloc_free_cast();
// test_arg();
// test_arg_rec();
// test_realloc_reassign();
// test_realloc_fresh();
// test_load_addr();
// test_overwrite();
// test_store_addr();
// test_load_other_store_self();
test_malloc_free();
test_malloc_free_cast();
test_arg();
test_arg_rec();
test_realloc_reassign();
test_realloc_fresh();
test_load_addr();
test_overwrite();
test_store_addr();
test_load_other_store_self();
test_load_self_store_self();
// test_load_self_store_self_inter();
// test_ptr_int_ptr();
// test_load_value();
// test_store_value();
// test_store_value_field();
// test_load_value_store_value();
// let nums = &mut [2i32, 5i32, 3i32, 1i32, 6i32];
// insertion_sort(nums.len() as libc::c_int, nums as *mut libc::c_int);
test_load_self_store_self_inter();
test_ptr_int_ptr();
test_load_value();
test_store_value();
test_store_value_field();
test_load_value_store_value();
let nums = &mut [2i32, 5i32, 3i32, 1i32, 6i32];
insertion_sort(nums.len() as libc::c_int, nums as *mut libc::c_int);
return 0i32;
}
pub fn main() {
Expand Down
3 changes: 3 additions & 0 deletions pdg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@ clap = { version = "3.2", features = ["derive"] }
[build-dependencies]
color-eyre = "0.6"

[dev-dependencies]
insta = "1.15"

[package.metadata.rust-analyzer]
rustc_private = true
18 changes: 18 additions & 0 deletions pdg/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,21 @@ fn main() -> eyre::Result<()> {

Ok(())
}

#[cfg(test)]
mod tests {
use std::{env, path::Path, process::Command};

use color_eyre::eyre;

#[test]
fn analysis_test_pdg_snapshot() -> eyre::Result<()> {
color_eyre::install()?;
env::set_current_dir("..")?;
let dir = Path::new("analysis/test");
Command::new("scripts/pdg.sh").arg(dir).status()?;
let pdg = fs_err::read_to_string(dir.join("pdg.log"))?;
insta::assert_display_snapshot!(pdg);
Ok(())
}
}
Loading