rust/tests/run-make/sanitizer-cdylib-link/rmake.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
754 B
Rust
Raw Normal View History

2024-07-22 15:30:43 -05:00
// Identical to sanitizer-dylib-link, but with a cdylib.
// This test builds a shared object, then an executable that links it as a native
// rust library (contrast to an rlib). The shared library and executable both
// are compiled with address sanitizer, and we assert that a fault in the cdylib
// is correctly detected.
// See https://github.com/rust-lang/rust/pull/38699
//@ needs-sanitizer-support
//@ needs-sanitizer-address
use run_make_support::{run_fail, rustc};
fn main() {
rustc().arg("-g").arg("-Zsanitizer=address").crate_type("cdylib").input("library.rs").run();
rustc().arg("-g").arg("-Zsanitizer=address").crate_type("bin").input("program.rs").run();
run_fail("program").assert_stderr_contains("stack-buffer-overflow");
}